details: Allow editting virtualport settings for 'direct' nic

The following patch adds support for VSI types so the respective values
can be viewed and edited via virt-manager

Signed-off-by: Gerhard Stenzel <gerhard.stenzel@de.ibm.com>
This commit is contained in:
Gerhard Stenzel 2011-03-16 12:43:28 -04:00 committed by Cole Robinson
parent 9118f8c4a9
commit ababf7acec
4 changed files with 239 additions and 2 deletions

View File

@ -68,6 +68,7 @@ Further patches have been submitted by:
Matthias Fulz <olz1983-at-googlemail-dot-com> Matthias Fulz <olz1983-at-googlemail-dot-com>
Niels de Vos <ndevos-at-redhat-dot-com> Niels de Vos <ndevos-at-redhat-dot-com>
Wen Congyang <wency-at-cn-dot-fujitsu-dot-com> Wen Congyang <wency-at-cn-dot-fujitsu-dot-com>
Gerhard Stenzel <gerhard-dot-stenzel-at-de-dot-ibm-dot-com>
<...send a patch & get your name here...> <...send a patch & get your name here...>

View File

@ -375,6 +375,12 @@ class vmmDetails(vmmGObjectUI):
"on_network_model_combo_changed": self.config_enable_apply, "on_network_model_combo_changed": self.config_enable_apply,
"on_virtualport-type_changed": self.config_enable_apply,
"on_virtualport-managerid_changed": self.config_enable_apply,
"on_virtualport-typeid_changed": self.config_enable_apply,
"on_virtualport-typeidversion_changed": self.config_enable_apply,
"on_virtualport-instanceid_changed": self.config_enable_apply,
"on_vnc_keymap_combo_changed": self.config_enable_apply, "on_vnc_keymap_combo_changed": self.config_enable_apply,
"on_vnc_password_changed": self.config_enable_apply, "on_vnc_password_changed": self.config_enable_apply,
@ -1713,8 +1719,19 @@ class vmmDetails(vmmGObjectUI):
# Network options # Network options
def config_network_apply(self, dev_id_info): def config_network_apply(self, dev_id_info):
model = self.get_combo_label_value("network-model") model = self.get_combo_label_value("network-model")
return self._change_config_helper(self.vm.define_network_model, virtualport_type = self.window.get_widget("virtualport-type").get_text()
(dev_id_info, model)) virtualport_managerid = self.window.get_widget("virtualport-managerid").get_text()
virtualport_typeid = self.window.get_widget("virtualport-typeid").get_text()
virtualport_typeidversion = self.window.get_widget("virtualport-typeidversion").get_text()
virtualport_instanceid = self.window.get_widget("virtualport-instanceid").get_text()
return self._change_config_helper([self.vm.define_network_model,
self.vm.define_virtualport],
[(dev_id_info, model),
(dev_id_info, virtualport_type,
virtualport_managerid,
virtualport_typeid,
virtualport_typeidversion,
virtualport_instanceid)])
# Graphics options # Graphics options
def config_graphics_apply(self, dev_id_info): def config_graphics_apply(self, dev_id_info):
@ -2187,6 +2204,21 @@ class vmmDetails(vmmGObjectUI):
self.window.get_widget("network-mac-address").set_text(net.macaddr) self.window.get_widget("network-mac-address").set_text(net.macaddr)
self.window.get_widget("network-source-device").set_text(desc) self.window.get_widget("network-source-device").set_text(desc)
if nettype == "direct":
self.window.get_widget("virtualport-type").set_text(net.virtualport.type)
self.window.get_widget("virtualport-managerid").set_text(net.virtualport.managerid)
self.window.get_widget("virtualport-typeid").set_text(net.virtualport.typeid)
self.window.get_widget("virtualport-typeidversion").set_text(net.virtualport.typeidversion)
self.window.get_widget("virtualport-instanceid").set_text(net.virtualport.instanceid)
self.window.get_widget("virtualport-expander").set_property("visible", True)
else:
self.window.get_widget("virtualport-type").set_text("")
self.window.get_widget("virtualport-managerid").set_text("")
self.window.get_widget("virtualport-typeid").set_text("")
self.window.get_widget("virtualport-typeidversion").set_text("")
self.window.get_widget("virtualport-instanceid").set_text("")
self.window.get_widget("virtualport-expander").hide()
uihelpers.populate_netmodel_combo(self.vm, uihelpers.populate_netmodel_combo(self.vm,
self.window.get_widget("network-model-combo")) self.window.get_widget("network-model-combo"))
self.set_combo_label("network-model", 0, model) self.set_combo_label("network-model", 0, model)

View File

@ -404,6 +404,15 @@ class vmmDomainBase(vmmLibvirtObject):
editdev.model = newmodel editdev.model = newmodel
return self._redefine_device(change, devobj) return self._redefine_device(change, devobj)
def define_virtualport(self, devobj, newtype, newmanagerid, newtypeid, newtypeidversion, newinstanceid):
def change(editdev):
editdev.virtualport.type = newtype or None
editdev.virtualport.managerid = newmanagerid or None
editdev.virtualport.typeid = newtypeid or None
editdev.virtualport.typeidversion = newtypeidversion or None
editdev.virtualport.instanceid = newinstanceid or None
return self._redefine_device(change, devobj)
def define_graphics_password(self, devobj, newval): def define_graphics_password(self, devobj, newval):
def change(editdev): def change(editdev):
editdev.passwd = newval or None editdev.passwd = newval or None

View File

@ -3619,6 +3619,7 @@ I/O:</property>
<child> <child>
<widget class="GtkVBox" id="vbox54"> <widget class="GtkVBox" id="vbox54">
<property name="visible">True</property> <property name="visible">True</property>
<property name="spacing">12</property>
<child> <child>
<widget class="GtkFrame" id="frame9"> <widget class="GtkFrame" id="frame9">
<property name="visible">True</property> <property name="visible">True</property>
@ -3761,6 +3762,200 @@ I/O:</property>
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkExpander" id="virtualport-expander">
<property name="can_focus">True</property>
<child>
<widget class="GtkHBox" id="hbox1124">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<widget class="GtkTable" id="table10">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">3</property>
<child>
<widget class="GtkEntry" id="virtualport-instanceid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">40</property>
<signal name="changed" handler="on_virtualport-instanceid_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="virtualport-instanceid-label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Instance id:</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="virtualport-typeidversion">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_virtualport-typeidversion_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="virtualport-typeidversion-label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Typeid version:</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="virtualport-typeid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_virtualport-typeid_changed"/>
</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="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="virtualport-typeid-label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Typeid:</property>
<property name="use_underline">True</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="virtualport-managerid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_virtualport-managerid_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"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="virtualport-managerid-label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Managerid:</property>
<property name="use_underline">True</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"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label33">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="yalign">0.47999998927116394</property>
<property name="label" translatable="yes">Type:</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">network-model-combo</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="virtualport-type">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_virtualport-type_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment29">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label5">
<property name="visible">True</property>
<property name="label" translatable="yes">Virtual port</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">1</property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="position">6</property> <property name="position">6</property>