]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: storage: Copy driver type when initializing chain element
authorPeter Krempa <pkrempa@redhat.com>
Tue, 16 Sep 2014 10:55:32 +0000 (12:55 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 16 Sep 2014 16:04:22 +0000 (18:04 +0200)
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

index 13056a7567b95f882a764739fc82ac70f7de657a..960aa2330e3ad352cbdb47d15d8bd10419620b38 100644 (file)
@@ -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;