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