how to remove a VMDK file from a VM without actually deleting the vmdk file from disk ?
details:
From my perl script, i need to temporarily remove a vmdk file from a vm . However i dont want the vmdk file to be deleted from the vm. For example , the vsphere gui provides this option of removing a virtual disk without removing the virtual disk files from the disk.
In my script, i use the ReconfigVM_Task to do this. This does the job, but also removes the vmdk file. How do i make sure that the vmdk file is not deleted on disk ?
The code snippet is something lie :
my $devspec = VirtualDeviceConfigSpec->new(
device => $device,
#device to be removed above:
operation => VirtualDeviceConfigSpecOperation->new('remove'));
push(@$devspec_list, $devspec);
my $config_spec = VirtualMachineConfigSpec->new(
deviceChange => $devspec_list
);
my $task = $template_view->ReconfigVM_Task(spec => $config_spec);
would really appreciate your help
-s
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
thanks a ton William