[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [RFC 2 of2] adding 802.1Qbg VSI type support to virtinst and virtmanager



On Wed, 2011-03-09 at 14:52 -0500, Cole Robinson wrote:

> 
> Some general comments:
> 
> Does specifying virtualport settings only apply for an interface of
> type='direct'? If so, it would be nice to hide the 'Virtual Port' expander for
> all other interface types, since I'm guessing 99% of users will never need
> this functionality.

done, showing only for direct interfaces.

> Please make the expander look more like the 'Advanced Options' expander for
> disk settings. Particularly remove text bolding, indent the entire expander
> from the left, increase spacing between the expander and the above info, and
> make sure the table has similar spacing between rows and columns.

mostly done, since only few people will see it I tried to minimize
layouting (I am no GTK expert either, unfortunately).

> Does every field need to be shown to the user _and_ editable? For example,
> does 'type' need to be editable? How important is the instance id/uuid and
> will the user ever have a reason to specify one by hand?

At the moment, the user/system admin can use "virsh edit" to add or
modify the VSI parameters he is given by his network admin.
With this patch the user can edit the values directly in virt-manager
and does not have to switch between "virsh edit" and virt-manager.

> In fact it might be useful if you could provide a few use cases for this
> functionality in general, and what all the XML properties mean, since I'm
> pretty ignorant here. (in fact, none of this XML seems documented in the
> libvirt docs which I would highly recommend remedying :)

done, documentation sent to libvir-list

> Thanks,
> Cole
> 

-- 
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
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>

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_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_password_changed": self.config_enable_apply,
 
@@ -1713,8 +1719,19 @@ 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()
+        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
     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-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,
                             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,15 @@ class vmmDomainBase(vmmLibvirtObject):
             editdev.model = newmodel
         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 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
@@ -3619,6 +3619,7 @@ I/O:</property>
                             <child>
                               <widget class="GtkVBox" id="vbox54">
                                 <property name="visible">True</property>
+                                <property name="spacing">12</property>
                                 <child>
                                   <widget class="GtkFrame" id="frame9">
                                     <property name="visible">True</property>
@@ -3761,6 +3762,176 @@ I/O:</property>
                                     <property name="position">0</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <widget class="GtkExpander" id="virtualport-expander">
+                                    <property name="visible">False</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="virtualport-instanceid">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="invisible_char">&#x25CF;</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">&#x25CF;</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">&#x25CF;</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">&#x25CF;</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">&#x25CF;</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">Virtual port</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>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]