details: Allow viewing and editting container <init>

This commit is contained in:
Cole Robinson 2011-05-26 12:38:48 -04:00
parent a99dee7dbd
commit 2b5e892d60
3 changed files with 324 additions and 209 deletions

View File

@ -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
# <init> 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()

View File

@ -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):

View File

@ -985,7 +985,6 @@
<widget class="GtkEntry" id="overview-name">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_overview_name_changed"/>
</widget>
<packing>
@ -2698,7 +2697,6 @@ I/O:</property>
<child>
<widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="spacing">24</property>
<child>
<widget class="GtkFrame" id="frame4">
<property name="visible">True</property>
@ -2740,46 +2738,50 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame1">
<widget class="GtkAlignment" id="boot-order-align">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<property name="top_padding">24</property>
<child>
<widget class="GtkAlignment" id="bootalign">
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="top_padding">3</property>
<property name="left_padding">12</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkVBox" id="bootvbox">
<widget class="GtkAlignment" id="bootalign">
<property name="visible">True</property>
<property name="spacing">6</property>
<property name="top_padding">3</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkCheckButton" id="boot-menu">
<property name="label" translatable="yes">Enable boot me_nu</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_boot_menu_changed"/>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="boothbox">
<widget class="GtkVBox" id="bootvbox">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<widget class="GtkTable" id="table2">
<widget class="GtkCheckButton" id="boot-menu">
<property name="label" translatable="yes">Enable boot me_nu</property>
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_boot_menu_changed"/>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="boothbox">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<widget class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow3">
<property name="width_request">20</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@ -2793,13 +2795,13 @@ I/O:</property>
<property name="headers_visible">False</property>
</widget>
</child>
</widget>
<packing>
</widget>
<packing>
<property name="bottom_attach">3</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="config-boot-moveup">
</packing>
</child>
<child>
<widget class="GtkButton" id="config-boot-moveup">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -2810,16 +2812,16 @@ I/O:</property>
<property name="stock">gtk-go-up</property>
</widget>
</child>
</widget>
<packing>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="config-boot-movedown">
</packing>
</child>
<child>
<widget class="GtkButton" id="config-boot-movedown">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -2830,66 +2832,68 @@ I/O:</property>
<property name="stock">gtk-go-down</property>
</widget>
</child>
</widget>
<packing>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment21">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment21">
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Boot device order&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Boot device order&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
@ -2897,158 +2901,235 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkExpander" id="boot-kernel-expander">
<widget class="GtkAlignment" id="boot-kernel-align">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="top_padding">24</property>
<child>
<widget class="GtkAlignment" id="alignment20">
<widget class="GtkExpander" id="boot-kernel-expander">
<property name="visible">True</property>
<property name="top_padding">3</property>
<property name="left_padding">12</property>
<property name="can_focus">True</property>
<child>
<widget class="GtkTable" id="table13">
<widget class="GtkAlignment" id="alignment20">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">6</property>
<property name="row_spacing">3</property>
<property name="top_padding">3</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkLabel" id="label38">
<widget class="GtkTable" id="table13">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Kernel path:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label39">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Initrd path:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="boot-kernel-initrd">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_boot_kernel_initrd_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="boot-kernel">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_boot_kernel_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="boot-kernel-browse">
<property name="label" translatable="yes">Browse</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_boot_kernel_browse_clicked"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="boot-kernel-initrd-browse">
<property name="label" translatable="yes">Browse</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_boot_kernel_initrd_browse_clicked"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
<property name="spacing">6</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">6</property>
<property name="row_spacing">3</property>
<child>
<widget class="GtkLabel" id="label40">
<widget class="GtkLabel" id="label38">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Kernel arguments:</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Kernel path:</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="boot-kernel-args">
<widget class="GtkLabel" id="label39">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Initrd path:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="boot-kernel-initrd">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_boot_kernel_args_changed"/>
<signal name="changed" handler="on_boot_kernel_initrd_changed"/>
</widget>
<packing>
<property name="position">1</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="boot-kernel">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_boot_kernel_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="boot-kernel-browse">
<property name="label" translatable="yes">Browse</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_boot_kernel_browse_clicked"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="boot-kernel-initrd-browse">
<property name="label" translatable="yes">Browse</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="on_boot_kernel_initrd_browse_clicked"/>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox10">
<property name="visible">True</property>
<property name="spacing">6</property>
<child>
<widget class="GtkLabel" id="label40">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Kernel arguments:</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="boot-kernel-args">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_boot_kernel_args_changed"/>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
<packing>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label37">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Direct kernel boot&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label37">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Direct kernel boot&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="boot-init-align">
<property name="visible">True</property>
<property name="top_padding">24</property>
<child>
<widget class="GtkFrame" id="boot-init-frame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment36">
<property name="visible">True</property>
<property name="top_padding">3</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkTable" id="table16">
<property name="visible">True</property>
<property name="column_spacing">12</property>
<property name="row_spacing">3</property>
<child>
<widget class="GtkHBox" id="boot-init-path-box">
<property name="visible">True</property>
<property name="spacing">12</property>
<child>
<widget class="GtkLabel" id="label69">
<property name="visible">True</property>
<property name="label" translatable="yes">Init path:</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="boot-init-path">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">25</property>
<signal name="changed" handler="on_boot_init_path_changed"/>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="labelll">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Container init&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">3</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>