[et-mgmt-tools] Subject:[PATCH] Windows HVM can't continue to install

Nobuhiro Itou fj0873gn at aa.jp.fujitsu.com
Tue Mar 20 09:57:41 UTC 2007


Hi

When I install the Windows HVM domain, it can't continue to install 
after first restart.
It needs a virtual CD-ROM device after reboot too.
And the rebooting frequency of Windows is more once than that of RHEL.
The attached patch adds to solve this problem.

Signed-off-by: Nobuhiro Itou <fj0873gn at aa.jp.fujitsu.com>


Thanks,
Nobuhiro Itou.


diff -r 73d38353c139 virt-install
--- a/virt-install      Fri Mar 16 14:32:06 2007 -0400
+++ b/virt-install      Tue Mar 20 11:38:45 2007 +0900
@@ -532,6 +532,17 @@ def main():
                struct.unpack("H", buf[0x1fe: 0x200]) == (0xaa55,):
             # things installed enough that we should be able to restart
             # the domain
+            if options.os_type == virtinst.FullVirtGuest.TYPE_WINDOWS:
+                # continue to Windows installation.
+                dom = guest.continue_install(conscb,progresscb)
+                if dom is None:
+                    print "Guest installation failed"
+                    sys.exit(0)
+                elif dom.info()[0] != libvirt.VIR_DOMAIN_SHUTOFF:
+                    # domain seems to be running
+                    print "Domain installation still in progress.  You can reconnect "
+                    print "to the console to complete the installation process."
+                    sys.exit(0)
             print "Guest installation complete... restarting guest."
             dom.create()
             guest.connect_console(conscb)

diff -r 73d38353c139 virtinst/Guest.py
--- a/virtinst/Guest.py Fri Mar 16 14:32:06 2007 -0400
+++ b/virtinst/Guest.py Mon Mar 19 22:00:33 2007 +0900
@@ -551,9 +551,12 @@ class Guest(object):
         "networks": self._get_network_xml(install), \
         "graphics": self._get_graphics_xml(install) }

-    def get_config_xml(self, install = True):
+    def get_config_xml(self, install = True, disk_boot = False):
         if install:
-            osblob = self._get_install_xml()
+            if disk_boot:
+                osblob = self._get_runtime_xml()
+            else:
+                osblob = self._get_install_xml()
             action = "destroy"
         else:
             osblob = self._get_runtime_xml()

diff -r 73d38353c139 virtinst/FullVirtGuest.py
--- a/virtinst/FullVirtGuest.py Fri Mar 16 14:32:06 2007 -0400
+++ b/virtinst/FullVirtGuest.py Tue Mar 20 13:00:40 2007 +0900
@@ -17,26 +17,56 @@ import Guest
 import Guest
 import util
 import DistroManager
+import logging

 class FullVirtGuest(Guest.XenGuest):
