Bugs fixed

This commit is contained in:
Juan 2018-11-12 23:38:35 +01:00
parent dbd63d894f
commit 3adc5e00e9
2 changed files with 22 additions and 1 deletions

2
debian/changelog vendored
View File

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

View File

@ -729,6 +729,18 @@ sub clone_machine {
# Gathering specifications and cloning
if ($original_vm) {
my $tmp_vm = Vim::find_entity_view(
view_type => 'VirtualMachine',
filter => {'name' => $dst_tmp_name}
);
if ($tmp_vm) {
power_off($tmp_vm);
$tmp_vm->Destroy();
}
}
log_message "Cloning machine.";
my $clone_spec = VirtualMachineCloneSpec->new(
powerOn => false,
@ -753,6 +765,7 @@ sub clone_machine {
if ($original_vm && $overwrite) {
log_message "Deleting machine '$dst_name'.";
power_off($original_vm);
$original_vm->Destroy();
log_message "Renaming '$dst_tmp_name' to '$dst_name'.";
@ -844,3 +857,11 @@ sub open_machine() {
log_message "Found machine '$vm_name'.";
}
sub power_off {
my ($vm_power) = @_;
if ($vm_power->runtime->powerState->val eq 'poweredOn') {
$vm_power->PowerOffVM();
}
}