Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2:Update
virt-v2v
handle_existing_storage.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File handle_existing_storage.patch of Package virt-v2v
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();
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor