Royce Lv has uploaded a new change for review.

Change subject: [WIP]add simple balloon functional testcase
......................................................................

[WIP]add simple balloon functional testcase

Change-Id: Ie8140fe1c754d9d4026c503a19420e6552a3f4fe
Signed-off-by: Royce Lv<lvro...@linux.vnet.ibm.com>
---
M tests/functional/xmlrpcTests.py
1 file changed, 34 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/20/12820/1

diff --git a/tests/functional/xmlrpcTests.py b/tests/functional/xmlrpcTests.py
index 3eb65e4..88dd2c5 100644
--- a/tests/functional/xmlrpcTests.py
+++ b/tests/functional/xmlrpcTests.py
@@ -19,6 +19,7 @@
 #
 
 import os
+import time
 import tempfile
 import pwd
 import grp
@@ -29,6 +30,7 @@
 from testrunner import VdsmTestCase as TestCaseBase
 from testrunner import permutations, expandPermutations
 from nose.plugins.skip import SkipTest
+from momTests import skipNoMOM
 try:
     import rtslib
 except ImportError:
@@ -169,6 +171,38 @@
         with RollbackContext() as rollback:
             self._runVMKernelBootTemplate(rollback, customization)
 
+    @skipNoKVM
+    @skipNoMOM
+    def testSmallVMBallooning(self):
+        policyStr = """
+            (def set_guest (guest)
+            {
+            (guest.Control "balloon_target" 0)
+            })
+            (with Guests guest (set_guest guest))"""
+        balloonSpec = {'device': 'memballoon',
+                       'type': 'balloon',
+                       'specParams': {'model': 'virtio'}}
+        customization = {'vmId': '77777777-ffff-3333-bbbb-555555555555',
+                         'vmName': 'vdsm_testBalloonVM',
+                         'devices': [balloonSpec]}
+        policy = {'balloon': policyStr}
+
+        with RollbackContext() as rollback:
+            self._runVMKernelBootTemplate(rollback, customization)
+            self._enableBalloonPolicy(policy, rollback)
+            time.sleep(12)  # MOM policy engine wake up evey 10s
+            balloonInf = self.s.getVmStats(
+                customization['vmId'])['statsList'][0]['balloonInfo']
+            self.assertEqual(balloonInf['balloon_cur'], 0)
+
+    def _enableBalloonPolicy(self, policy, rollback):
+        r = self.s.setMOMPolicy(policy)
+        self.assertVdsOK(r)
+        undo = lambda: \
+            self.assertVdsOK(self.s.resetMOMPolicy())
+        rollback.prependDefer(undo)
+
     def _runVMKernelBootTemplate(self, rollback, vmDef={}, distro='fedora'):
         kernelArgsDistro = {
             # Fedora: The initramfs is generated by dracut. The following


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8140fe1c754d9d4026c503a19420e6552a3f4fe
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Royce Lv <lvro...@linux.vnet.ibm.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to