Nodename may be asociated to a disk backup job, add support to looking
up in that chain too. This is specifically useful for the
BLOCK_WRITE_THRESHOLD event which can be registered for any nodename.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 19 ++++++++++++++++++-
src/qemu/qemu_domain.h | 3 ++-
src/qemu/qemu_driver.c | 2 +-
3 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 7232b6131f..58119bee1a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9960,7 +9960,8 @@ qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
virStorageSourcePtr
qemuDomainGetStorageSourceByDevstr(const char *devstr,
- virDomainDefPtr def)
+ virDomainDefPtr def,
+ virDomainBackupDefPtr backupdef)
{
virDomainDiskDefPtr disk = NULL;
virStorageSourcePtr n;
@@ -9994,6 +9995,22 @@ qemuDomainGetStorageSourceByDevstr(const char *devstr,
}
}
+ if (backupdef) {
+ size_t i;
+
+ for (i = 0; i < backupdef->ndisks; i++) {
+ virDomainBackupDiskDefPtr backupdisk = backupdef->disks + i;
+
+ if (STRNEQ(target, backupdisk->name))
+ continue;
+
+ for (n = backupdisk->store; virStorageSourceIsBacking(n); n =
n->backingStore) {
+ if (n->id == idx)
+ return n;
+ }
+ }
+ }
+
virReportError(VIR_ERR_INVALID_ARG,
_("failed to find disk '%s'"), devstr);
return NULL;
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 32f3586882..154339ef8f 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -920,7 +920,8 @@ char *qemuDomainDiskBackingStoreGetName(virDomainDiskDefPtr disk,
unsigned int idx);
virStorageSourcePtr qemuDomainGetStorageSourceByDevstr(const char *devstr,
- virDomainDefPtr def);
+ virDomainDefPtr def,
+ virDomainBackupDefPtr backupdef);
int
qemuDomainUpdateCPU(virDomainObjPtr vm,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4fd70ed300..f8eb575628 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19575,7 +19575,7 @@ qemuDomainSetBlockThreshold(virDomainPtr dom,
goto endjob;
}
- if (!(src = qemuDomainGetStorageSourceByDevstr(dev, vm->def)))
+ if (!(src = qemuDomainGetStorageSourceByDevstr(dev, vm->def, priv->backup)))
goto endjob;
if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV) &&
--
2.28.0