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 <jto...@redhat.com>

Jano

Attachment: signature.asc
Description: Digital signature

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

Reply via email to