Re: [PATCH RFC 12/51] qemu: process: refresh block jobs on reconnect

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

 



On Wed, Dec 12, 2018 at 06:08:28PM +0100, Peter Krempa wrote:
Block job state was widely untracked by libvirt across restarts which
was allowed by a stateless block job finishing handler which discarded
disk state and redetected it. This is undesirable since we'll need to
track more information for individual blockjobs due to -blockdev
integration requirements.

In case of legacy blockjobs we can recover whether the job is present at
reconnect time by querying qemu. Adding tracking whether a job is
present will allow simplification of the non-shared-storage cancellation
code.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
src/qemu/qemu_process.c | 67 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)

diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 3fccbc79bb..471e11115f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -7755,6 +7755,70 @@ qemuProcessRefreshCPU(virQEMUDriverPtr driver,
}


+static int
+qemuProcessRefreshLegacyBlockjob(void *payload,
+                                 const void *name,
+                                 void *opaque)
+{
+    const char *jobname = name;
+    virDomainObjPtr vm = opaque;
+    qemuMonitorBlockJobInfoPtr info = payload;
+    virDomainDiskDefPtr disk;
+    qemuDomainDiskPrivatePtr diskPriv;
+    qemuBlockJobDataPtr job;
+
+    if (!(disk = qemuProcessFindDomainDiskByAliasOrQOM(vm, jobname, jobname))) {
+        VIR_DEBUG("could not find disk for block job '%s'", jobname);
+        return 0;
+    }
+
+    diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
+    job = diskPriv->blockjob;
+
+    if (disk->mirror) {
+        if (info->ready == 1 ||
+            (info->ready == -1 && info->end == info->cur))
+            disk->mirrorState = VIR_DOMAIN_BLOCK_JOB_READY;

mirrorState uses virDomainDiskMirrorState so this should be:
VIR_DOMAIN_DISK_MIRROR_STATE_READY
just like in the code in qemuDomainBlockPivot removed by the next patch

Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature

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