[virt-tools-list] [virt-manager] [PATCH 1/5] create: Stop if virt-bootstrap has failed

Radostin rstoyanov1 at gmail.com
Wed Jul 26 16:06:15 UTC 2017


The check here should be done only if virt-bootstrap has been called.

> Prevent container creation if virt-bootstrap has not finished
> successfully.
> ---
>  virtManager/asyncjob.py | 3 +++
>  virtManager/create.py   | 6 +++++-
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/virtManager/asyncjob.py b/virtManager/asyncjob.py
> index 3c96fdf..35347ca 100644
> --- a/virtManager/asyncjob.py
> +++ b/virtManager/asyncjob.py
> @@ -257,6 +257,9 @@ class vmmAsyncJob(vmmGObjectUI):
>      def set_error(self, error, details):
>          self._error_info = (error, details)
>  
> +    def has_error(self):
> +        return bool(self._error_info)
> +
>      def set_extra_data(self, data):
>          self._data = data
>      def get_extra_data(self):
> diff --git a/virtManager/create.py b/virtManager/create.py
> index d8e09bf..dd99c17 100644
> --- a/virtManager/create.py
> +++ b/virtManager/create.py
> @@ -2512,6 +2512,9 @@ class vmmCreate(vmmGObjectUI):
>          if bootstrap_args:
>              # Start container bootstrap
>              self._create_directory_tree(asyncjob, meter, bootstrap_args)
> +            # Do not continue if virt-bootstrap has not finished
> successfully
> +            if asyncjob.has_error:
> +                return
>  
>          # Build a list of pools we should refresh, if we are creating
> storage
>          refresh_pools = []
> @@ -2648,4 +2651,5 @@ class vmmCreate(vmmGObjectUI):
>                 
> self.widget("install-oscontainer-bootstrap").set_active(False)
>              self.idle_add(cb)
>          except Exception as err:
> -            asyncjob.set_error(err, log_stream.getvalue())
> +            asyncjob.set_error("virt-bootstrap did not complete
> successfully",
> +                               '%s\n%s' % (err, log_stream.getvalue()))
> -- 
> 2.9.4


On 24/07/17 09:26, Radostin Stoyanov wrote:
> Prevent container creation if virt-bootstrap has not finished
> successfully.
> ---
>  virtManager/asyncjob.py | 3 +++
>  virtManager/create.py   | 7 ++++++-
>  2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/virtManager/asyncjob.py b/virtManager/asyncjob.py
> index 3c96fdf..35347ca 100644
> --- a/virtManager/asyncjob.py
> +++ b/virtManager/asyncjob.py
> @@ -257,6 +257,9 @@ class vmmAsyncJob(vmmGObjectUI):
>      def set_error(self, error, details):
>          self._error_info = (error, details)
>  
> +    def has_error(self):
> +        return bool(self._error_info)
> +
>      def set_extra_data(self, data):
>          self._data = data
>      def get_extra_data(self):
> diff --git a/virtManager/create.py b/virtManager/create.py
> index d8e09bf..b3f02b7 100644
> --- a/virtManager/create.py
> +++ b/virtManager/create.py
> @@ -2513,6 +2513,10 @@ class vmmCreate(vmmGObjectUI):
>              # Start container bootstrap
>              self._create_directory_tree(asyncjob, meter, bootstrap_args)
>  
> +        if asyncjob.has_error:
> +            # Do not continue if virt-bootstrap has not finished successfully
> +            return
> +
>          # Build a list of pools we should refresh, if we are creating storage
>          refresh_pools = []
>          for disk in guest.get_devices("disk"):
> @@ -2648,4 +2652,5 @@ class vmmCreate(vmmGObjectUI):
>                  self.widget("install-oscontainer-bootstrap").set_active(False)
>              self.idle_add(cb)
>          except Exception as err:
> -            asyncjob.set_error(err, log_stream.getvalue())
> +            asyncjob.set_error("virt-bootstrap did not complete successfully",
> +                               '%s\n%s' % (err, log_stream.getvalue()))




More information about the virt-tools-list mailing list