From patchwork Sun Jun 6 06:41:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Goldish X-Patchwork-Id: 104503 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o566gZeb005620 for ; Sun, 6 Jun 2010 06:42:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751876Ab0FFGm2 (ORCPT ); Sun, 6 Jun 2010 02:42:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9363 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751842Ab0FFGm1 (ORCPT ); Sun, 6 Jun 2010 02:42:27 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o566gQcp015988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 6 Jun 2010 02:42:26 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o566gPsV004356; Sun, 6 Jun 2010 02:42:25 -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 o566gNRP003494; Sun, 6 Jun 2010 02:42:24 -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: don't require pci_assignable to be defined Date: Sun, 6 Jun 2010 09:41:48 +0300 Message-Id: <1275806508-31947-1-git-send-email-mgoldish@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 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 (demeter.kernel.org [140.211.167.41]); Sun, 06 Jun 2010 06:42:35 +0000 (UTC) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index af45a81..78cbb16 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -502,49 +502,48 @@ class VM: self.uuid = f.read().strip() f.close() - if not params.get("pci_assignable") == "no": - pa_type = params.get("pci_assignable") + # Assign a PCI assignable device + self.pci_assignable = None + pa_type = params.get("pci_assignable") + if pa_type in ["vf", "pf", "mixed"]: pa_devices_requested = params.get("devices_requested") # Virtual Functions (VF) assignable devices if pa_type == "vf": - pa_driver = params.get("driver") - pa_driver_option = params.get("driver_option") - self.pci_assignable = kvm_utils.PciAssignable(type=pa_type, - driver=pa_driver, - driver_option=pa_driver_option, - devices_requested=pa_devices_requested) + self.pci_assignable = kvm_utils.PciAssignable( + type=pa_type, + driver=params.get("driver"), + driver_option=params.get("driver_option"), + devices_requested=pa_devices_requested) # Physical NIC (PF) assignable devices elif pa_type == "pf": - pa_device_names = params.get("device_names") - self.pci_assignable = kvm_utils.PciAssignable(type=pa_type, - names=pa_device_names, - devices_requested=pa_devices_requested) + self.pci_assignable = kvm_utils.PciAssignable( + type=pa_type, + names=params.get("device_names"), + devices_requested=pa_devices_requested) # Working with both VF and PF elif pa_type == "mixed": - pa_device_names = params.get("device_names") - pa_driver = params.get("driver") - pa_driver_option = params.get("driver_option") - self.pci_assignable = kvm_utils.PciAssignable(type=pa_type, - driver=pa_driver, - driver_option=pa_driver_option, - names=pa_device_names, - devices_requested=pa_devices_requested) + self.pci_assignable = kvm_utils.PciAssignable( + type=pa_type, + driver=params.get("driver"), + driver_option=params.get("driver_option"), + names=params.get("device_names"), + devices_requested=pa_devices_requested) self.pa_pci_ids = self.pci_assignable.request_devs() if self.pa_pci_ids: - logging.debug("Successfuly assigned devices: %s" % + logging.debug("Successfuly assigned devices: %s", self.pa_pci_ids) else: logging.error("No PCI assignable devices were assigned " "and 'pci_assignable' is defined to %s " - "on your config file. Aborting VM creation." % + "on your config file. Aborting VM creation.", pa_type) return False - else: - self.pci_assignable = None + elif pa_type and pa_type != "no": + logging.warn("Unsupported pci_assignable type: %s", pa_type) # Make qemu command qemu_command = self.make_qemu_command()