VMware {code} Community
slugsur
Contributor
Contributor
Jump to solution

howto remove a VMDK file from a VM without actually deleting the vmdk file from disk ?

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

0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Take a look at this script:

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
2 Replies
lamw
Community Manager
Community Manager
Jump to solution

Take a look at this script:

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

Twitter: @lamw

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
slugsur
Contributor
Contributor
Jump to solution

thanks a ton William

0 Kudos