Bugs fixed
This commit is contained in:
parent
dbd63d894f
commit
3adc5e00e9
|
@ -1,4 +1,4 @@
|
|||
vn-vmware (1.0.37) stable; urgency=low
|
||||
vn-vmware (1.0.38) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
21
vn-vmware.pl
21
vn-vmware.pl
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue