Thanks to the recent refactoring, it is now possible to easily
update the virStorageSource associated with each disk, including
making a monitor call if necessary. Of course, making one
monitor call per disk is not ideal, but that can be improved in
later patches.
* src/qemu/qemu_driver.c (qemuStorageLimitsRefresh): Minor tweaks
to allow NULL arguments.
(qemuDomainGetXMLDesc): Get stats on all disks.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/qemu/qemu_driver.c | 27 ++++++++++++++++++++++-----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7b1431b..657cd91 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6197,11 +6197,17 @@ qemuStorageLimitsRefresh(virQEMUDriverPtr driver,
virQEMUDriverConfigPtr cfg,
char *buf = NULL;
ssize_t len;
+ if (!path)
+ path = disk->dst;
if (virStorageSourceIsLocalStorage(disk->src)) {
if (!disk->src->path) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("disk '%s' does not currently have a source
assigned"),
- path);
+ if (activeFail)
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("disk '%s' does not currently have a
"
+ "source assigned"),
+ path);
+ else
+ ret = 0;
goto cleanup;
}
@@ -6301,7 +6307,8 @@ qemuStorageLimitsRefresh(virQEMUDriverPtr driver,
virQEMUDriverConfigPtr cfg,
* depends on whether domain is persistent
*/
if (!virDomainObjIsActive(vm)) {
- *activeFail = true;
+ if (activeFail)
+ *activeFail = true;
ret = 0;
goto cleanup;
}
@@ -6386,7 +6393,17 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom,
}
if (flags & VIR_DOMAIN_XML_BLOCK_INFO) {
- /* FIXME run monitor commands to refresh block info */
+ size_t i;
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+
+ for (i = 0; i < vm->def->ndisks; i++) {
+ if (qemuStorageLimitsRefresh(driver, cfg, vm, vm->def->disks[i],
+ NULL, NULL) < 0) {
+ virObjectUnref(cfg);
+ goto endjob;
+ }
+ }
+ virObjectUnref(cfg);
}
if ((flags & VIR_DOMAIN_XML_MIGRATABLE))
--
1.9.3