2 Replies Latest reply on Feb 24, 2010 11:47 AM by slugsur

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

    slugsur Novice

      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