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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux