unsigned long long bandwidth,
unsigned int granularity,
unsigned long long buf_size,
- unsigned int flags)
+ unsigned int flags,
+ bool keepParentLabel)
{
virQEMUDriverPtr driver = conn->privateData;
qemuDomainObjPrivatePtr priv;
if (mirror->format > 0)
format = virStorageFileFormatTypeToString(mirror->format);
- if (virStorageSourceInitChainElement(mirror, disk->src, false) < 0)
+ if (virStorageSourceInitChainElement(mirror, disk->src,
+ keepParentLabel) < 0)
goto endjob;
if (qemuDomainPrepareDiskChainElement(driver, vm, mirror,
flags &= (VIR_DOMAIN_BLOCK_REBASE_SHALLOW |
VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT);
ret = qemuDomainBlockCopyCommon(vm, dom->conn, path, dest,
- bandwidth, 0, 0, flags);
+ bandwidth, 0, 0, flags, true);
vm = NULL;
dest = NULL;
VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
- ret = qemuDomainBlockCopyCommon(vm, dom->conn, disk, dest,
- bandwidth, granularity, buf_size, flags);
+ ret = qemuDomainBlockCopyCommon(vm, dom->conn, disk, dest, bandwidth,
+ granularity, buf_size, flags, false);
vm = NULL;
cleanup:
goto endjob;
if (virStorageSourceInitChainElement(mirror,
disk->src,
- false) < 0)
+ true) < 0)
goto endjob;
}
* virStorageSourceInitChainElement:
* @newelem: New backing chain element disk source
* @old: Existing top level disk source
- * @force: Force-copy the information
+ * @transferLabels: Transfer security lables.
*
* Transfers relevant information from the existing disk source to the new
* backing chain element if they weren't supplied so that labelling info
* and possibly other stuff is correct.
*
- * If @force is true, user-supplied information for the new backing store
- * element is overwritten from @old instead of keeping it.
+ * If @transferLabels is true, security labels from the existing disk are copied
+ * to the new disk. Otherwise the default domain imagelabel label will be used.
*
* Returns 0 on success, -1 on error.
*/
int
virStorageSourceInitChainElement(virStorageSourcePtr newelem,
virStorageSourcePtr old,
- bool force)
+ bool transferLabels)
{
int ret = -1;
- if (force)
- virStorageSourceSeclabelsClear(newelem);
-
- if (!newelem->seclabels &&
+ if (transferLabels &&
+ !newelem->seclabels &&
virStorageSourceSeclabelsCopy(newelem, old) < 0)
goto cleanup;
}
/* copy parent's labelling and other top level stuff */
- if (virStorageSourceInitChainElement(ret, parent, false) < 0)
+ if (virStorageSourceInitChainElement(ret, parent, true) < 0)
goto error;
}