[Kimchi-devel] [PATCH 3/3] support to change a live VM network source, update test case

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Fri May 9 15:41:05 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

update test case

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
 tests/test_model.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tests/test_model.py b/tests/test_model.py
index e3dff95..ab927f0 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -39,6 +39,7 @@ from kimchi.exception import InvalidOperation, InvalidParameter
 from kimchi.exception import NotFoundError, OperationFailed
 from kimchi.iscsi import TargetClient
 from kimchi.model import model
+from kimchi.model.config import CapabilitiesModel
 from kimchi.rollbackcontext import RollbackContext
 from kimchi.utils import add_task
 
@@ -182,6 +183,18 @@ class ModelTests(unittest.TestCase):
             self.assertEquals("default", iface['network'])
             self.assertEquals("e1000", iface["model"])
 
+            # update vm interface when vm is running
+            if CapabilitiesModel().change_live_vm_network:
+                print ".change_live_vm_network:"
+                inst.vm_start("kimchi-ifaces")
+                rollback.prependDefer(inst.vm_poweroff, 'kimchi-ifaces')
+                iface_args = {"network": "test-network",
+                              "model": "virtio"}
+                inst.vmiface_update('kimchi-ifaces', mac, iface_args)
+                iface = inst.vmiface_lookup('kimchi-ifaces', mac)
+                self.assertEquals("e1000", iface["model"])
+                self.assertEquals("test-network", iface['network'])
+
     @unittest.skipUnless(utils.running_as_root(), 'Must be run as root')
     def test_vm_disk(self):
         def _attach_disk(bus_type=None):
-- 
1.9.0




More information about the Kimchi-devel mailing list