VMware {code} Community
sahmed24
Contributor
Contributor

how to identify if the cloned machine is a linked clone or full clone?

hi

if i create two clones, one is full and other is linked, how can i identify which one is linked and which one is full. is there a property/type that tells that whether it is linked or full. i dont know how to find this either programatically or manually (from Vsphere client)

//Rizwan

Reply
0 Kudos
7 Replies
lamw
Community Manager
Community Manager

Please take a look at this thread -

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

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".

sahmed24
Contributor
Contributor

i read the post, it says

"Since it's base disk is backed by the parent VM in which the Linked Clone was created from, you could look at it's VirtualDisk device and check to see if it's parent is set, if so it'll point back to the main VM's VirtualDiskFlatVer2BackingInfo in which the LC was cloned from. "

i dont know how to get VirtualDisk device of a virtual machine, and read VirtualDiskFlatVer2BackingInfo. all i have is the ManagedObjectReference to the the original virtual machine and the cloned virtual machine.

secondly can you tell me what is usually the size of linnked clone, i know vmware workstation it could be below 1MB.

Reply
0 Kudos
lamw
Community Manager
Community Manager

You need to traverse the VM's devices and locate it's VirtualDisk and figure out the backing from there - http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.vm.VirtualHardware.ht...

Regarding the growth of the delta disk, it's by default 16MB, though this is something that is configurable as an advanced ESX(i) option. I don't have the name of the property in front of me, but I'll update once I get into the office.

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

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".

sahmed24
Contributor
Contributor

i have found out the backing options, i dont understand how to compare the parent of clone to the original image. there is 'parent' property in backing object. this is how i get the backing object.

VirtualMachineConfigInfo configInfoParent = cb.getServiceUtil().GetDynamicProperty(vmRef, "config") as VirtualMachineConfigInfo;

VirtualDevice vDeviceParent = configInfoParent.hardware.device[9] as VirtualDevice;

VirtualDiskFlatVer2BackingInfo backingInfoParent = vDeviceParent.backing as VirtualDiskFlatVer2BackingInfo;

VirtualMachineConfigInfo configInfoClone = cb.getServiceUtil().GetDynamicProperty(vmRef, "config") as VirtualMachineConfigInfo;

VirtualDevice vDeviceClone = configInfoClone.hardware.device[9] as VirtualDevice;

VirtualDiskFlatVer2BackingInfo backingInfoClone = vDeviceClone.backing as VirtualDiskFlatVer2BackingInfo;

-


Regarding Size of my linked clone, my linked clone is of 2GB and it took 11 minutes, i dont remember changing setting of ESXi. this is how i create linked clone

ManagedObjectReference vmRef = service.FindByInventoryPath(sic.searchIndex, vmPath);

VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();

VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();

relocSpec.diskMoveType = "moveChildMostDiskBacking";

cloneSpec.location = relocSpec;

cloneSpec.powerOn = false;

cloneSpec.template = false;

ManagedObjectReference cloneTask

= service.CloneVMTask(vmRef, vmFolderRef, clonedName, cloneSpec);

. Am i creating the linked clone in correct way?

//Rizwan

Reply
0 Kudos
lamw
Community Manager
Community Manager

VMware has a Linked Clones WP - http://www.vmware.com/support/developer/vc-sdk/linked_vms_note.pdf that explains how Linked Clones work in vSphere and how to create them, I would recommend you take a look at this document.

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

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".

Reply
0 Kudos
sahmed24
Contributor
Contributor

i have read the document that you have mentioned. i have read almost everything related to creating linked clone in vSphere. the problem i have is that i can not find VirtualMachineRelocateDiskMoveOptions enumeration in my vimApi (Vim25Services2005.dll), VirtualMachineRelocateDiskMoveOptions. createNewChildDiskBacking is a string value, so i used that string value directly and assigned it to the diskMoveType (all that has been showed in my previous reply). post related to linked clone

I had two questions on my previous reply, both are open, can you look at them?

Reply
0 Kudos
lamw
Community Manager
Community Manager

Yea I just noticed the other thread and double checked it and it was you posting similar question. I would recommend you keep your replies in one thread so it's easy to follow and not spam multiple forums. It's hard for users to search and also had to keep track of.

I'm not a C# expert nor novice by any means, so I can't help you there. Ruben might be able to pull something up for you, so I would wait back on his reply.

Sorry can't be of more help. Though creating Linked Clones using the vSphere 4 API does in fact work. I've implemented this personally using the vSphere SDK for Perl and we also have an implementation using VI Java (Steve Jin's Java SDK version) and I've seen a PowerCLI implementation, so either it's a bug in the C# SDK or you're just missing something, in either case I don't know enough about C# to help out.

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

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".

Reply
0 Kudos