From 2b5e892d60831e1071ac7fa5be89b3f667dd29d3 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Thu, 26 May 2011 12:38:48 -0400 Subject: [PATCH] details: Allow viewing and editting container --- src/virtManager/details.py | 44 +++- src/virtManager/domain.py | 18 +- src/vmm-details.glade | 471 ++++++++++++++++++++++--------------- 3 files changed, 324 insertions(+), 209 deletions(-) diff --git a/src/virtManager/details.py b/src/virtManager/details.py index 695a61436..39a78c30a 100644 --- a/src/virtManager/details.py +++ b/src/virtManager/details.py @@ -339,6 +339,7 @@ class vmmDetails(vmmGObjectUI): "on_boot_kernel_args_changed": self.config_enable_apply, "on_boot_kernel_browse_clicked": self.browse_kernel, "on_boot_kernel_initrd_browse_clicked": self.browse_initrd, + "on_boot_init_path_changed": self.config_enable_apply, "on_disk_readonly_changed": self.config_enable_apply, "on_disk_shareable_changed": self.config_enable_apply, @@ -1794,13 +1795,22 @@ class vmmDetails(vmmGObjectUI): kernel = self.window.get_widget("boot-kernel").get_text() initrd = self.window.get_widget("boot-kernel-initrd").get_text() args = self.window.get_widget("boot-kernel-args").get_text() + init = self.window.get_widget("boot-init-path").get_text() - return self._change_config_helper([self.vm.set_boot_device, - self.vm.set_boot_menu, - self.vm.set_boot_kernel], - [(bootdevs,), - (bootmenu,), - (kernel, initrd, args)]) + funcs = [self.vm.set_boot_device, + self.vm.set_boot_menu, + self.vm.set_boot_kernel] + opts = [(bootdevs,), + (bootmenu,), + (kernel, initrd, args)] + + if self.window.get_widget("boot-init-path").get_property("visible"): + if not init: + return self.err.val_err(_("An init path must be specified")) + funcs.append(self.vm.set_boot_init) + opts.append((init,)) + + return self._change_config_helper(funcs, opts) # CDROM def change_storage_media(self, dev_id_info, newpath): @@ -2678,14 +2688,24 @@ class vmmDetails(vmmGObjectUI): except libvirt.libvirtError: autoval = None + # Autostart autostart_chk = self.window.get_widget("config-autostart") enable_autostart = (autoval is not None) autostart_chk.set_sensitive(enable_autostart) autostart_chk.set_active(enable_autostart and autoval or False) - menu = self.vm.get_boot_menu() or False - self.window.get_widget("boot-menu").set_active(menu) + show_kernel = not self.vm.is_container() + show_init = self.vm.is_container() + show_boot = (not self.vm.is_container() and not self.vm.is_xenpv()) + self.window.get_widget("boot-order-align").set_property("visible", + show_boot) + self.window.get_widget("boot-kernel-align").set_property("visible", + show_kernel) + self.window.get_widget("boot-init-align").set_property("visible", + show_init) + + # Kernel/initrd boot kernel, initrd, args = self.vm.get_boot_kernel_info() expand = bool(kernel or initrd or args) self.window.get_widget("boot-kernel").set_text(kernel or "") @@ -2694,7 +2714,13 @@ class vmmDetails(vmmGObjectUI): if expand: self.window.get_widget("boot-kernel-expander").set_expanded(True) - # Refresh Boot Device list + # populate + init = self.vm.get_init() + self.window.get_widget("boot-init-path").set_text(init or "") + + # Boot menu populate + menu = self.vm.get_boot_menu() or False + self.window.get_widget("boot-menu").set_active(menu) self.repopulate_boot_list() diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py index 1092502a0..674ebcd6c 100644 --- a/src/virtManager/domain.py +++ b/src/virtManager/domain.py @@ -256,11 +256,6 @@ class vmmDomain(vmmLibvirtObject): self._is_management_domain = (self.get_id() == 0) return self._is_management_domain - def is_hvm(self): - if self.get_abi_type() == "hvm": - return True - return False - def get_id_pretty(self): i = self.get_id() if i < 0: @@ -509,6 +504,10 @@ class vmmDomain(vmmLibvirtObject): guest.installer.bootconfig.initrd = initrd or None guest.installer.bootconfig.kernel_args = args or None return self._redefine_guest(change) + def set_boot_init(self, init): + def change(guest): + guest.installer.init = init + return self._redefine_guest(change) # Disk define methods @@ -739,6 +738,13 @@ class vmmDomain(vmmLibvirtObject): # XML Parsing routines # ######################## + def is_container(self): + return self._get_guest().installer.is_container() + def is_xenpv(self): + return self._get_guest().installer.is_xenpv() + def is_hvm(self): + return self._get_guest().installer.is_hvm() + def get_uuid(self): return self.uuid def get_abi_type(self): @@ -749,6 +755,8 @@ class vmmDomain(vmmLibvirtObject): return util.pretty_hv(self.get_abi_type(), self.get_hv_type()) def get_arch(self): return self._get_guest().installer.arch + def get_init(self): + return self._get_guest().installer.init def get_emulator(self): return self._get_guest().emulator def get_acpi(self): diff --git a/src/vmm-details.glade b/src/vmm-details.glade index 9b4b4eb5b..325f3a064 100644 --- a/src/vmm-details.glade +++ b/src/vmm-details.glade @@ -985,7 +985,6 @@ True True - @@ -2698,7 +2697,6 @@ I/O: True - 24 True @@ -2740,46 +2738,50 @@ I/O: - + True - 0 - none + 24 - + True - 3 - 12 + 0 + none - + True - 6 + 3 + 12 - - Enable boot me_nu - True - True - False - True - True - - - - 0 - - - - + True 6 - + + Enable boot me_nu True - 3 - 2 - 6 - 6 + True + False + True + True + + + + 0 + + + + + True + 6 - + + True + 3 + 2 + 6 + 6 + + 20 True True @@ -2793,13 +2795,13 @@ I/O: False - - + + 3 - - - - + + + + True True True @@ -2810,16 +2812,16 @@ I/O: gtk-go-up - - + + 1 2 GTK_FILL GTK_FILL - - - - + + + + True True True @@ -2830,66 +2832,68 @@ I/O: gtk-go-down - - + + 1 2 1 2 GTK_FILL GTK_FILL + + + + + True + + + + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + 0 - + True - 1 - 2 - 2 - 3 - GTK_FILL + 1 - - 0 - - - - - True - - - - 1 - - 1 - + + + True + <b>Boot device order</b> + True + + + label_item + + - - - True - <b>Boot device order</b> - True - - - label_item - - False @@ -2897,158 +2901,235 @@ I/O: - + True - True + 24 - + True - 3 - 12 + True - + True - 3 - 3 - 6 - 3 + 3 + 12 - + True - 0 - Kernel path: - - - GTK_FILL - GTK_FILL - - - - - True - 0 - Initrd path: - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - - - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - - - - - 1 - 2 - GTK_FILL - - - - - Browse - True - True - True - - - - 2 - 3 - GTK_FILL - GTK_FILL - - - - - Browse - True - True - True - - - - 2 - 3 - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - 6 + 3 + 3 + 6 + 3 - + True - 1 - Kernel arguments: + 0 + Kernel path: - False - 0 + GTK_FILL + GTK_FILL - + + True + 0 + Initrd path: + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + True True - + - 1 + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + + + + + 1 + 2 + GTK_FILL + + + + + Browse + True + True + True + + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + Browse + True + True + True + + + + 2 + 3 + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + 6 + + + True + 1 + Kernel arguments: + + + False + 0 + + + + + True + True + + + + + 1 + + + + + 3 + 2 + 3 + GTK_FILL - - 3 - 2 - 3 - GTK_FILL - + + + True + <b>Direct kernel boot</b> + True + + + label_item + + - - - True - <b>Direct kernel boot</b> - True - - - label_item - - + False 2 + + + True + 24 + + + True + 0 + none + + + True + 3 + 12 + + + True + 12 + 3 + + + True + 12 + + + True + Init path: + + + False + 0 + + + + + True + True + + 25 + + + + False + 1 + + + + + + + + + + + True + <b>Container init</b> + True + + + label_item + + + + + + + False + 3 + + 0