Matthew Booth
2010-Oct-11 10:49 UTC
[Libguestfs] [PATCH 1/2] Remove incompletely transferred libvirt volumes
If a user interrupted transfer of data to a libvirt volume, the incomplete data
was left in place. This patch causes the volume to be removed.
Fixes RHBZ#616728
---
lib/Sys/VirtV2V/Target/LibVirt.pm | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lib/Sys/VirtV2V/Target/LibVirt.pm
b/lib/Sys/VirtV2V/Target/LibVirt.pm
index 029e4e2..943b95a 100644
--- a/lib/Sys/VirtV2V/Target/LibVirt.pm
+++ b/lib/Sys/VirtV2V/Target/LibVirt.pm
@@ -21,6 +21,7 @@ use warnings;
package Sys::VirtV2V::Target::LibVirt::Vol;
use POSIX;
+use Sys::Virt;
use Sys::VirtV2V::Util qw(user_message);
@@ -143,6 +144,17 @@ sub close
delete($self->{fd});
}
+sub DESTROY
+{
+ my $self = shift;
+
+ # Check if the volume has been opened, but not closed
+ return unless (exists($self->{fd}));
+
+ # Assume the volume is incomplete and delete it
+ $self->{vol}->delete(Sys::Virt::StorageVol::DELETE_NORMAL);
+}
+
package Sys::VirtV2V::Target::LibVirt;
use Sys::Virt;
--
1.7.2.3
Matthew Booth
2010-Oct-11 10:49 UTC
[Libguestfs] [PATCH 2/2] exit instead of die() on signal
Net::SSL catches die() and will print an untidy confess() if the signal is
received in Net::SSL::read(). exit(1) achieves the same goal without triggering
the confess().
---
v2v/virt-v2v.pl | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/v2v/virt-v2v.pl b/v2v/virt-v2v.pl
index 93bfcd5..c72647c 100755
--- a/v2v/virt-v2v.pl
+++ b/v2v/virt-v2v.pl
@@ -414,7 +414,8 @@ END {
sub signal_exit
{
$g->close() if (defined($g));
- die(user_message(__x("Received signal {sig}. Exiting.", sig =>
shift)));
+ warn user_message(__x("Received signal {sig}. Exiting.", sig
=> shift));
+ exit(1);
}
# Inspect the guest's storage. Returns an OS hashref as returned by
--
1.7.2.3
Possibly Parallel Threads
- [PATCH] Remove v2v-snapshot
- [PATCH 1/2] Refactor guest and volume creation into Sys::VirtV2V::Target::LibVirt
- [PATCH 1/3] Fix RHEV cleanup on unclean shutdown
- Create new Sys::VirtV2V::Util
- [PATCH 1/4] Check that we're not overwriting an existing Libvirt domain