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

[virt-tools-list] [PATCH] Add spapr-vlan model for pseries guest



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 linux vnet ibm com>
---
 src/virtManager/details.py   |    5 ++++-
 src/virtManager/domain.py    |    3 ++-
 src/virtManager/uihelpers.py |    3 +++
 3 files changed, 9 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..1a9a5f5 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()
-- 
1.7.5.4


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