goto cleanup;
if (rc < 0)
goto cleanup;
- if (rc == 1 && info.cur == info.end &&
- info.type == VIR_DOMAIN_BLOCK_JOB_TYPE_COPY)
+ if (rc == 1 &&
+ (info.ready == 1 ||
+ (info.ready == -1 &&
+ info.end == info.cur &&
+ (info.type == VIR_DOMAIN_BLOCK_JOB_TYPE_COPY ||
+ info.type == VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT))))
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_READY;
}
* hold the vm lock, so modifying the in-memory representation is
* safe, even if we are a query rather than a modify job. */
if (ret == 1 && disk->mirror &&
+ rawInfo.ready != 0 &&
info->cur == info->end && !disk->mirrorState) {
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
* thing if the user specified a relative name). Be prepared for
* a ready event to occur while locks are dropped. */
if (mirror) {
+ disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
disk->mirror = mirror;
disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT;
}
unsigned long long bandwidth; /* in bytes/s */
virDomainBlockJobCursor cur;
virDomainBlockJobCursor end;
+ int ready; /* -1 if unknown, 0 if not ready, 1 if ready */
};
virHashTablePtr qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon);
qemuMonitorBlockJobInfoPtr info = NULL;
const char *device;
const char *type;
+ bool ready;
if (!(device = virJSONValueObjectGetString(entry, "device"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
return -1;
}
+ /* assume we don't know the state */
+ info->ready = -1;
+
if (!(type = virJSONValueObjectGetString(entry, "type"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("entry was missing 'type'"));
return -1;
}
+ if (virJSONValueObjectGetBoolean(entry, "ready", &ready) == 0)
+ info->ready = ready;
+
return 0;
}