[et-mgmt-tools] [PATCH][RESEND] connecting console after installcompletes

Nobuhiro Itou fj0873gn at aa.jp.fujitsu.com
Wed Mar 14 10:19:46 UTC 2007

Hi, Hugh

> Two issues here:
> 1. The whole "restart the guest automatically" feature in virt-install 
> is a bit of a hack, and we are contemplating removing it altogether. The 
> problem is that virt-install has no real way of knowing whether the 
> guest that just shut down is really waiting to be rebooted, or is in 
> fact a failed install that the user would not want restarted anyway. 

But, the "restart" hack is also true to help the user.
Especially, the domain cannot be completely installed about Windows etc. 
with the reboot during the installation if it doesn't start automatically.
Please keep autorestart function like --autorestart.

> Having said this, as long as the "restart" hack is still there, I guess 
> I have no problem reconnecting the console as well.
> 2. Minor nit: instead of swallowing the error like
> +            except OSError, (errno, msg):
> +                print __name__, "waitpid:", msg
> why not go ahead and raise a RuntimeError (and log the message) or 
> something similar?

How about this correction?

Nobuhiro Itou.

diff -r 6b63ce413aab virt-install
--- a/virt-install      Tue Mar 13 12:43:49 2007 -0400
+++ b/virt-install      Wed Mar 14 06:16:00 2007 +0900
@@ -517,6 +517,7 @@ def main():
             # the domain
             print "Guest installation complete... restarting guest."
+            guest.connect_console(conscb)
             print ("Domain installation does not appear to have been\n"
                    "successful.  If it was, you can restart your domain\n"

diff -r 6b63ce413aab virtinst/Guest.py
--- a/virtinst/Guest.py Tue Mar 13 12:43:49 2007 -0400
+++ b/virtinst/Guest.py Wed Mar 14 15:35:56 2007 +0900
@@ -575,6 +575,18 @@ class Guest(object):
         # for inactive guest, or get the still running install..
         return self.conn.lookupByName(self.name)

+    def connect_console(self, consolecb):
+        child = None
+        if consolecb:
+            logging.debug("Launching console callback")
+            child = consolecb(self.domain)
+        if child: # if we connected the console, wait for it to finish
+            try:
+                (pid, status) = os.waitpid(child, 0)
+            except OSError, (errno, msg):
+                raise RuntimeError, "waiting console pid error: %s" % msg
     def validate_parms(self):
         if self.domain is not None:
             raise RuntimeError, "Domain already started!"

More information about the et-mgmt-tools mailing list