[PATCH 1/8] qemu: driver: blockdevize qemuDomainGetBlockJobInfo

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

 



Use the stored job name rather than passing in the disk alias when
refering to the job which allows the same code to work also when
-blockdev will be used.

Note that this API does not require the change to use 'query-job' as it
will ever only work with blockjobs bound to disks due to the arguments
which allow only refering to a disk. For the disk-less jobs we'll need
to add a separate API later.

The change to qemuMonitorGetBlockJobInfo is required as the API was
striping the 'drive-' prefix when returning the data which is not
desired any more.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c  | 9 +++++++--
 src/qemu/qemu_monitor.c | 2 +-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 329c166255..739cbc5ed3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17292,6 +17292,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
     virDomainDiskDefPtr disk;
     int ret = -1;
     qemuMonitorBlockJobInfo rawInfo;
+    VIR_AUTOUNREF(qemuBlockJobDataPtr) job = NULL;

     virCheckFlags(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, -1);

@@ -17314,9 +17315,13 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom,
         goto endjob;
     }

+    if (!(job = qemuBlockJobDiskGetJob(disk))) {
+        ret = 0;
+        goto endjob;
+    }
+
     qemuDomainObjEnterMonitor(driver, vm);
-    ret = qemuMonitorGetBlockJobInfo(qemuDomainGetMonitor(vm),
-                                     disk->info.alias, &rawInfo);
+    ret = qemuMonitorGetBlockJobInfo(qemuDomainGetMonitor(vm), job->name, &rawInfo);
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
         ret = -1;
     if (ret <= 0)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 5ad66d1dca..a880da3ab6 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3463,7 +3463,7 @@ qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon,

     VIR_DEBUG("alias=%s, info=%p", alias, info);

-    if (!(all = qemuMonitorGetAllBlockJobInfo(mon, false)))
+    if (!(all = qemuMonitorGetAllBlockJobInfo(mon, true)))
         return -1;

     if ((data = virHashLookup(all, alias))) {
-- 
2.21.0

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