Clone loggin improved

This commit is contained in:
Juan 2018-11-12 23:45:36 +01:00
parent 3adc5e00e9
commit 090986b0b8
2 changed files with 9 additions and 7 deletions

2
debian/changelog vendored
View File

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

View File

@ -595,6 +595,7 @@ sub clone_machine {
}
$dst_tmp_name = "$dst_name.tmp";
log_message "Machine '$dst_name' already exists, cloning to '$dst_tmp_name'.";
}
# If MAC is not especified, it is generated by VMWare
@ -736,8 +737,7 @@ sub clone_machine {
);
if ($tmp_vm) {
power_off($tmp_vm);
$tmp_vm->Destroy();
destroy_machine($tmp_vm);
}
}
@ -764,9 +764,7 @@ sub clone_machine {
$vm_clone->ReconfigVM(spec => $change_spec);
if ($original_vm && $overwrite) {
log_message "Deleting machine '$dst_name'.";
power_off($original_vm);
$original_vm->Destroy();
destroy_machine($original_vm);
log_message "Renaming '$dst_tmp_name' to '$dst_name'.";
$vm_clone->Rename(newName => $dst_name);
@ -858,10 +856,14 @@ sub open_machine() {
log_message "Found machine '$vm_name'.";
}
sub power_off {
sub destroy_machine {
my ($vm_power) = @_;
log_message "Deleting machine '$vm_power->{name}'.";
if ($vm_power->runtime->powerState->val eq 'poweredOn') {
$vm_power->PowerOffVM();
}
$vm_power->Destroy();
}