[libvirt] [PATCH] util: storage: Copy driver type when initializing chain element

virStorageSourceInitChainElement initializes a new storage chain element for use as a new disk source. If the new element doesn't contain the driver name, copy it from the old source. This fixes issue where a disk would forget the driver after a snapshot. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140984 --- src/util/virstoragefile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 13056a7..960aa23 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1927,6 +1927,10 @@ virStorageSourceInitChainElement(virStorageSourcePtr newelem, virStorageSourceSeclabelsCopy(newelem, old) < 0) goto cleanup; + if (!newelem->driverName && + VIR_STRDUP(newelem->driverName, old->driverName) < 0) + goto cleanup; + newelem->shared = old->shared; newelem->readonly = old->readonly; -- 2.1.0

On Tue, Sep 16, 2014 at 01:35:22PM +0200, Peter Krempa wrote:
virStorageSourceInitChainElement initializes a new storage chain element for use as a new disk source. If the new element doesn't contain the driver name, copy it from the old source.
This fixes issue where a disk would forget the driver after a snapshot.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140984 --- src/util/virstoragefile.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 13056a7..960aa23 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1927,6 +1927,10 @@ virStorageSourceInitChainElement(virStorageSourcePtr newelem, virStorageSourceSeclabelsCopy(newelem, old) < 0) goto cleanup;
+ if (!newelem->driverName && + VIR_STRDUP(newelem->driverName, old->driverName) < 0) + goto cleanup; + newelem->shared = old->shared; newelem->readonly = old->readonly;
-- 2.1.0
ACK, Martin

On 09/16/14 14:43, Martin Kletzander wrote:
On Tue, Sep 16, 2014 at 01:35:22PM +0200, Peter Krempa wrote:
virStorageSourceInitChainElement initializes a new storage chain element for use as a new disk source. If the new element doesn't contain the driver name, copy it from the old source.
This fixes issue where a disk would forget the driver after a snapshot.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1140984 --- src/util/virstoragefile.c | 4 ++++ 1 file changed, 4 insertions(+)
ACK,
Martin
Pushed; Thanks. Peter
participants (2)
-
Martin Kletzander
-
Peter Krempa