diff mbox

kvm: balloon: test multiple devices

Message ID 0bf3d2e9b2aa2f8a0a13bc1d7f8d8f312ee1ee8f.1312808173.git.amit.shah@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Amit Shah Aug. 8, 2011, 1:05 p.m. UTC
Multiple balloon devices should not be allowed.  Check if the qemu we're
running under has the right fixes.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 client/tests/kvm/tests/balloon_check.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/client/tests/kvm/tests/balloon_check.py b/client/tests/kvm/tests/balloon_check.py
index 0b7f0f4..d79ed13 100644
--- a/client/tests/kvm/tests/balloon_check.py
+++ b/client/tests/kvm/tests/balloon_check.py
@@ -64,6 +64,18 @@  def run_balloon_check(test, params, env):
             fail += 1
         return fail
 
+    def multiple_devices():
+        """
+        Hot-plugging multiple balloon devices isn't allowed.
+        Ensure qemu fails hot-plugging a second device.
+        """
+        try:
+            vm.monitor.cmd("device_add virtio-balloon-pci")
+        except kvm_monitor.MonitorError, e:
+            # This is good.
+            return 0
+        logging.error("Multiple balloon devices allowed by this version of qemu")
+        return 1
 
     fail = 0
     vm = env.get_vm(params["main_vm"])
@@ -100,6 +112,8 @@  def run_balloon_check(test, params, env):
     # we won't trigger guest OOM killer while running multiple iterations
     fail += balloon_memory(vm_assigned_mem)
 
+    fail += multiple_devices()
+
     # Close stablished session
     session.close()
     # Check if any failures happen during the whole test