Qemu bitmap operations require knowing the node name associated with
the format layer (the qcow2 file); as upcoming patches will be
grabbing that information frequently, make a helper function to access
it.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/qemu/qemu_domain.h | 3 +++
src/qemu/qemu_domain.c | 15 +++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index eeb07180b7..b76d3cace9 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -804,6 +804,9 @@ int qemuDomainDetermineDiskChain(virQEMUDriverPtr driver,
bool qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
virDomainDiskDefPtr orig_disk);
+const char *qemuDomainDiskNodeFormatLookup(virDomainObjPtr vm,
+ const char *disk);
+
int qemuDomainStorageFileInit(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virStorageSourcePtr src,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 44ac7eb73e..d71b7d1984 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10260,6 +10260,21 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
return true;
}
+
+/* Return the format node name for a given disk of an online guest */
+const char *
+qemuDomainDiskNodeFormatLookup(virDomainObjPtr vm,
+ const char *disk)
+{
+ size_t i;
+
+ for (i = 0; i < vm->def->ndisks; i++) {
+ if (STREQ(vm->def->disks[i]->dst, disk))
+ return vm->def->disks[i]->src->nodeformat;
+ }
+ return NULL;
+}
+
bool
qemuDomainDiskBlockJobIsActive(virDomainDiskDefPtr disk)
{
--
2.20.1