create: Stop if virt-bootstrap has failed

Prevent container creation if virt-bootstrap has not finished
successfully.
This commit is contained in:
Radostin Stoyanov
2017-07-24 09:26:44 +01:00
committed by Cole Robinson
parent 6f8206dc55
commit c5264a2390
2 changed files with 8 additions and 1 deletions

View File

@@ -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):

View File

@@ -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()))