Re: [libvirt] [PATCH 4/4] qemu: Use stricter checks in virQEMUCapsFillDomainDeviceDiskCaps()

2016-06-24 Thread Andrea Bolognani
On Thu, 2016-06-23 at 14:17 -0400, Laine Stump wrote:
> On 06/23/2016 04:40 AM, Andrea Bolognani wrote:
> > Unfortunately, we can't just call qemuDomainMachineIsPSeries()
> > here, because we don't have a virDomainDef instance; that said,
> > the open-coded check should match said function as closely as
> > possible.
> 
> Maybe you could make a separate function called something like 
> "qemuMachineIsPSeries() that took the arch and machinetype args 
> separately, then call that new function from 
> qemuDomainMachineIsPSeries() and from the place you've patched below. 
> That way there would be a single location for the logic, and no need to 
> worry about whether or not it matched in the future.
> 
> Either way is fine with me though, since I doubt this will change. ACK.

That could be a nice improvement. I'll look into it :)

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 4/4] qemu: Use stricter checks in virQEMUCapsFillDomainDeviceDiskCaps()

2016-06-23 Thread Laine Stump

On 06/23/2016 04:40 AM, Andrea Bolognani wrote:

Unfortunately, we can't just call qemuDomainMachineIsPSeries()
here, because we don't have a virDomainDef instance; that said,
the open-coded check should match said function as closely as
possible.


Maybe you could make a separate function called something like 
"qemuMachineIsPSeries() that took the arch and machinetype args 
separately, then call that new function from 
qemuDomainMachineIsPSeries() and from the place you've patched below. 
That way there would be a single location for the logic, and no need to 
worry about whether or not it matched in the future.


Either way is fine with me though, since I doubt this will change. ACK.

---
  src/qemu/qemu_capabilities.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 5fcd744..01466fc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4139,7 +4139,8 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr 
qemuCaps,
   VIR_DOMAIN_DISK_DEVICE_LUN);
  
  /* PowerPC pseries based VMs do not support floppy device */

-if (!(ARCH_IS_PPC64(qemuCaps->arch) && STRPREFIX(machine, "pseries")))
+if (!ARCH_IS_PPC64(qemuCaps->arch) ||
+(STRNEQ(machine, "pseries") && !STRPREFIX(machine, "pseries-")))
  VIR_DOMAIN_CAPS_ENUM_SET(disk->diskDevice, 
VIR_DOMAIN_DISK_DEVICE_FLOPPY);
  
  VIR_DOMAIN_CAPS_ENUM_SET(disk->bus,

@@ -4149,7 +4150,8 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr 
qemuCaps,
   /* VIR_DOMAIN_DISK_BUS_SD */);
  
  /* PowerPC pseries based VMs do not support floppy device */

-if (!(ARCH_IS_PPC64(qemuCaps->arch) && STRPREFIX(machine, "pseries")))
+if (!ARCH_IS_PPC64(qemuCaps->arch) ||
+(STRNEQ(machine, "pseries") && !STRPREFIX(machine, "pseries-")))
  VIR_DOMAIN_CAPS_ENUM_SET(disk->bus, VIR_DOMAIN_DISK_BUS_FDC);
  
  if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE))



--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 4/4] qemu: Use stricter checks in virQEMUCapsFillDomainDeviceDiskCaps()

2016-06-23 Thread Andrea Bolognani
Unfortunately, we can't just call qemuDomainMachineIsPSeries()
here, because we don't have a virDomainDef instance; that said,
the open-coded check should match said function as closely as
possible.
---
 src/qemu/qemu_capabilities.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 5fcd744..01466fc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -4139,7 +4139,8 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr 
qemuCaps,
  VIR_DOMAIN_DISK_DEVICE_LUN);
 
 /* PowerPC pseries based VMs do not support floppy device */
-if (!(ARCH_IS_PPC64(qemuCaps->arch) && STRPREFIX(machine, "pseries")))
+if (!ARCH_IS_PPC64(qemuCaps->arch) ||
+(STRNEQ(machine, "pseries") && !STRPREFIX(machine, "pseries-")))
 VIR_DOMAIN_CAPS_ENUM_SET(disk->diskDevice, 
VIR_DOMAIN_DISK_DEVICE_FLOPPY);
 
 VIR_DOMAIN_CAPS_ENUM_SET(disk->bus,
@@ -4149,7 +4150,8 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr 
qemuCaps,
  /* VIR_DOMAIN_DISK_BUS_SD */);
 
 /* PowerPC pseries based VMs do not support floppy device */
-if (!(ARCH_IS_PPC64(qemuCaps->arch) && STRPREFIX(machine, "pseries")))
+if (!ARCH_IS_PPC64(qemuCaps->arch) ||
+(STRNEQ(machine, "pseries") && !STRPREFIX(machine, "pseries-")))
 VIR_DOMAIN_CAPS_ENUM_SET(disk->bus, VIR_DOMAIN_DISK_BUS_FDC);
 
 if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE))
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list