[libvirt] [PATCH] qemu: Don't build cache= cmd line for scsi-block

Michal Privoznik posted 1 patch 5 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/bc8a84b397b15e8a63ad73a9ce40ab5fd8d6b097.1527517907.git.mprivozn@redhat.com
Test syntax-check passed
src/qemu/qemu_command.c | 5 +++++
1 file changed, 5 insertions(+)
[libvirt] [PATCH] qemu: Don't build cache= cmd line for scsi-block
Posted by Michal Privoznik 5 years, 10 months ago
Trying to set any cache for <disk device='lun'/> makes no sense.
Such disk translates into -device scsi-block on the command line
and the device lacks any cache setting because it's merely a
middle man between qemu and real SCSI device.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_command.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7408f6bc70..c7ff074e29 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1824,6 +1824,11 @@ qemuBuildDriveDevCacheStr(virDomainDiskDefPtr disk,
     if (disk->cachemode == VIR_DOMAIN_DISK_CACHE_DEFAULT)
         return 0;
 
+    /* VIR_DOMAIN_DISK_DEVICE_LUN translates into 'scsi-block'
+     * where any caching setting makes no sense. */
+    if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN)
+        return 0;
+
     if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DISK_WRITE_CACHE))
         return 0;
 
-- 
2.16.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Don't build cache= cmd line for scsi-block
Posted by Peter Krempa 5 years, 10 months ago
On Mon, May 28, 2018 at 16:31:47 +0200, Michal Privoznik wrote:
> Trying to set any cache for <disk device='lun'/> makes no sense.
> Such disk translates into -device scsi-block on the command line
> and the device lacks any cache setting because it's merely a
> middle man between qemu and real SCSI device.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_command.c | 5 +++++
>  1 file changed, 5 insertions(+)

Broken by commit 327430fcfcf34c7b27d9d378df19032fd5d0e451 which was
released in 4.3.0.


> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 7408f6bc70..c7ff074e29 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1824,6 +1824,11 @@ qemuBuildDriveDevCacheStr(virDomainDiskDefPtr disk,
>      if (disk->cachemode == VIR_DOMAIN_DISK_CACHE_DEFAULT)
>          return 0;
>  
> +    /* VIR_DOMAIN_DISK_DEVICE_LUN translates into 'scsi-block'
> +     * where any caching setting makes no sense. */
> +    if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN)
> +        return 0;

ACK

> +
>      if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DISK_WRITE_CACHE))
>          return 0;
>  
> -- 
> 2.16.1
> 
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list