NULL) < 0)
return -1;
+ if (src->dataFileStore) {
+ if (virJSONValueObjectAdd(&props,
+ "s:data-file", qemuBlockStorageSourceGetEffectiveNodename(src->dataFileStore),
+ NULL) < 0)
+ return -1;
+ }
+
return 0;
}
return NULL;
VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend);
+
+ if (n->dataFileStore) {
+ if (!(backend = qemuBlockStorageSourceDetachPrepare(n->dataFileStore)))
+ return NULL;
+
+ VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend);
+ }
}
return g_steal_pointer(&data);
if (qemuBlockStorageSourceIsRaw(src))
return 0;
+ if (src->dataFileStore) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("creation of storage images with <dataStore> feature is not supported"));
+ return -1;
+ }
+
if (qemuBlockStorageSourceCreateGetFormatProps(src, backingStore,
&createformatprops) < 0)
return -1;
if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n,
n->backingStore) < 0)
return NULL;
+
+ /* the dataStore must not have a backing image so we pass NULL */
+ if (n->dataFileStore &&
+ qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n->dataFileStore, NULL) < 0)
+ return NULL;
}
return g_steal_pointer(&data);
virStorageSource *disksrc)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
+ bool hadDataStore = false;
virStorageSource *src; /* iterator for the backing chain declared in XML */
virStorageSource *n; /* iterator for the backing chain detected from disk */
uid_t uid;
qemuDomainGetImageIds(cfg, vm->def, src, disksrc, &uid, &gid);
+ hadDataStore = !!src->dataFileStore;
+
if (virStorageSourceGetMetadata(src, uid, gid,
QEMU_DOMAIN_STORAGE_SOURCE_CHAIN_MAX_DEPTH,
true) < 0)
return -1;
+ /* As we perform image properties detection on the last member of the
+ * backing chain we need to also consider the data store part of the current
+ * image */
+ if (src->dataFileStore && !hadDataStore &&
+ qemuDomainPrepareStorageSource(src->dataFileStore, vm, disk, cfg) < 0)
+ return -1;
+
for (n = src->backingStore; virStorageSourceIsBacking(n); n = n->backingStore) {
if (qemuDomainPrepareStorageSource(n, vm, disk, cfg) < 0)
return -1;
+
+ if (n->dataFileStore &&
+ qemuDomainPrepareStorageSource(n->dataFileStore, vm, disk, cfg) < 0)
+ return -1;
}
if (qemuDomainStorageSourceValidateDepth(disksrc, 0, disk->dst) < 0)
return;
/* transfer properties valid only for the top level image */
- if (src == disk->src)
+ if (src == disk->src || src == disk->src->dataFileStore)
src->detect_zeroes = disk->detect_zeroes;
/* transfer properties valid for the full chain */
for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
if (qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0)
return -1;
+
+ if (n->dataFileStore &&
+ qemuDomainPrepareStorageSourceBlockdev(disk, n->dataFileStore, priv, cfg) < 0)
+ return -1;
}
return 0;