virStorageSource *n;
virStorageSource *mirrorBacking = NULL;
g_autoptr(GHashTable) blockNamedNodeData = NULL;
+ bool syncWrites = !!(flags & VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES);
int rc = 0;
/* Preliminaries: find the disk we are editing, sanity checks */
virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW |
VIR_DOMAIN_BLOCK_COPY_REUSE_EXT |
- VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1);
+ VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB |
+ VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES, -1);
if (virStorageSourceIsRelative(mirror)) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
virDomainDiskDefSourceLUNValidate(mirror) < 0)
goto endjob;
+ if (syncWrites && !blockdev) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES is not supported by this VM"));
+ goto endjob;
+ }
+
if (!(flags & VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB) &&
vm->persistent) {
/* XXX if qemu ever lets us start a new domain with mirroring
qemuDomainDiskGetTopNodename(disk),
mirror->nodeformat, bandwidth,
granularity, buf_size, mirror_shallow,
- false);
+ syncWrites);
} else {
/* qemuMonitorDriveMirror needs to honor the REUSE_EXT flag as specified
* by the user */
virCheckFlags(VIR_DOMAIN_BLOCK_COPY_SHALLOW |
VIR_DOMAIN_BLOCK_COPY_REUSE_EXT |
- VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB, -1);
+ VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB |
+ VIR_DOMAIN_BLOCK_COPY_SYNCHRONOUS_WRITES, -1);
+
if (virTypedParamsValidate(params, nparams,
VIR_DOMAIN_BLOCK_COPY_BANDWIDTH,
VIR_TYPED_PARAM_ULLONG,