From c5264a2390156a641ce7651946c00443c626181d Mon Sep 17 00:00:00 2001 From: Radostin Stoyanov Date: Mon, 24 Jul 2017 09:26:44 +0100 Subject: [PATCH] create: Stop if virt-bootstrap has failed 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 3c96fdf15..35347ca8f 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 d8e09bf39..03769f21e 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) + if asyncjob.has_error(): + # Do not continue if virt-bootstrap failed + 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()))