From 1357ee7efd192e59687c54e27a8e5278c3e76796 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Sat, 23 Feb 2008 15:26:26 -0500 Subject: [PATCH] Allow choice between local CDROM & kernel/initrd network install for fullvirt guests --- src/virtManager/create.py | 137 +++++---- src/vmm-create.glade | 613 ++++++++++++++++++++++++-------------- 2 files changed, 483 insertions(+), 267 deletions(-) diff --git a/src/virtManager/create.py b/src/virtManager/create.py index 296829f22..bc6a3c22e 100644 --- a/src/virtManager/create.py +++ b/src/virtManager/create.py @@ -49,17 +49,22 @@ VM_INSTALL_FROM_CD = 2 VM_STORAGE_PARTITION = 1 VM_STORAGE_FILE = 2 +VM_INST_LOCAL = 1 +VM_INST_TREE = 2 +VM_INST_PXE = 3 + DEFAULT_STORAGE_FILE_SIZE = 500 PAGE_INTRO = 0 PAGE_NAME = 1 PAGE_TYPE = 2 -PAGE_FVINST = 3 -PAGE_PVINST = 4 -PAGE_DISK = 5 -PAGE_NETWORK = 6 -PAGE_CPUMEM = 7 -PAGE_SUMMARY = 8 +PAGE_INST = 3 +PAGE_INST_LOCAL = 4 +PAGE_INST_TREE = 5 +PAGE_DISK = 6 +PAGE_NETWORK = 7 +PAGE_CPUMEM = 8 +PAGE_SUMMARY = 9 KEYBOARD_DIR = "/etc/sysconfig/keyboard" @@ -295,11 +300,18 @@ class vmmCreate(gobject.GObject): if(self.validate(notebook.get_current_page()) != True): return - if (notebook.get_current_page() == PAGE_TYPE and self.get_config_method() == VM_PARA_VIRT): - notebook.set_current_page(PAGE_PVINST) - elif (notebook.get_current_page() == PAGE_FVINST and self.get_config_method() == VM_FULLY_VIRT): + if notebook.get_current_page() == PAGE_INST: + if self.get_config_install_method() == VM_INST_LOCAL: + notebook.set_current_page(PAGE_INST_LOCAL) + elif self.get_config_install_method() == VM_INST_TREE: + notebook.set_current_page(PAGE_INST_TREE) + else: + # No config for PXE needed (yet) + notebook.set_current_page(PAGE_DISK) + elif notebook.get_current_page() in [PAGE_INST_TREE, PAGE_INST_LOCAL]: notebook.set_current_page(PAGE_DISK) elif (notebook.get_current_page() == PAGE_DISK and os.getuid() != 0): + # Skip network for non-root notebook.set_current_page(PAGE_CPUMEM) else: notebook.next_page() @@ -309,11 +321,18 @@ class vmmCreate(gobject.GObject): # do this always, since there's no "leaving a notebook page" event. self.window.get_widget("create-finish").hide() self.window.get_widget("create-forward").show() - if notebook.get_current_page() == PAGE_PVINST and self.get_config_method() == VM_PARA_VIRT: - notebook.set_current_page(PAGE_TYPE) - elif notebook.get_current_page() == PAGE_DISK and self.get_config_method() == VM_FULLY_VIRT: - notebook.set_current_page(PAGE_FVINST) + if notebook.get_current_page() in [PAGE_INST_TREE, PAGE_INST_LOCAL]: + notebook.set_current_page(PAGE_INST) + elif notebook.get_current_page() == PAGE_DISK: + if self.get_config_install_method() == VM_INST_LOCAL: + notebook.set_current_page(PAGE_INST_LOCAL) + elif self.get_config_install_method() == VM_INST_TREE: + notebook.set_current_page(PAGE_INST_TREE) + else: + # No config for PXE needed (yet) + notebook.set_current_page(PAGE_INST) elif notebook.get_current_page() == PAGE_CPUMEM and os.getuid() != 0: + # Skip network for non-root notebook.set_current_page(PAGE_DISK) else: notebook.prev_page() @@ -330,31 +349,31 @@ class vmmCreate(gobject.GObject): return VM_PARA_VIRT def get_config_install_source(self): - if self.get_config_method() == VM_PARA_VIRT: + if self.get_config_install_method() == VM_INST_TREE: widget = self.window.get_widget("pv-media-url") url= widget.child.get_text() # Add the URL to the list, if it's different self.config.add_media_url(url) self.populate_url_model(widget.get_model(), self.config.get_media_urls()) return url - else: + elif self.get_config_install_method() == VM_INST_LOCAL: if self.window.get_widget("media-iso-image").get_active(): return self.window.get_widget("fv-iso-location").get_text() - elif self.window.get_widget("media-physical").get_active(): + else: cd = self.window.get_widget("cd-path") model = cd.get_model() return model.get_value(cd.get_active_iter(), 0) - else: - return "PXE" + else: + return "PXE" def get_config_installer(self, type): - if self.get_config_method() == VM_FULLY_VIRT and self.window.get_widget("media-network").get_active(): + if self.get_config_install_method() == VM_INST_PXE: return virtinst.PXEInstaller(type = type) else: return virtinst.DistroInstaller(type = type) def get_config_kickstart_source(self): - if self.get_config_method() == VM_PARA_VIRT: + if self.get_config_install_method() == VM_INST_TREE: widget = self.window.get_widget("pv-ks-url") url = widget.child.get_text() self.config.add_kickstart_url(url) @@ -406,6 +425,14 @@ class vmmCreate(gobject.GObject): def get_config_virtual_cpus(self): return self.window.get_widget("create-vcpus").get_value() + def get_config_install_method(self): + if self.window.get_widget("method-local").get_active(): + return VM_INST_LOCAL + elif self.window.get_widget("method-tree").get_active(): + return VM_INST_TREE + else: + return VM_INST_PXE + def get_config_os_type(self): type = self.window.get_widget("os-type") if type.get_active_iter() != None: @@ -438,9 +465,19 @@ class vmmCreate(gobject.GObject): name_widget.grab_focus() elif page_number == PAGE_TYPE: pass - elif page_number == PAGE_FVINST: - pass - elif page_number == PAGE_PVINST: + elif page_number == PAGE_INST: + if self.get_config_method() == VM_PARA_VIRT: + # Xen can't PXE or CDROM install :-( + self.window.get_widget("method-local").set_sensitive(False) + self.window.get_widget("method-pxe").set_sensitive(False) + self.window.get_widget("method-tree").set_active(True) + else: + self.window.get_widget("method-local").set_sensitive(True) + self.window.get_widget("method-pxe").set_sensitive(True) + elif page_number == PAGE_INST_TREE: + url_widget = self.window.get_widget("pv-media-url") + url_widget.grab_focus() + elif page_number == PAGE_INST_LOCAL: url_widget = self.window.get_widget("pv-media-url") url_widget.grab_focus() elif page_number == PAGE_DISK: @@ -794,28 +831,7 @@ class vmmCreate(gobject.GObject): self._guest.name = name # Transfer name over - elif page_num == PAGE_FVINST: - self._guest.installer = self.get_config_installer(self.get_domain_type()) - - if self.window.get_widget("media-iso-image").get_active(): - - src = self.get_config_install_source() - try: - self._guest.cdrom = src - except ValueError, e: - self._validation_error_box(_("ISO Path Not Found"), str(e)) - return False - elif self.window.get_widget("media-physical").get_active(): - cdlist = self.window.get_widget("cd-path") - src = self.get_config_install_source() - try: - self._guest.cdrom = src - except ValueError, e: - self._validation_error_box(_("CD-ROM Path Error"), str(e)) - return False - else: - pass # No checks for PXE - + elif page_num == PAGE_INST: try: if self.get_config_os_type() is not None \ and self.get_config_os_type() != "generic": @@ -832,7 +848,26 @@ class vmmCreate(gobject.GObject): except ValueError, e: self._validation_error_box(_("Invalid FV OS Variant"), str(e)) return False - elif page_num == PAGE_PVINST: + elif page_num == PAGE_INST_LOCAL: + self._guest.installer = self.get_config_installer(self.get_domain_type()) + + if self.window.get_widget("media-iso-image").get_active(): + + src = self.get_config_install_source() + try: + self._guest.cdrom = src + except ValueError, e: + self._validation_error_box(_("ISO Path Not Found"), str(e)) + return False + else: + cdlist = self.window.get_widget("cd-path") + src = self.get_config_install_source() + try: + self._guest.cdrom = src + except ValueError, e: + self._validation_error_box(_("CD-ROM Path Error"), str(e)) + return False + elif page_num == PAGE_INST_TREE: src = self.get_config_install_source() try: @@ -1157,10 +1192,12 @@ class vmmCreate(gobject.GObject): self.emit("action-show-help", "virt-manager-system-name") elif page == PAGE_TYPE: self.emit("action-show-help", "virt-manager-virt-method") - elif page == PAGE_FVINST: - self.emit("action-show-help", "virt-manager-installation-media-full-virt") - elif page == PAGE_PVINST: - self.emit("action-show-help", "virt-manager-installation-media-paravirt") + elif page == PAGE_INST: + self.emit("action-show-help", "virt-manager-installation-media") + elif page == PAGE_INST_LOCAL: + self.emit("action-show-help", "virt-manager-installation-media-local") + elif page == PAGE_INST_TREE: + self.emit("action-show-help", "virt-manager-installation-media-tree") elif page == PAGE_DISK: self.emit("action-show-help", "virt-manager-storage-space") elif page == PAGE_NETWORK: diff --git a/src/vmm-create.glade b/src/vmm-create.glade index 030d22e96..974544606 100644 --- a/src/vmm-create.glade +++ b/src/vmm-create.glade @@ -1271,6 +1271,391 @@ mipsel + + + 1 + True + False + 0 + + + + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 0 + 0 + + + + True + True + False + + + + True + <span weight="heavy" size="xx-large" foreground="#FFF">Choosing installation method</span> + False + True + GTK_JUSTIFY_FILL + False + False + 0 + 0 + 5 + 6 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + + + + + 0 + False + True + + + + + + True + False + 0 + + + + True + Please indicate where installation media is available for the operating system you would like to install on this virtual system: + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 20 + 10 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + 6 + True + 0.5 + 0.5 + 1 + 1 + 0 + 0 + 30 + 0 + + + + True + False + 6 + + + + True + True + _Local install media (ISO image or CDROM) + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 0 + False + False + + + + + + True + True + Network install t_ree (HTTP, FTP, or NFS) + True + GTK_RELIEF_NORMAL + True + False + False + True + method-local + + + + 0 + False + False + + + + + + True + True + _Network boot (PXE) + True + GTK_RELIEF_NORMAL + True + False + False + True + method-local + + + + 0 + False + False + + + + + + + 0 + False + True + + + + + + True + 0.5 + 0.5 + 1 + 1 + 15 + 15 + 15 + 5 + + + + True + 3 + 3 + False + 10 + 0 + + + + True + Please choose the type of guest operating system you will be installing: + False + True + GTK_JUSTIFY_LEFT + True + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 2 + 0 + 1 + + + + + + + True + OS _Variant: + True + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + os-variant + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + + + + + + + + True + False + True + + + + 1 + 2 + 1 + 2 + + + + + + + True + False + True + + + + 1 + 2 + 2 + 3 + + + + + + + True + OS _Type: + True + False + GTK_JUSTIFY_LEFT + False + False + 1 + 1 + 0 + 0 + os-type + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 2 + 3 + 0 + 1 + + + + + + + + 0 + True + True + + + + + 0 + True + True + + + + + False + True + + + + + + True + Install type + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + 1 @@ -1291,7 +1676,7 @@ mipsel 0 - + True True False @@ -1334,7 +1719,7 @@ mipsel True - Please indicate where installation media is available for the operating system you would like to install on this <b>fully virtualized</b> virtual system: + Please indicate where installation media is available for the operating system you would like to install on this virtual operating system: False True GTK_JUSTIFY_LEFT @@ -1646,30 +2031,6 @@ mipsel fill - - - - True - True - _Network PXE boot - True - GTK_RELIEF_NORMAL - True - False - False - True - media-iso-image - - - - 0 - 3 - 5 - 6 - fill - - - @@ -1679,186 +2040,6 @@ mipsel True - - - - True - 0.5 - 0.5 - 1 - 1 - 15 - 15 - 15 - 5 - - - - True - 3 - 3 - False - 10 - 0 - - - - True - Please choose the type of guest operating system you will be installing: - False - True - GTK_JUSTIFY_LEFT - True - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 2 - 0 - 1 - - - - - - - True - OS _Variant: - True - False - GTK_JUSTIFY_LEFT - False - False - 1 - 0.5 - 0 - 0 - os-variant - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 2 - 3 - - - - - - - - True - False - True - - OS Type Select - - - - - 1 - 2 - 1 - 2 - - - - - - - True - False - True - - OS Variant Select - - - - - 1 - 2 - 2 - 3 - - - - - - - True - OS _Type: - True - False - GTK_JUSTIFY_LEFT - False - False - 1 - 1 - 0 - 0 - os-type - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 2 - 3 - 0 - 1 - - - - - - - - 0 - True - True - - 0 @@ -1876,7 +2057,7 @@ mipsel True - FV install + Local inst False False GTK_JUSTIFY_LEFT @@ -1916,7 +2097,7 @@ mipsel 0 - + True True False @@ -1924,7 +2105,7 @@ mipsel True - <span weight="heavy" size="xx-large" foreground="#FFF">Locating installation media</span> + <span weight="heavy" size="xx-large" foreground="#FFF">Locating installation source</span> False True GTK_JUSTIFY_FILL @@ -1959,7 +2140,7 @@ mipsel True - Please indicate where installation media is available for the operating system you would like to install on this <b>paravirtualized</b> virtual system. Optionally you can provide the URL for a kickstart file that describes your system: + Please indicate where installation media is available for the operating system you would like to install on this virtual operating system. Optionally you can provide the URL for a kickstart file that describes your system: False True GTK_JUSTIFY_LEFT @@ -2429,7 +2610,7 @@ mipsel True - PVinstall + Netinst False False GTK_JUSTIFY_LEFT @@ -2457,7 +2638,7 @@ mipsel 0 - + True True False @@ -3209,7 +3390,7 @@ mipsel 0 - + True True False @@ -3550,7 +3731,6 @@ mipsel 0.5 4 0 - storage-partition-address PANGO_ELLIPSIZE_NONE -1 False @@ -3601,7 +3781,6 @@ mipsel 0.5 4 0 - storage-file-address PANGO_ELLIPSIZE_NONE -1 False @@ -3762,7 +3941,7 @@ mipsel 0 - + True True False @@ -4435,7 +4614,7 @@ mipsel 0 - + True True False