[libvirt] [PATCH 3/9] qemu: domain: Add helper for getting the disk backend alias

Ján Tomko jtomko at redhat.com
Fri Jul 20 12:27:24 UTC 2018


On Wed, Jul 18, 2018 at 05:22:04PM +0200, Peter Krempa wrote:
>The disk backend alias was historically the alias of the -drive backing
>the storage. For setups with -blockdev this will become more complex as
>it will depend on other configs and generally will differ.
>---
> src/qemu/qemu_domain.c | 28 ++++++++++++++++++++++++++++
> src/qemu/qemu_domain.h |  6 ++++++
> 2 files changed, 34 insertions(+)
>
>diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>index c92ac8c926..f8a621a5c9 100644
>--- a/src/qemu/qemu_domain.c
>+++ b/src/qemu/qemu_domain.c
>@@ -8449,6 +8449,34 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
> }
>
>
>+/**
>+ * qemuDomainDiskGetBackendAlias:
>+ * @disk: disk definition
>+ * @qemuCaps: emulator capabilities
>+ * @backendAlias: filled with the alias of the disk storage backend
>+ *
>+ * Returns the correct alias for the disk backend. This may be the alias of
>+ * -drive for legacy setup or the correct node name for -blockdev setups.
>+ *

>+ * @backendAlias may be NULL on success if the backend does not exist
>+ * (disk is empty).

I presume this will be true in the future,

>Caller is responsible for freeing @backendAlias.
>+ *
>+ * Returns 0 on success, -1 on error with libvirt error reported.
>+ */
>+int
>+qemuDomainDiskGetBackendAlias(virDomainDiskDefPtr disk,
>+                              virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,

and the capabilities will be used.

>+                              char **backendAlias)
>+{
>+    *backendAlias = NULL;
>+
>+    if (!(*backendAlias = qemuAliasDiskDriveFromDisk(disk)))
>+        return -1;
>+
>+    return 0;
>+}
>+
>+
> /**
>  * qemuDomainDiskChainElementRevoke:
>  *

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

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180720/a96f8484/attachment-0001.sig>


More information about the libvir-list mailing list