[libvirt] [PATCH 6/6] qemu: Support only raw volumes in qemuDomainBlockPeek

Peter Krempa posted 6 patches 8 years, 7 months ago
[libvirt] [PATCH 6/6] qemu: Support only raw volumes in qemuDomainBlockPeek
Posted by Peter Krempa 8 years, 7 months ago
The API documents that it peeks into the VM disk. We can't do that
currently for non raw images so report an error.
---
 src/qemu/qemu_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 115368d1d..53655749b 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11328,6 +11328,12 @@ qemuDomainBlockPeek(virDomainPtr dom,
         goto cleanup;
     }

+    if (disk->src->format != VIR_STORAGE_FILE_RAW) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("peeking is supported only for RAW disks"));
+        goto cleanup;
+    }
+
     if (qemuDomainStorageFileInit(driver, vm, disk->src) < 0)
         goto cleanup;

-- 
2.12.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 6/6] qemu: Support only raw volumes in qemuDomainBlockPeek
Posted by John Ferlan 8 years, 7 months ago

On 06/23/2017 09:33 AM, Peter Krempa wrote:
> The API documents that it peeks into the VM disk. We can't do that
> currently for non raw images so report an error.
> ---
>  src/qemu/qemu_driver.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 115368d1d..53655749b 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -11328,6 +11328,12 @@ qemuDomainBlockPeek(virDomainPtr dom,
>          goto cleanup;
>      }
> 
> +    if (disk->src->format != VIR_STORAGE_FILE_RAW) {
> +        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
> +                       _("peeking is supported only for RAW disks"));
> +        goto cleanup;

Just noting that cleanup will call virStorageFileDeinit. Although
virStorageFileInitAs wouldn't be called since tis won't call
qemuDomainStorageFileInit, but it shouldn't matter since
virStorageFileDeinit does check if virStorageFileIsInitialized - just a
concern that some how some "future" change to Deinit does something that
assumes Init was run. I would hope not, but just pointing it out...

Reviewed-by: John Ferlan <jferlan@redhat.com>

John
> +    }
> +
>      if (qemuDomainStorageFileInit(driver, vm, disk->src) < 0)
>          goto cleanup;
> 

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