Hello community,

here is the log from the commit of package virt-v2v for openSUSE:Factory 
checked in at 2015-07-22 09:19:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/virt-v2v (Old)
 and      /work/SRC/openSUSE:Factory/.virt-v2v.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "virt-v2v"

Changes:
--------
--- /work/SRC/openSUSE:Factory/virt-v2v/virt-v2v.changes        2015-07-14 
17:44:37.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.virt-v2v.new/virt-v2v.changes   2015-07-22 
09:20:02.000000000 +0200
@@ -1,0 +2,8 @@
+Mon Jul 13 01:29:56 UTC 2015 - [email protected]
+
+- Add new --storage_conflict_action=(abort|overwrite|use) option to
+  help prevent unintended disk conversions if the destination storage
+  volume already exists.
+  handle_existing_storage.patch
+
+-------------------------------------------------------------------

New:
----
  handle_existing_storage.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ virt-v2v.spec ++++++
--- /var/tmp/diff_new_pack.OFMeoD/_old  2015-07-22 09:20:03.000000000 +0200
+++ /var/tmp/diff_new_pack.OFMeoD/_new  2015-07-22 09:20:03.000000000 +0200
@@ -43,6 +43,7 @@
 Patch14:        handle_ova_files.patch
 Patch15:        support_any_opensuse_ver.patch
 Patch16:        use_x86_64_for_i586.patch
+Patch17:        handle_existing_storage.patch
 Patch50:        meta_license_to_list.patch
 Patch99:        remove_esx_examples.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
@@ -168,6 +169,7 @@
 %patch14 -p1
 %patch15 -p1
 %patch16 -p1
+%patch17 -p1
 # Apply meta_license_to_list.patch only for versions > SLES12
 %if 0%{?suse_version} >= 1320
 %patch50 -p1

++++++ handle_existing_storage.patch ++++++
Index: virt-v2v-0.9.1/v2v/virt-v2v.pl
===================================================================
--- virt-v2v-0.9.1.orig/v2v/virt-v2v.pl
+++ virt-v2v-0.9.1/v2v/virt-v2v.pl
@@ -304,6 +304,22 @@ drivers have been manually copied to the
 
 =cut
 
+my $storage_conflict_action = "abort";
+
+=item B<--storage_conflict_action=abort>
+
+=item B<--storage_conflict_action=overwrite>
+
+=item B<--storage_conflict_action=use>
+
+Specifies the action to take when the storage volume already exists in the
+target storage pool. The default setting is "abort", which causes the virt-v2v
+process to abort the copy. The "overwrite" option causes the existing volume
+to be overwritten. The "use" option causes the existing volume to be used in
+place (and the storage copy skipped).
+
+=cut
+
 my $verbose;
 
 =item B<-v | --verbose>
@@ -347,6 +363,7 @@ GetOptions ("help|?"      => sub {
                 print "$Sys::VirtConvert::VERSION\n";
                 exit(0);
             },
+            "storage_conflict_action=s" => \$storage_conflict_action,
             "v|verbose+"  => \$verbose,
             "vv"          => sub {
                 $verbose  += 2;
@@ -580,7 +597,7 @@ if (defined($verbose)) {
     logmsg NOTICE, __x('Copying virtual machine storage to target '.
                        '({output})', output => $output_method)
 }
-$source->copy_storage($target, $output_format, $output_sparse);
+$source->copy_storage($target, $output_format, $output_sparse, 
$storage_conflict_action);
 
 # Open a libguestfs handle on the guest's storage devices
 if (defined($verbose)) { logmsg NOTICE, __x('Starting guestfs') }
Index: virt-v2v-0.9.1/lib/Sys/VirtConvert/Connection/Source.pm
===================================================================
--- virt-v2v-0.9.1.orig/lib/Sys/VirtConvert/Connection/Source.pm
+++ virt-v2v-0.9.1/lib/Sys/VirtConvert/Connection/Source.pm
@@ -157,7 +157,7 @@ reflect their new locations and properti
 sub copy_storage
 {
     my $self = shift;
-    my ($target, $output_format, $output_sparse) = @_;
+    my ($target, $output_format, $output_sparse, $storage_conflict_action) = 
@_;
 
     my $meta = $self->get_meta();
 
@@ -165,11 +165,23 @@ sub copy_storage
         my $src = $disk->{src};
         my $dst;
         if ($target->volume_exists($src->get_name())) {
-            logmsg WARN, __x('Storage volume {name} already exists on the '.
-                             'target. NOT copying it again. Delete the volume 
'.
-                             'and retry to copy again.',
+            if ($storage_conflict_action eq "use") {
+                logmsg WARN, __x('Using existing storage volume {name}',
+                                 name => $src->get_name());
+                $dst = $target->get_volume($src->get_name());
+            } elsif ($storage_conflict_action eq "overwrite") {
+                logmsg WARN, __x('Overwriting existing storage volume {name}',
+                                 name => $src->get_name());
+                $dst = $target->get_volume($src->get_name());
+                $dst->get_local_path();
+                _volume_copy($src, $dst);
+            } else {
+                v2vdie  __x('Storage volume {name} already exists on the '.
+                            'target. Set --storage_conflict_action option to '.
+                            '"overwrite" or "use", or manually delete the '.
+                            'target and retry the operation.',
                              name => $src->get_name());
-            $dst = $target->get_volume($src->get_name());
+            }
         } else {
             my $disk_format = defined($output_format) ? $output_format :
                                                         $src->get_format();

Reply via email to