[PATCH v10 17/19] backup: qemu: Add helper API for looking up node name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux