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

Li Zhang zhlcindy at linux.vnet.ibm.com
Mon Mar 5 08:10:15 UTC 2012


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.

Signed-off-by: Li Zhang <zhlcindy at 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)
 
-- 
1.7.5.4




More information about the virt-tools-list mailing list