From patchwork Wed Oct 27 09:37:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 285252 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9R9btpp019614 for ; Wed, 27 Oct 2010 09:37:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755189Ab0J0Jhi (ORCPT ); Wed, 27 Oct 2010 05:37:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48858 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754918Ab0J0Jhg (ORCPT ); Wed, 27 Oct 2010 05:37:36 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9R9bYCN000383 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Oct 2010 05:37:35 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o9R9bYqh032165; Wed, 27 Oct 2010 05:37:34 -0400 Received: from localhost.localdomain (dhcp-1-188.tlv.redhat.com [10.35.1.188]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o9R9bUrG001498; Wed, 27 Oct 2010 05:37:31 -0400 From: Michael Goldish To: autotest@test.kernel.org, kvm@vger.kernel.org Cc: Michael Goldish Subject: [KVM-AUTOTEST PATCH] KVM test: kvm_vm.py: style corrections in add_nic() and add_net() Date: Wed, 27 Oct 2010 11:37:28 +0200 Message-Id: <1288172250-4304-1-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 27 Oct 2010 09:37:56 +0000 (UTC) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index bb24c6a..02d7dff 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -236,25 +236,22 @@ class VM: def add_nic(help, vlan, model=None, mac=None, netdev_id=None, nic_extra_params=None): + if has_option(help, "netdev"): + netdev_vlan_str = ",netdev=%s" % netdev_id + else: + netdev_vlan_str = ",vlan=%d" % vlan if has_option(help, "device"): - if model == "virtio": - model="virtio-net-pci" if not model: - model= "rtl8139" - cmd = " -device %s" % model + model = "rtl8139" + elif model == "virtio": + model = "virtio-net-pci" + cmd = " -device %s" % model + netdev_vlan_str if mac: - cmd += ",mac=%s" % mac - if has_option(help, "netdev"): - cmd += ",netdev=%s" % netdev_id - else: - cmd += "vlan=%d," % vlan + cmd += ",mac='%s'" % mac if nic_extra_params: cmd += ",%s" % nic_extra_params else: - if has_option(help, "netdev"): - cmd = " -net nic,netdev=%s" % netdev_id - else: - cmd = " -net nic,vlan=%d" % vlan + cmd = " -net nic" + netdev_vlan_str if model: cmd += ",model=%s" % model if mac: @@ -267,7 +264,7 @@ class VM: if has_option(help, "netdev"): cmd = " -netdev %s,id=%s" % (mode, netdev_id) if vhost: - cmd +=",vhost=on" + cmd += ",vhost=on" else: cmd = " -net %s,vlan=%d" % (mode, vlan) if mode == "tap":