diff mbox

[KVM-AUTOTEST] KVM test: generate netdev ids that newer qemu can consume

Message ID 1277198968-13362-1-git-send-email-avi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Avi Kivity June 22, 2010, 9:29 a.m. UTC
None
diff mbox

Patch

diff --git a/client/tests/kvm/kvm_utils.py b/client/tests/kvm/kvm_utils.py
index 12508b6..0372565 100644
--- a/client/tests/kvm/kvm_utils.py
+++ b/client/tests/kvm/kvm_utils.py
@@ -815,6 +815,12 @@  def generate_random_string(length):
         length -= 1
     return str
 
+def generate_random_id():
+    """
+    Return a random string suitable for use as a qemu id.
+    """
+    return "id" + generate_random_string(6)
+
 
 def generate_tmp_file_name(file, ext=None, dir='/tmp/'):
     """
diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
index 0643bca..966fb3c 100755
--- a/client/tests/kvm/kvm_vm.py
+++ b/client/tests/kvm/kvm_vm.py
@@ -119,7 +119,7 @@  class VM:
         self.address_cache = address_cache
         self.netdev_id = []
         for nic in params.get("nics").split():
-            self.netdev_id.append(kvm_utils.generate_random_string(4))
+            self.netdev_id.append(kvm_utils.generate_random_id())
 
         # Find a unique identifier for this VM
         while True: