public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: autotest@test.kernel.org, kvm@vger.kernel.org
Subject: [PATCH KVM-AUTOTEST] KVM test: generate netdev ids that newer qemu can consume
Date: Tue, 22 Jun 2010 12:29:28 +0300	[thread overview]
Message-ID: <1277198968-13362-1-git-send-email-avi@redhat.com> (raw)

Newer qemu restricts identifiers to starting with a letter.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 client/tests/kvm/kvm_utils.py |    6 ++++++
 client/tests/kvm/kvm_vm.py    |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)

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:
-- 
1.7.1


             reply	other threads:[~2010-06-22  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22  9:29 Avi Kivity [this message]
2010-06-22 11:56 ` [PATCH KVM-AUTOTEST] KVM test: generate netdev ids that newer qemu can consume Lucas Meneghel Rodrigues

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1277198968-13362-1-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox