Bug fixed: Disk file renamed when duplicated

This commit is contained in:
Juan Ferrer 2019-04-02 09:49:16 +02:00
parent e76c0a6ce2
commit ad6c4cdc66
2 changed files with 12 additions and 1 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
vn-vmware (1.1.5) stable; urgency=low
vn-vmware (1.1.6) stable; urgency=low
* Initial Release.

View File

@ -462,15 +462,26 @@ sub backup_machine() {
my $devices = $snapshot->config->hardware->device;
my $vdm = Vim::get_view(mo_ref => $service_content->virtualDiskManager);
my $i = -1;
my @copied_devices = ();
foreach my $device (@$devices) {
unless ($device->isa('VirtualDisk')) {
next;
}
$i++;
my $disk_path = $device->backing->fileName;
my $disk_file = basename($disk_path);
log_message $disk_path;
if ($disk_file ~~ @copied_devices) {
$disk_file = "${i}_$disk_file";
log_message "Duplicated disk file name, renamed to: $disk_file";
}
push @disk_file, @copied_devices;
# XXX: Not implemented by Perl vSphere SDK
#my $disk_spec = VirtualDiskSpec->new(
# adapterType => 'busLogic',