Matthew Booth
2009-Dec-21 17:15 UTC
[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
Richard W.M. Jones
2010-Jan-05 16:39 UTC
[Libguestfs] [PATCH] snapshot: Explicitly remove unused disk source attribute
On Mon, Dec 21, 2009 at 05:15:06PM +0000, Matthew Booth wrote:> 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.2All looks sensible to me, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw