[et-mgmt-tools] [PATCH] Fix connecting console at domain restarting

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

 



Hi,

When I execute virt-install --paravirt --nographics, the serial console 
isn't connected after the domain restarting.
The attached patch adds to solve this problem.

Signed-off-by: Nobuhiro Itou <fj0873gn@xxxxxxxxxxxxxxxxx>


Thanks,
Nobuhiro Itou.


diff -r c5d674528d03 virtinst/Guest.py
--- a/virtinst/Guest.py	Fri Apr 13 14:52:04 2007 -0400
+++ b/virtinst/Guest.py	Mon Apr 16 09:53:15 2007 +0900
@@ -710,6 +710,28 @@ class Guest(object):
         return self.conn.lookupByName(self.name)
 
     def connect_console(self, consolecb):
+        logging.debug("Restarted guest, looking to see if it is running")
+        # sleep in .25 second increments until either a) we get running
+        # domain ID or b) it's been 5 seconds.  this is so that
+        # we can try to gracefully handle domain restarting failures
+        num = 0
+        while num < (5 / .25): # 5 seconds, .25 second sleeps
+            try:
+                self.domain = self.conn.lookupByName(self.name)
+                if self.domain and self.domain.ID() != -1:
+                    break
+            except libvirt.libvirtError, e:
+                logging.debug("No guest existing " + str(e))
+                self.domain = None
+                pass
+            num += 1
+            time.sleep(0.25)
+
+        if self.domain is None:
+            raise RuntimeError, "Domain has not existed.  You should be able to find more information in the logs"
+        elif self.domain.ID() == -1:
+            raise RuntimeError, "Domain has not run yet.  You should be able to find more information in the logs"
+
         child = None
         if consolecb:
             logging.debug("Launching console callback")


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux