After the previous patch that moves backing chain detection later in code. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx> --- src/qemu/qemu_process.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 0d50db5..0dadc69 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8372,22 +8372,6 @@ qemuProcessReconnect(void *opaque) if (qemuDomainInitializePflashStorageSource(obj) < 0) goto error; - /* XXX: Need to change as long as lock is introduced for - * qemu_driver->sharedDevices. - */ - for (i = 0; i < obj->def->ndisks; i++) { - virDomainDiskDefPtr disk = obj->def->disks[i]; - virDomainDeviceDef dev; - - if (virDomainDiskTranslateSourcePool(disk) < 0) - goto error; - - dev.type = VIR_DOMAIN_DEVICE_DISK; - dev.data.disk = disk; - if (qemuAddSharedDevice(driver, &dev, obj->def->name) < 0) - goto error; - } - for (i = 0; i < obj->def->ngraphics; i++) { if (qemuProcessGraphicsReservePorts(obj->def->graphics[i], true) < 0) goto error; @@ -8436,12 +8420,6 @@ qemuProcessReconnect(void *opaque) goto error; } - /* if domain requests security driver we haven't loaded, report error, but - * do not kill the domain - */ - ignore_value(qemuSecurityCheckAllLabel(driver->securityManager, - obj->def)); - if (qemuProcessRefreshCPU(driver, obj) < 0) goto error; @@ -8482,6 +8460,31 @@ qemuProcessReconnect(void *opaque) if (qemuProcessRefreshBlockjobs(driver, obj) < 0) goto error; + /* XXX: Need to change as long as lock is introduced for + * qemu_driver->sharedDevices. + * + * Handling shared devices depends on top source and thus should + * follow refreshing blockjobs which can update it. + */ + for (i = 0; i < obj->def->ndisks; i++) { + virDomainDiskDefPtr disk = obj->def->disks[i]; + virDomainDeviceDef dev; + + if (virDomainDiskTranslateSourcePool(disk) < 0) + goto error; + + dev.type = VIR_DOMAIN_DEVICE_DISK; + dev.data.disk = disk; + if (qemuAddSharedDevice(driver, &dev, obj->def->name) < 0) + goto error; + } + + /* if domain requests security driver we haven't loaded, report error, but + * do not kill the domain + */ + ignore_value(qemuSecurityCheckAllLabel(driver->securityManager, + obj->def)); + if (qemuProcessUpdateDevices(driver, obj) < 0) goto error; -- 1.8.3.1