public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [KVM-AUTOTEST PATCH] KVM test: kvm_vm.py: don't require pci_assignable to be defined
@ 2010-06-06  6:41 Michael Goldish
  2010-06-07 13:24 ` Lucas Meneghel Rodrigues
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Goldish @ 2010-06-06  6:41 UTC (permalink / raw)
  To: autotest, kvm

Currently to disable PCI device assignment pci_assignable must be explicitly
set to "no".  This patch allows it to remain undefined (and adds a warning
message and a comment).

Signed-off-by: Michael Goldish <mgoldish@redhat.com>
---
 client/tests/kvm/kvm_vm.py |   47 +++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 24 deletions(-)

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()
-- 
1.5.4.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [KVM-AUTOTEST PATCH] KVM test: kvm_vm.py: don't require pci_assignable to be defined
  2010-06-06  6:41 [KVM-AUTOTEST PATCH] KVM test: kvm_vm.py: don't require pci_assignable to be defined Michael Goldish
@ 2010-06-07 13:24 ` Lucas Meneghel Rodrigues
  2010-06-07 13:38   ` [Autotest] " Lucas Meneghel Rodrigues
  0 siblings, 1 reply; 3+ messages in thread
From: Lucas Meneghel Rodrigues @ 2010-06-07 13:24 UTC (permalink / raw)
  To: Michael Goldish; +Cc: autotest, kvm, Avi Kivity

On Sun, 2010-06-06 at 09:41 +0300, Michael Goldish wrote:
> Currently to disable PCI device assignment pci_assignable must be explicitly
> set to "no".  This patch allows it to remain undefined (and adds a warning
> message and a comment).

I have noticed this on Friday, while I was testing the patches for RHEL6
style unit tests. Thanks for your fix! :)

By the way, I have the original flat files sent by Naphtali on his
initial patch, have you checked with Avi which ones are good to be
checked in? Copying Avi on the message.

> 
> Signed-off-by: Michael Goldish <mgoldish@redhat.com>
> ---
>  client/tests/kvm/kvm_vm.py |   47 +++++++++++++++++++++----------------------
>  1 files changed, 23 insertions(+), 24 deletions(-)
> 
> 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()



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Autotest] [KVM-AUTOTEST PATCH] KVM test: kvm_vm.py: don't require pci_assignable to be defined
  2010-06-07 13:24 ` Lucas Meneghel Rodrigues
@ 2010-06-07 13:38   ` Lucas Meneghel Rodrigues
  0 siblings, 0 replies; 3+ messages in thread
From: Lucas Meneghel Rodrigues @ 2010-06-07 13:38 UTC (permalink / raw)
  To: Michael Goldish; +Cc: autotest, Avi Kivity, kvm

On Mon, 2010-06-07 at 10:24 -0300, Lucas Meneghel Rodrigues wrote:
> On Sun, 2010-06-06 at 09:41 +0300, Michael Goldish wrote:
> > Currently to disable PCI device assignment pci_assignable must be explicitly
> > set to "no".  This patch allows it to remain undefined (and adds a warning
> > message and a comment).
> 
> I have noticed this on Friday, while I was testing the patches for RHEL6
> style unit tests. Thanks for your fix! :)
> 
> By the way, I have the original flat files sent by Naphtali on his
> initial patch, have you checked with Avi which ones are good to be
> checked in? Copying Avi on the message.

Nevermind, just talked to Avi, we'll have to modify the whole test. Will
keep you posted.

> 
> > 
> > Signed-off-by: Michael Goldish <mgoldish@redhat.com>
> > ---
> >  client/tests/kvm/kvm_vm.py |   47 +++++++++++++++++++++----------------------
> >  1 files changed, 23 insertions(+), 24 deletions(-)
> > 
> > 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()
> 
> 
> _______________________________________________
> Autotest mailing list
> Autotest@test.kernel.org
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-07 13:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-06  6:41 [KVM-AUTOTEST PATCH] KVM test: kvm_vm.py: don't require pci_assignable to be defined Michael Goldish
2010-06-07 13:24 ` Lucas Meneghel Rodrigues
2010-06-07 13:38   ` [Autotest] " Lucas Meneghel Rodrigues

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox