[PATCH 12/18] qemu: capabilities: Add QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI

Peter Krempa posted 18 patches 5 years, 7 months ago
[PATCH 12/18] qemu: capabilities: Add QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
Posted by Peter Krempa 5 years, 7 months ago
We want to instantiate hostdevs via -blockdev too. Add a separate
capability for them for a clean transition. The new capability will be
enabled when QEMU_CAPS_BLOCKDEV is present once all code is prepared.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_capabilities.c | 1 +
 src/qemu/qemu_capabilities.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index b27a5e5c81..cc54ad9283 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -596,6 +596,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "intel-iommu.aw-bits",
               "spapr-tpm-proxy",
               "numa.hmat",
+              "blockdev-hostdev-scsi"
     );


diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index dac36b33d9..5d08941538 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -576,6 +576,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_INTEL_IOMMU_AW_BITS, /* intel-iommu.aw-bits */
     QEMU_CAPS_DEVICE_SPAPR_TPM_PROXY, /* -device spapr-tpm-proxy */
     QEMU_CAPS_NUMA_HMAT, /* -numa hmat */
+    QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI, /* -blockdev used for (i)SCSI hostdevs */

     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
-- 
2.26.2

Re: [PATCH 12/18] qemu: capabilities: Add QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
Posted by Ján Tomko 5 years, 6 months ago
On a Friday in 2020, Peter Krempa wrote:
>We want to instantiate hostdevs via -blockdev too. Add a separate
>capability for them for a clean transition. The new capability will be
>enabled when QEMU_CAPS_BLOCKDEV is present once all code is prepared.
>

What is the benefit here compared to using QEMU_CAPS_BLOCKDEV directly?

Seems more like a libvirt capability than a QEMU capability.

Jano

>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_capabilities.c | 1 +
> src/qemu/qemu_capabilities.h | 1 +
> 2 files changed, 2 insertions(+)
Re: [PATCH 12/18] qemu: capabilities: Add QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
Posted by Peter Krempa 5 years, 6 months ago
On Thu, Jul 16, 2020 at 00:16:23 +0200, Ján Tomko wrote:
> On a Friday in 2020, Peter Krempa wrote:
> > We want to instantiate hostdevs via -blockdev too. Add a separate
> > capability for them for a clean transition. The new capability will be
> > enabled when QEMU_CAPS_BLOCKDEV is present once all code is prepared.
> > 
> 
> What is the benefit here compared to using QEMU_CAPS_BLOCKDEV directly?

It encodes whether the particular VM instance was already started with
-blockdev used for hostdevs. The benefit ... or rather necessity is that
we need to handle cases when the VM was started with -drive differently
on hot-unplug of the hostdev.

I'd have to encode that bit of information somehow regardless of which
approach is used to actually store it.

> Seems more like a libvirt capability than a QEMU capability.

It is a capability of that particular instance of the VM the same way as
others. A VM started with pre-blockdev libvirt but modern qemu will not
use -blockdev for hotplug after libvirt upgrade and this is exactly te
same situation.

> Jano
> 
> > Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> > ---
> > src/qemu/qemu_capabilities.c | 1 +
> > src/qemu/qemu_capabilities.h | 1 +
> > 2 files changed, 2 insertions(+)


Re: [PATCH 12/18] qemu: capabilities: Add QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI
Posted by Ján Tomko 5 years, 6 months ago
On a Thursday in 2020, Peter Krempa wrote:
>On Thu, Jul 16, 2020 at 00:16:23 +0200, Ján Tomko wrote:
>> On a Friday in 2020, Peter Krempa wrote:
>> > We want to instantiate hostdevs via -blockdev too. Add a separate
>> > capability for them for a clean transition. The new capability will be
>> > enabled when QEMU_CAPS_BLOCKDEV is present once all code is prepared.
>> >
>>
>> What is the benefit here compared to using QEMU_CAPS_BLOCKDEV directly?
>
>It encodes whether the particular VM instance was already started with
>-blockdev used for hostdevs. The benefit ... or rather necessity is that
>we need to handle cases when the VM was started with -drive differently
>on hot-unplug of the hostdev.
>
>I'd have to encode that bit of information somehow regardless of which
>approach is used to actually store it.
>
>> Seems more like a libvirt capability than a QEMU capability.
>
>It is a capability of that particular instance of the VM the same way as
>others. A VM started with pre-blockdev libvirt but modern qemu will not
>use -blockdev for hotplug after libvirt upgrade and this is exactly te
>same situation.
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano