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

Re: [virt-tools-list] [PATCHv2] virt-manager:Add spapr-vlan model for pseries guest



On 03/06/2012 01:52 AM, Cole Robinson wrote:
On 03/05/2012 03:10 AM, Li Zhang wrote:
For pseries machine type, network device is
based on spapr-vio bus. And the network device
type is called spapr-vlan. So add spapr-vlan
model for pseries guest.


set_address(None) doesn't produce any weird effects, right? Since that's what
most models will trigger.

If no problems, ACK to this. But I'll wait for your virtinst patch to land
before committing.

Right, I think it won't produce any weird effects.

Here is the definition of the function,

   def set_address(self, addrstr):
        self.address = VirtualDeviceAddress(self.conn, addrstr=addrstr)

It just assigns this addrstr to address type. This addrstr can be None.

Thanks.
Li


- Cole

Signed-off-by: Li Zhang<zhlcindy linux vnet ibm com>
---
  src/virtManager/details.py   |    5 ++++-
  src/virtManager/domain.py    |    3 ++-
  src/virtManager/uihelpers.py |    9 +++++++++
  3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/virtManager/details.py b/src/virtManager/details.py
index 88a5cb5..5395087 100644
--- a/src/virtManager/details.py
+++ b/src/virtManager/details.py
@@ -2252,7 +2252,10 @@ class vmmDetails(vmmGObjectUI):

          if self.editted(EDIT_NET_MODEL):
              model = self.get_combo_label_value("network-model")
-            add_define(self.vm.define_network_model, dev_id_info, model)
+            addr = None
+            if model == "spapr-vlan":
+                addr = "spapr-vio"
+            add_define(self.vm.define_network_model, dev_id_info, model, addr)

          if self.editted(EDIT_NET_SOURCE):
              mode = None
diff --git a/src/virtManager/domain.py b/src/virtManager/domain.py
index 5c332f4..8ffd305 100644
--- a/src/virtManager/domain.py
+++ b/src/virtManager/domain.py
@@ -622,10 +622,11 @@ class vmmDomain(vmmLibvirtObject):
              editdev.source = newsource
              editdev.source_mode = newmode or None
          return self._redefine_device(change, devobj)
-    def define_network_model(self, devobj, newmodel):
+    def define_network_model(self, devobj, newmodel, addr):
          def change(editdev):
              if editdev.model != newmodel:
                  editdev.address.clear()
+                editdev.set_address(addr)
              editdev.model = newmodel
          return self._redefine_device(change, devobj)

diff --git a/src/virtManager/uihelpers.py b/src/virtManager/uihelpers.py
index 3b0cd15..6b80577 100644
--- a/src/virtManager/uihelpers.py
+++ b/src/virtManager/uihelpers.py
@@ -310,6 +310,9 @@ def populate_netmodel_combo(vm, combo):
          mod_list = ["rtl8139", "ne2k_pci", "pcnet", "e1000"]
          if vm.get_hv_type() in ["kvm", "qemu", "test"]:
              mod_list.append("virtio")
+        if (vm.get_hv_type() == "kvm" and
+              vm.get_machtype() == "pseries"):
+            mod_list.append("spapr-vlan")
          if vm.get_hv_type() in ["xen", "test"]:
              mod_list.append("netfront")
          mod_list.sort()
@@ -630,6 +633,7 @@ def validate_network(parent, conn, nettype, devname, macaddr, model=None):
      set_error_parent(parent)

      net = None
+    addr = None

      if nettype is None:
          return None
@@ -673,6 +677,11 @@ def validate_network(parent, conn, nettype, devname, macaddr, model=None):
                                        network=netname,
                                        macaddr=macaddr,
                                        model=model)
+        if net.model == "spapr-vlan":
+            addr = "spapr-vio"
+
+        net.set_address(addr)
+
      except Exception, e:
          return err_dial.val_err(_("Error with network parameters."), e)




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