Zhou Zheng Sheng has uploaded a new change for review.

Change subject: extract a method for booting a test VM through kernel boot
......................................................................

extract a method for booting a test VM through kernel boot

Hide the kernel boot and initramfs details into a method, then just call
the metthod with ordinary VM configurations

Change-Id: I6f2e94651d0279b19b1ce6849fb6f0c1b530a10c
Signed-off-by: Zhou Zheng Sheng <[email protected]>
---
M tests/functional/xmlrpcTests.py
1 file changed, 23 insertions(+), 19 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/14/8414/1

diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py
index 2968061..91376ed 100644
--- a/tests/functional/xmlrpcTests.py
+++ b/tests/functional/xmlrpcTests.py
@@ -190,32 +190,36 @@
     def testStartSmallVM(self):
         self.skipNoKVM()
 
-        def assertVMAndGuestUp():
-            self.assertVmUp(VMID)
-            self.assertGuestUp(VMID)
+        conf = {'display': 'vnc',
+                'kvmEnable': 'true',
+                'memSize': '256',
+                'vmId': '77777777-ffff-3333-bbbb-222222222222',
+                'vmName': 'vdsm_testSmallVM',
+                'vmType': 'kvm'}
 
-        VMID = '77777777-ffff-3333-bbbb-222222222222'
+        self._runVMKernelBoot(conf)
+
+    def _runVMKernelBoot(self, vmDef):
+        vmid = vmDef['vmId']
+
+        def assertVMAndGuestUp():
+            self.assertVmUp(vmid)
+            self.assertGuestUp(vmid)
 
         with kernelBootImages() as (kernelPath, initramfsPath):
-            conf = {'display': 'vnc',
-                    'kernel': kernelPath,
-                    'initrd': initramfsPath,
-                    # The initramfs is generated by dracut. The following
-                    # arguments will be interpreted by init scripts created by
-                    # dracut.
-                    'kernelArgs': 'rd.break=cmdline rd.shell rd.skipfsck',
-                    'kvmEnable': 'true',
-                    'memSize': '256',
-                    'vmId': VMID,
-                    'vmName': 'vdsm_testSmallVM',
-                    'vmType': 'kvm'}
-
+            vmDef.update(
+                    {'kernel': kernelPath,
+                     'initrd': initramfsPath,
+                     # The initramfs is generated by dracut. The following
+                     # arguments will be interpreted by init scripts created
+                     # by dracut.
+                     'kernelArgs': 'rd.break=cmdline rd.shell rd.skipfsck'})
             try:
-                self.assertVdsOK(self.s.create(conf))
+                self.assertVdsOK(self.s.create(vmDef))
                 # wait 65 seconds for VM to come up until timeout
                 self.retryAssert(assertVMAndGuestUp, 65, 1)
             finally:
-                destroyResult = self.s.destroy(VMID)
+                destroyResult = self.s.destroy(vmid)
 
         self.assertVdsOK(destroyResult)
 


--
To view, visit http://gerrit.ovirt.org/8414
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f2e94651d0279b19b1ce6849fb6f0c1b530a10c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to