Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 252940

Re: can vco clone individual vmdk?

$
0
0

Hi,

 

there is a method called copyVirtualDisk_Task. You will find some information about here:

http://communities.vmware.com/message/1015081

 

I copyed it and wrote an untested vco script:

 

 

var mySourceDatacenter       = System.getModule("com.vmware.library.vc.basic").getDatacenterForVimObject(mySourceVirtualMachine);
var myDestinationDatacenter  = System.getModule("com.vmware.library.vc.basic").getDatacenterForVimObject(myDestinationVirtualMachine);
var mySourceVirtualDisk      = new VcVirtualDisk();
var myVirtualDiskManager     = myDestinationVirtualMachine.sdkConnection.virtualDiskManager;
for each ( var myDevice in mySourceVirtualMachine.config.hardware.device )
{
if ( myDevice instanceof VcVirtualDisk )
{
if ( myDevice.deviceInfo.label == "Hard disk 1" ) // any identifier you want Destination use Destination get your disk
{
mySourceVirtualDisk = myDevice;
break;
}
}
}
var myDestinationDatastore = myDestinationVirtualMachine.datasDestinationre;
var mySourcePath           = mySourceVirtualDisk.fileName;
var myDestinationPath      = "\[" + myDestinationDatastore.name + "] " + myDestinationVirtualMachine.name + "/" + myDestinationVirtualMachine.name + "_99.vmdk";
myTask = myVirtualDiskManager.copyVirtualDisk_Task(mySourcePath, mySourceDatacenter, myDestinationPath, myDestinationDatacenter, null, true);

 

Maybe it helps you find a solution.

 

Regards,

Chris


Viewing all articles
Browse latest Browse all 252940

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>