From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Goldish Subject: Re: [PATCH 5/5] KVM test: Make it possible to run VMs without NICs Date: Fri, 25 Jun 2010 13:03:22 +0300 Message-ID: <4C247EEA.5070202@redhat.com> References: <1277422386-13516-1-git-send-email-lmr@redhat.com> <1277422386-13516-5-git-send-email-lmr@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: autotest@test.kernel.org, kvm@vger.kernel.org To: Lucas Meneghel Rodrigues Return-path: Received: from mx1.redhat.com ([209.132.183.28]:59357 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858Ab0FYKFJ (ORCPT ); Fri, 25 Jun 2010 06:05:09 -0400 In-Reply-To: <1277422386-13516-5-git-send-email-lmr@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/25/2010 02:33 AM, Lucas Meneghel Rodrigues wrote: > For unittesting, for example, is interesting that we > run the VM with the bare mininum number of parameters. > This fix allows that. > > Signed-off-by: Lucas Meneghel Rodrigues > --- > client/tests/kvm/kvm_vm.py | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py > index 7b1fc05..3c01fa0 100755 > --- a/client/tests/kvm/kvm_vm.py > +++ b/client/tests/kvm/kvm_vm.py > @@ -118,8 +118,9 @@ class VM: > self.root_dir = root_dir > self.address_cache = address_cache > self.netdev_id = [] > - for nic in params.get("nics").split(): > - self.netdev_id.append(kvm_utils.generate_random_id()) > + if params.get("nics"): > + for nic in params.get("nics").split(): That's exactly what kvm_utils.get_sub_dict_names() does. It may be a long name for something so simple but it's used everywhere in kvm-autotest. > + self.netdev_id.append(kvm_utils.generate_random_id()) I think the 3 lines above belong in VM.create(), not VM.__init__(), because VM params are routinely changed in calls to VM.create(). If the code stays in __init__() the changed params will not affect self.netdev_id. A good place for it would be near the code that handles -redir. > > # Find a unique identifier for this VM > while True: