提交 39c5aa4e 编写于 作者: P Peter Krempa

virstoragefile: Kill "backingStore" field from virStorageFileMetadata

Remove the obsolete field replaced by data in "path".

The testsuite requires tweaking as the name of the backing file is now
stored one layer deeper in the backing chain linked list.
上级 c366a1ef
......@@ -18538,16 +18538,17 @@ virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
if (iter(disk, path, 0, opaque) < 0)
goto cleanup;
tmp = disk->backingChain;
while (tmp && virStorageIsFile(tmp->backingStore)) {
if (!ignoreOpenFailure && !tmp->backingMeta) {
/* XXX: temporarily we need to select the second element of the backing
* chain to start as the first is the copy of the disk itself. */
tmp = disk->backingChain ? disk->backingChain->backingMeta : NULL;
while (tmp && virStorageIsFile(tmp->path)) {
if (!ignoreOpenFailure && tmp->backingStoreRaw && !tmp->backingMeta) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unable to visit backing chain file %s"),
tmp->backingStore);
tmp->backingStoreRaw);
goto cleanup;
}
if (iter(disk, tmp->backingStore, ++depth, opaque) < 0)
if (iter(disk, tmp->path, ++depth, opaque) < 0)
goto cleanup;
tmp = tmp->backingMeta;
}
......
......@@ -15123,7 +15123,7 @@ qemuDomainBlockCopy(virDomainObjPtr vm,
if ((flags & VIR_DOMAIN_BLOCK_REBASE_SHALLOW) &&
STREQ_NULLABLE(format, "raw") &&
disk->backingChain->backingStore) {
disk->backingChain->backingMeta->path) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("disk '%s' has backing file, so raw shallow copy "
"is not possible"),
......@@ -15336,14 +15336,14 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base,
&top_parent))) {
goto endjob;
}
if (!top_meta || !top_meta->backingStore) {
if (!top_meta || !top_meta->backingMeta) {
virReportError(VIR_ERR_INVALID_ARG,
_("top '%s' in chain for '%s' has no backing file"),
top_canon, path);
goto endjob;
}
if (!base && (flags & VIR_DOMAIN_BLOCK_COMMIT_SHALLOW))
base_canon = top_meta->backingStore;
base_canon = top_meta->backingMeta->path;
else if (!(base_canon = virStorageFileChainLookup(top_meta,
base, NULL, NULL)))
goto endjob;
......@@ -15352,7 +15352,7 @@ qemuDomainBlockCommit(virDomainPtr dom, const char *path, const char *base,
* virStorageFileChainLookup guarantees a simple pointer
* comparison will work, rather than needing full-blown STREQ. */
if ((flags & VIR_DOMAIN_BLOCK_COMMIT_SHALLOW) &&
base_canon != top_meta->backingStore) {
base_canon != top_meta->backingMeta->path) {
virReportError(VIR_ERR_INVALID_ARG,
_("base '%s' is not immediately below '%s' in chain "
"for '%s'"),
......
......@@ -1190,8 +1190,6 @@ virStorageFileGetMetadataRecurse(const char *path, const char *canonPath,
return -1;
}
if (VIR_STRDUP(meta->backingStore, backingPath) < 0)
return -1;
if (backingFormat == VIR_STORAGE_FILE_AUTO && !allow_probe)
backingFormat = VIR_STORAGE_FILE_RAW;
......@@ -1204,7 +1202,6 @@ virStorageFileGetMetadataRecurse(const char *path, const char *canonPath,
uid, gid, allow_probe,
cycle, backing) < 0) {
/* If we failed to get backing data, mark the chain broken */
VIR_FREE(meta->backingStore);
virStorageFileFreeMetadata(backing);
} else {
meta->backingMeta = backing;
......@@ -1332,7 +1329,6 @@ virStorageFileFreeMetadata(virStorageFileMetadata *meta)
VIR_FREE(meta->relDir);
virStorageFileFreeMetadata(meta->backingMeta);
VIR_FREE(meta->backingStore);
VIR_FREE(meta->backingStoreRaw);
VIR_FREE(meta->compat);
virBitmapFree(meta->features);
......
......@@ -148,11 +148,6 @@ struct _virStorageFileMetadata {
unsigned long long capacity;
virBitmapPtr features; /* bits described by enum virStorageFileFeature */
char *compat;
/* Fields I'm trying to delete, because it is confusing to have to
* query the parent metadata for details about the backing
* store. */
char *backingStore; /* Canonical name (absolute file, or protocol). Should be same as backingMeta->canonPath */
};
......
......@@ -336,7 +336,7 @@ testStorageChain(const void *args)
virAsprintf(&actual,
"store:%s\nraw:%s\nother:%lld %d\n"
"relPath:%s\npath:%s\nrelDir:%s\ntype:%d %d\n",
NULLSTR(elt->backingStore),
NULLSTR(elt->backingMeta ? elt->backingMeta->path : NULL),
NULLSTR(elt->backingStoreRaw),
elt->capacity, !!elt->encryption,
NULLSTR(elt->relPath),
......@@ -841,16 +841,16 @@ mymain(void)
TEST_LOOKUP(0, "bogus", NULL, NULL, NULL);
TEST_LOOKUP(1, "wrap", chain->path, chain, NULL);
TEST_LOOKUP(2, abswrap, chain->path, chain, NULL);
TEST_LOOKUP(3, "qcow2", chain->backingStore, chain->backingMeta,
TEST_LOOKUP(3, "qcow2", chain->backingMeta->path, chain->backingMeta,
chain->path);
TEST_LOOKUP(4, absqcow2, chain->backingStore, chain->backingMeta,
TEST_LOOKUP(4, absqcow2, chain->backingMeta->path, chain->backingMeta,
chain->path);
TEST_LOOKUP(5, "raw", chain->backingMeta->backingStore,
chain->backingMeta->backingMeta, chain->backingStore);
TEST_LOOKUP(6, absraw, chain->backingMeta->backingStore,
chain->backingMeta->backingMeta, chain->backingStore);
TEST_LOOKUP(7, NULL, chain->backingMeta->backingStore,
chain->backingMeta->backingMeta, chain->backingStore);
TEST_LOOKUP(5, "raw", chain->backingMeta->backingMeta->path,
chain->backingMeta->backingMeta, chain->backingMeta->path);
TEST_LOOKUP(6, absraw, chain->backingMeta->backingMeta->path,
chain->backingMeta->backingMeta, chain->backingMeta->path);
TEST_LOOKUP(7, NULL, chain->backingMeta->backingMeta->path,
chain->backingMeta->backingMeta, chain->backingMeta->path);
/* Rewrite wrap and qcow2 back to 3-deep chain, relative backing */
virCommandFree(cmd);
......@@ -877,16 +877,16 @@ mymain(void)
TEST_LOOKUP(8, "bogus", NULL, NULL, NULL);
TEST_LOOKUP(9, "wrap", chain->path, chain, NULL);
TEST_LOOKUP(10, abswrap, chain->path, chain, NULL);
TEST_LOOKUP(11, "qcow2", chain->backingStore, chain->backingMeta,
TEST_LOOKUP(11, "qcow2", chain->backingMeta->path, chain->backingMeta,
chain->path);
TEST_LOOKUP(12, absqcow2, chain->backingStore, chain->backingMeta,
TEST_LOOKUP(12, absqcow2, chain->backingMeta->path, chain->backingMeta,
chain->path);
TEST_LOOKUP(13, "raw", chain->backingMeta->backingStore,
chain->backingMeta->backingMeta, chain->backingStore);
TEST_LOOKUP(14, absraw, chain->backingMeta->backingStore,
chain->backingMeta->backingMeta, chain->backingStore);
TEST_LOOKUP(15, NULL, chain->backingMeta->backingStore,
chain->backingMeta->backingMeta, chain->backingStore);
TEST_LOOKUP(13, "raw", chain->backingMeta->backingMeta->path,
chain->backingMeta->backingMeta, chain->backingMeta->path);
TEST_LOOKUP(14, absraw, chain->backingMeta->backingMeta->path,
chain->backingMeta->backingMeta, chain->backingMeta->path);
TEST_LOOKUP(15, NULL, chain->backingMeta->backingMeta->path,
chain->backingMeta->backingMeta, chain->backingMeta->path);
/* Use link to wrap with cross-directory relative backing */
virCommandFree(cmd);
......@@ -908,17 +908,17 @@ mymain(void)
TEST_LOOKUP(17, "sub/link2", chain->path, chain, NULL);
TEST_LOOKUP(18, "wrap", chain->path, chain, NULL);
TEST_LOOKUP(19, abswrap, chain->path, chain, NULL);
TEST_LOOKUP(20, "../qcow2", chain->backingStore, chain->backingMeta,
TEST_LOOKUP(20, "../qcow2", chain->backingMeta->path, chain->backingMeta,
chain->path);
TEST_LOOKUP(21, "qcow2", NULL, NULL, NULL);
TEST_LOOKUP(22, absqcow2, chain->backingStore, chain->backingMeta,
TEST_LOOKUP(22, absqcow2, chain->backingMeta->path, chain->backingMeta,
chain->path);
TEST_LOOKUP(23, "raw", chain->backingMeta->backingStore,
chain->backingMeta->backingMeta, chain->backingStore);
TEST_LOOKUP(24, absraw, chain->backingMeta->backingStore,
chain->backingMeta->backingMeta, chain->backingStore);
TEST_LOOKUP(25, NULL, chain->backingMeta->backingStore,
chain->backingMeta->backingMeta, chain->backingStore);
TEST_LOOKUP(23, "raw", chain->backingMeta->backingMeta->path,
chain->backingMeta->backingMeta, chain->backingMeta->path);
TEST_LOOKUP(24, absraw, chain->backingMeta->backingMeta->path,
chain->backingMeta->backingMeta, chain->backingMeta->path);
TEST_LOOKUP(25, NULL, chain->backingMeta->backingMeta->path,
chain->backingMeta->backingMeta, chain->backingMeta->path);
cleanup:
/* Final cleanup */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册