[virt-tools-list] [RFC 2 of2] adding 802.1Qbg VSI type support to virtinst and virtmanager
Gerhard Stenzel
gstenzel at linux.vnet.ibm.com
Tue Mar 1 13:21:45 UTC 2011
This is RFC and comments are appreciated ....
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 at de.ibm.com>
Index: virt-manager/src/virtManager/details.py
===================================================================
--- virt-manager.orig/src/virtManager/details.py
+++ virt-manager/src/virtManager/details.py
@@ -375,6 +375,12 @@ class vmmDetails(vmmGObjectUI):
"on_network_model_combo_changed": self.config_enable_apply,
+ "on_virtualport-type_changed": self.config_enable_apply,
+ "on_vsi-managerid_changed": self.config_enable_apply,
+ "on_vsi-typeid_changed": self.config_enable_apply,
+ "on_vsi-typeidversion_changed": self.config_enable_apply,
+ "on_vsi-instanceid_changed": self.config_enable_apply,
+
"on_vnc_keymap_combo_changed": self.config_enable_apply,
"on_vnc_password_changed": self.config_enable_apply,
@@ -1713,9 +1719,23 @@ class vmmDetails(vmmGObjectUI):
# Network options
def config_network_apply(self, dev_id_info):
model = self.get_combo_label_value("network-model")
- return self._change_config_helper(self.vm.define_network_model,
- (dev_id_info, model))
-
+ virtualport_type =
self.window.get_widget("virtualport-type").get_text()
+ vsi_managerid =
self.window.get_widget("vsi-managerid").get_text()
+ vsi_typeid = self.window.get_widget("vsi-typeid").get_text()
+ vsi_typeidversion =
self.window.get_widget("vsi-typeidversion").get_text()
+ vsi_instanceid =
self.window.get_widget("vsi-instanceid").get_text()
+ return
self._change_config_helper([self.vm.define_network_model,
+
self.vm.define_virtualport_type,
+ self.vm.define_vsi_managerid,
+ self.vm.define_vsi_typeid,
+
self.vm.define_vsi_typeidversion,
+
self.vm.define_vsi_instanceid],
+ [(dev_id_info, model),
+ (dev_id_info,
virtualport_type),
+ (dev_id_info, vsi_managerid),
+ (dev_id_info, vsi_typeid),
+ (dev_id_info,
vsi_typeidversion),
+ (dev_id_info,
vsi_instanceid)])
# Graphics options
def config_graphics_apply(self, dev_id_info):
passwd = self.window.get_widget("gfx-password").get_text() or
None
@@ -2177,6 +2197,21 @@ class vmmDetails(vmmGObjectUI):
self.window.get_widget("network-mac-address").set_text(net.macaddr)
self.window.get_widget("network-source-device").set_text(desc)
+ if net.virtualport_type:
+
self.window.get_widget("virtualport-type").set_text(net.virtualport_type)
+
self.window.get_widget("vsi-managerid").set_text(net.vsi_managerid)
+
self.window.get_widget("vsi-typeid").set_text(net.vsi_typeid)
+
self.window.get_widget("vsi-typeidversion").set_text(net.vsi_typeidversion)
+
self.window.get_widget("vsi-instanceid").set_text(net.vsi_instanceid)
+
self.window.get_widget("virtualport-expander").set_expanded(True)
+ else:
+ self.window.get_widget("virtualport-type").set_text("")
+ self.window.get_widget("vsi-managerid").set_text("")
+ self.window.get_widget("vsi-typeid").set_text("")
+ self.window.get_widget("vsi-typeidversion").set_text("")
+ self.window.get_widget("vsi-instanceid").set_text("")
+
self.window.get_widget("virtualport-expander").set_expanded(False)
+
uihelpers.populate_netmodel_combo(self.vm,
self.window.get_widget("network-model-combo"))
self.set_combo_label("network-model", 0, model)
Index: virt-manager/src/virtManager/domain.py
===================================================================
--- virt-manager.orig/src/virtManager/domain.py
+++ virt-manager/src/virtManager/domain.py
@@ -404,6 +404,31 @@ class vmmDomainBase(vmmLibvirtObject):
editdev.model = newmodel
return self._redefine_device(change, devobj)
+ def define_virtualport_type(self, devobj, newtype):
+ def change(editdev):
+ editdev.virtualport_type = newtype or None
+ return self._redefine_device(change, devobj)
+
+ def define_vsi_managerid(self, devobj, newmanagerid):
+ def change(editdev):
+ editdev.vsi_managerid = newmanagerid or None
+ return self._redefine_device(change, devobj)
+
+ def define_vsi_typeid(self, devobj, newtypeid):
+ def change(editdev):
+ editdev.vsi_typeid = newtypeid or None
+ return self._redefine_device(change, devobj)
+
+ def define_vsi_typeidversion(self, devobj, newtypeidversion):
+ def change(editdev):
+ editdev.vsi_typeidversion = newtypeidversion or None
+ return self._redefine_device(change, devobj)
+
+ def define_vsi_instanceid(self, devobj, newinstanceid):
+ def change(editdev):
+ editdev.vsi_instanceid = newinstanceid or None
+ return self._redefine_device(change, devobj)
+
def define_graphics_password(self, devobj, newval):
def change(editdev):
editdev.passwd = newval or None
Index: virt-manager/src/vmm-details.glade
===================================================================
--- virt-manager.orig/src/vmm-details.glade
+++ virt-manager/src/vmm-details.glade
@@ -3761,6 +3761,176 @@ I/O:</property>
<property
name="position">0</property>
</packing>
</child>
+ <child>
+ <widget class="GtkExpander"
id="virtualport-expander">
+ <property
name="visible">True</property>
+ <property
name="can_focus">True</property>
+ <child>
+ <widget class="GtkTable"
id="table10">
+ <property
name="visible">True</property>
+ <property
name="n_rows">5</property>
+ <property
name="n_columns">2</property>
+ <child>
+ <widget class="GtkEntry"
id="vsi-instanceid">
+ <property
name="visible">True</property>
+ <property
name="can_focus">True</property>
+ <property
name="invisible_char">●</property>
+ <signal name="changed"
handler="on_vsi-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="vsi-instanceid-label">
+ <property
name="visible">True</property>
+ <property
name="xalign">1</property>
+ <property name="label"
translatable="yes">VSI 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="vsi-typeidversion">
+ <property
name="visible">True</property>
+ <property
name="can_focus">True</property>
+ <property
name="invisible_char">●</property>
+ <signal name="changed"
handler="on_vsi-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="vsi-typeidversion-label">
+ <property
name="visible">True</property>
+ <property
name="xalign">1</property>
+ <property name="label"
translatable="yes">VSI 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="vsi-typeid">
+ <property
name="visible">True</property>
+ <property
name="can_focus">True</property>
+ <property
name="invisible_char">●</property>
+ <signal name="changed"
handler="on_vsi-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="vsi-typeid-label">
+ <property
name="visible">True</property>
+ <property
name="xalign">1</property>
+ <property name="label"
translatable="yes">VSI 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="vsi-managerid">
+ <property
name="visible">True</property>
+ <property
name="can_focus">True</property>
+ <property
name="invisible_char">●</property>
+ <signal name="changed"
handler="on_vsi-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="vsi-managerid-label">
+ <property
name="visible">True</property>
+ <property
name="xalign">1</property>
+ <property name="label"
translatable="yes">VSI 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"><b>Type:</b></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>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label5">
+ <property
name="visible">True</property>
+ <property name="label"
translatable="yes"><b>Virtual Port</b></property>
+ <property
name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property
name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property
name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">6</property>
@@ -4155,7 +4325,7 @@ I/O:</property>
<property
name="visible">True</property>
<property
name="can_focus">True</property>
<property
name="visibility">False</property>
- <property
name="invisible_char">●</property>
+ <property
name="invisible_char">●</property>
<signal name="changed"
handler="on_vnc_password_changed"/>
</widget>
<packing>
--
Best regards,
Gerhard Stenzel,
-----------------------------------------------------------------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
More information about the virt-tools-list
mailing list