|
|
d76c62 |
From 19778995ed94278db561db198a402d232027aeb8 Mon Sep 17 00:00:00 2001
|
|
|
d76c62 |
Message-Id: <19778995ed94278db561db198a402d232027aeb8@dist-git>
|
|
|
d76c62 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
Date: Fri, 28 Feb 2020 10:24:38 +0100
|
|
|
d76c62 |
Subject: [PATCH] virStorageSourceNewFromBacking: Also transfer the format
|
|
|
d76c62 |
MIME-Version: 1.0
|
|
|
d76c62 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d76c62 |
Content-Transfer-Encoding: 8bit
|
|
|
d76c62 |
|
|
|
d76c62 |
When we create the new virStorageSource from the definitions stored in
|
|
|
d76c62 |
the parent we should also use the 'backingStoreRawFormat' field to
|
|
|
d76c62 |
populate the format.
|
|
|
d76c62 |
|
|
|
d76c62 |
Callers which use virStorageSourceNewFromBacking are also fixed to stop
|
|
|
d76c62 |
setting the format manually.
|
|
|
d76c62 |
|
|
|
d76c62 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
(cherry picked from commit 264b79c63a518df8ce32a78dda51ae554cd2d5f2)
|
|
|
d76c62 |
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1798148
|
|
|
d76c62 |
Message-Id: <c9015f51f31c9a088983562298aaf61b1c43d927.1582881363.git.pkrempa@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
---
|
|
|
d76c62 |
src/storage/storage_util.c | 5 +----
|
|
|
d76c62 |
src/util/virstoragefile.c | 3 +--
|
|
|
d76c62 |
2 files changed, 2 insertions(+), 6 deletions(-)
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
|
|
|
d76c62 |
index c562cf313f..f3e899d0ca 100644
|
|
|
d76c62 |
--- a/src/storage/storage_util.c
|
|
|
d76c62 |
+++ b/src/storage/storage_util.c
|
|
|
d76c62 |
@@ -3316,7 +3316,6 @@ static int
|
|
|
d76c62 |
storageBackendProbeTarget(virStorageSourcePtr target,
|
|
|
d76c62 |
virStorageEncryptionPtr *encryption)
|
|
|
d76c62 |
{
|
|
|
d76c62 |
- int backingStoreFormat;
|
|
|
d76c62 |
int rc;
|
|
|
d76c62 |
struct stat sb;
|
|
|
d76c62 |
g_autoptr(virStorageSource) meta = NULL;
|
|
|
d76c62 |
@@ -3347,15 +3346,13 @@ storageBackendProbeTarget(virStorageSourcePtr target,
|
|
|
d76c62 |
if (!(meta = virStorageFileGetMetadataFromFD(target->path,
|
|
|
d76c62 |
fd,
|
|
|
d76c62 |
VIR_STORAGE_FILE_AUTO,
|
|
|
d76c62 |
- &backingStoreFormat)))
|
|
|
d76c62 |
+ NULL)))
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
|
|
|
d76c62 |
if (meta->backingStoreRaw) {
|
|
|
d76c62 |
if (virStorageSourceNewFromBacking(meta, &target->backingStore) < 0)
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
|
|
|
d76c62 |
- target->backingStore->format = backingStoreFormat;
|
|
|
d76c62 |
-
|
|
|
d76c62 |
/* XXX: Remote storage doesn't play nicely with volumes backed by
|
|
|
d76c62 |
* remote storage. To avoid trouble, just fake the backing store is RAW
|
|
|
d76c62 |
* and put the string from the metadata as the path of the target. */
|
|
|
d76c62 |
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
|
|
|
d76c62 |
index d594ee3695..d80780e291 100644
|
|
|
d76c62 |
--- a/src/util/virstoragefile.c
|
|
|
d76c62 |
+++ b/src/util/virstoragefile.c
|
|
|
d76c62 |
@@ -3824,6 +3824,7 @@ virStorageSourceNewFromBacking(virStorageSourcePtr parent,
|
|
|
d76c62 |
backing)) < 0)
|
|
|
d76c62 |
return rc;
|
|
|
d76c62 |
|
|
|
d76c62 |
+ (*backing)->format = parent->backingStoreRawFormat;
|
|
|
d76c62 |
(*backing)->readonly = true;
|
|
|
d76c62 |
return rc;
|
|
|
d76c62 |
}
|
|
|
d76c62 |
@@ -5028,8 +5029,6 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr src,
|
|
|
d76c62 |
if (rv == 1)
|
|
|
d76c62 |
return 0;
|
|
|
d76c62 |
|
|
|
d76c62 |
- backingStore->format = src->backingStoreRawFormat;
|
|
|
d76c62 |
-
|
|
|
d76c62 |
if (backingStore->format == VIR_STORAGE_FILE_AUTO) {
|
|
|
d76c62 |
/* Assuming the backing store to be raw can lead to failures. We do
|
|
|
d76c62 |
* it only when we must not report an error to prevent losing VMs.
|
|
|
d76c62 |
--
|
|
|
d76c62 |
2.25.1
|
|
|
d76c62 |
|