-    OS_TYPES = { "Linux" : { "Red Hat Enterprise Linux AS 2.1/3" : { "acpi" : True, "apic": True }, \
-                             "Red Hat Enterprise Linux 4" : { "acpi" : True, "apic": True }, \
-                             "Red Hat Enterprise Linux 5" : { "acpi" : True, "apic": True }, \
-                             "Fedora Core 4-6" : { "acpi" : True, "apic": True }, \
-                             "Suse Linux Enterprise Server" : { "acpi" : True, "apic": True }, \
-                             "Other Linux 2.6 kernel" : { "acpi" : True, "apic": True } }, \
-                 "Microsoft Windows" : { "Windows 2000" : { "acpi": False, "apic" : False }, \
-                                         "Windows XP" : { "acpi": True, "apic" : True }, \
-                                         "Windows Server 2003" : { "acpi": True, "apic" : True }, \
-                                         "Windows Vista" : { "acpi": True, "apic" : True } }, \
-                 "Novell Netware" : { "Netware 4" : { "acpi": True, "apic": True }, \
-                                      "Netware 5" : { "acpi": True, "apic": True }, \
-                                      "Netware 6" : { "acpi": True, "apic": True } }, \
-                 "Sun Solaris" : { "Solaris 10" : { "acpi": True, "apic": True }, \
-                                   "Solaris 9" : { "acpi": True, "apic": True } }, \
-                 "Other" : { "MS-DOS" : { "acpi": False, "apic" : False }, \
-                             "Free BSD" : { "acpi": True, "apic" : True }, \
-                             "Other" : { "acpi": True, "apic" : True } } }
+    TYPE_LINUX   = "Linux"
+    TYPE_WINDOWS = "Microsoft Windows"
+    TYPE_NETWARE = "Novell Netware"
+    TYPE_SOLARIS = "Sun Solaris"
+    TYPE_OTHER   = "Other"
+
+    VAR_RHEL2_3 = "Red Hat Enterprise Linux AS 2.1/3"
+    VAR_RHEL4   = "Red Hat Enterprise Linux 4"
+    VAR_RHEL5   = "Red Hat Enterprise Linux 5"
+    VAR_FEDORA  = "Fedora Core 4-6"
+    VAR_SLES    = "Suse Linux Enterprise Server"
+    VAR_O_LINUX = "Other Linux 2.6 kernel"
+
+    VAR_WIN2K    = "Windows 2000"
+    VAR_WINXP    = "Windows XP"
+    VAR_WINSV2K3 = "Windows Server 2003"
+    VAR_WINVISTA = "Windows Vista"
+
+    VAR_NETWARE4 = "Netware 4"
+    VAR_NETWARE5 = "Netware 5"
+    VAR_NETWARE6 = "Netware 6"
+
+    VAR_SOLARIS10 = "Solaris 10"
+    VAR_SOLARIS9  = "Solaris 9"
+
+    VAR_MS_DOS   = "MS-DOS"
+    VAR_FREE_BSD = "Free BSD"
+    VAR_OTHER    = "Other"
+
+    OS_TYPES = { TYPE_LINUX : { VAR_RHEL2_3 : { "acpi" : True, "apic": True }, \
+                                VAR_RHEL4   : { "acpi" : True, "apic": True }, \
+                                VAR_RHEL5   : { "acpi" : True, "apic": True }, \
+                                VAR_FEDORA  : { "acpi" : True, "apic": True }, \
+                                VAR_SLES    : { "acpi" : True, "apic": True }, \
+                                VAR_O_LINUX : { "acpi" : True, "apic": True } }, \
+                 TYPE_WINDOWS : { VAR_WIN2K    : { "acpi": False, "apic" : False }, \
+                                  VAR_WINXP    : { "acpi": True, "apic" : True }, \
+                                  VAR_WINSV2K3 : { "acpi": True, "apic" : True }, \
+                                  VAR_WINVISTA : { "acpi": True, "apic" : True } }, \
+                 TYPE_NETWARE : { VAR_NETWARE4 : { "acpi": True, "apic": True }, \
+                                  VAR_NETWARE5 : { "acpi": True, "apic": True }, \
+                                  VAR_NETWARE6 : { "acpi": True, "apic": True } }, \
+                 TYPE_SOLARIS : { VAR_SOLARIS10 : { "acpi": True, "apic": True }, \
+                                  VAR_SOLARIS9  : { "acpi": True, "apic": True } }, \
+                 TYPE_OTHER : { VAR_MS_DOS   : { "acpi": False, "apic" : False }, \
+                                VAR_FREE_BSD : { "acpi": True, "apic" : True }, \
+                                VAR_OTHER    : { "acpi": True, "apic" : True } } }

     def __init__(self, type=None, arch=None, connection=None, hypervisorURI=None, emulator=None):
         Guest.Guest.__init__(self, type=type, connection=connection, hypervisorURI=hypervisorURI)
@@ -190,3 +220,23 @@ class FullVirtGuest(Guest.XenGuest):
             self.disks.append(Guest.VirtualDisk(cdrom, device=Guest.VirtualDisk.DEVICE_CDROM, readOnly=True, transient=True))

         return tmpfiles
+
+    def continue_install(self, consolecb, meter):
+        install_xml = self.get_config_xml(disk_boot = True)
+        logging.debug("Starting guest from '%s'" % ( install_xml ))
+        meter.start(size=None, text="Starting domain...")
+        self.domain = self.conn.createLinux(install_xml, 0)
+        if self.domain is None:
+            raise RuntimeError, "Unable to start domain for guest, aborting installation!"
+        meter.end(0)
+
+        self.connect_console(consolecb)
+
+        # ensure there's time for the domain to finish destroying if the
+        # install has finished or the guest crashed
+        if consolecb:
+            time.sleep(1)
+
+        # This should always work, because it'll lookup a config file
+        # for inactive guest, or get the still running install..
+        return self.conn.lookupByName(self.name)




More information about the et-mgmt-tools mailing list