[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH] snapshot: Explicitly remove unused disk source attribute



This fixes a regression introduced by 9e3d1160. Snapshot was leaving both dev
and file attributes specified. The result was that the v2v would actually
operate on the underlying storage rather than the snapshot.
---
 snapshot/v2v-snapshot.pl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/snapshot/v2v-snapshot.pl b/snapshot/v2v-snapshot.pl
index f089a77..e2cc33c 100755
--- a/snapshot/v2v-snapshot.pl
+++ b/snapshot/v2v-snapshot.pl
@@ -529,8 +529,10 @@ sub _commit_guest
         # Update the domain XML with the location of the backing store
         if($backing_type == Sys::Virt::StorageVol::TYPE_BLOCK) {
             $source->setAttribute('dev', $backing_path);
+            $source->removeAttribute('file');
         } else {
             $source->setAttribute('file', $backing_path);
+            $source->removeAttribute('dev');
         }
 
         # Update the domain XML with with a driver appropriate to the backing
@@ -647,6 +649,9 @@ sub _snapshot_guest
             # Update the source to be a "file" with the new path
             $source->setAttribute("file", $vol->get_path());
 
+            # Remove the dev attribute in case it was set
+            $source->removeAttribute("dev");
+
             # Also update the disk element to be a "file"
             $source->getParentNode()->setAttribute('type', 'file');
 
-- 
1.6.5.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]