VMware {code} Community
Peconi
Contributor
Contributor
Jump to solution

Help Please: CloneVM_Task gets created but fails with: Operation not supported on the object

Someone please help with this, I'm breaking my head with this for 5 hours now.

I submit CloneVM_Task with the following XML (which returns a task id back http://i.e. the request was accepted in this format):

<CloneVM_Task xmlns="urn:vim25">

<_this type="VirtualMachine">vm-938</_this>

<folder type="Folder">group-d1</folder>

<name>1_UBUNTU 804</name>

<spec>

<location>

<datastore type="Datastore">datastore-683</datastore>

<pool type="ResourcePool">resgroup-57</pool>

</location>

<template>0</template>

<powerOn>1</powerOn>

<config>

<memoryMB>1024</memoryMB>

<numCPUs>1</numCPUs>

</config>

</spec>

</CloneVM_Task>

However, the task itself returns an error saying: The operation is not supported on the object.

Does anyone know what this is all about?

The info I am sending should be 100% correct:

- vm_id: the VM ID of the VM TEMPLATE I am cloning (100% certain it's correct)

- folder: the rootFolder returned by ServicContent

- datastore: the ONLY datastore I have to store VM's on. When I query info on this datastore it clearly shows that it's accessible and multipleHostAccess = true as well

- resourcePool: I got this info when querying my ComputeResource properties. I have 1 cluster and it's resourcePool value is what I set.

I really have NO idea what is going wrong here... The CloneVM_Task creates a task - but that's where it all falls apart.

PLEASE HELP!

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager
Jump to solution

Yea, you should not be using the rootFolder, that is just the root folder to the entire vCenter inventory. A default vmFolder will always exists whether or not you have additional folders, and that is the one you're referencing to. By default, you should query for this, in case one day you do decide to create folders versus hard coding the moref ID. The ID's are numerical and probably by default that folder gets that value by iteration, but again, I would recommend querying for it versus hard coding it.

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

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

Reply
0 Kudos
6 Replies
lamw
Community Manager
Community Manager
Jump to solution

Are you performing the clone operation against vCenter or ESX(i) host? If it's the latter, this operation is not supported on individual host, you need to perform it against vCenter.

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

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
Peconi
Contributor
Contributor
Jump to solution

It was against vCenter Server...

I actually got it working finally... It turns out I needed to put <folder type="Folder">group-v22</folder>.

Would you know what's the signifcance of this special "group-v22" folder? Is it like hard coded Folder MOR where all VM's live (unless they're in subfolders)?

The way I got this info is that both my production-to-be setup and my development-setup have SAME folder ID... It's just too much of a coincidence.

If you can answer this for me, you're the man! Smiley Happy

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

Yea, you should not be using the rootFolder, that is just the root folder to the entire vCenter inventory. A default vmFolder will always exists whether or not you have additional folders, and that is the one you're referencing to. By default, you should query for this, in case one day you do decide to create folders versus hard coding the moref ID. The ID's are numerical and probably by default that folder gets that value by iteration, but again, I would recommend querying for it versus hard coding it.

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

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
Peconi
Contributor
Contributor
Jump to solution

How does one query for this specific type of folders exactly?

It seems I can store VM's in some but not in other?

Tnx

Reply
0 Kudos
lamw
Community Manager
Community Manager
Jump to solution

One easy method is to get the Datacenter view (http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.Datacenter.html#field_detail) which includes the 4 types of folders that must always exists:

datastoreFolder

hostFolder

networkFolder

vmFolder

VM's can only be registered to a vmFolder, so from here you'll have access to the root VM folder for any given Datacenter and you'll need to traverse it if you need to assign a VM to a specific folder if you're on vCenter.

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

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

Peconi
Contributor
Contributor
Jump to solution

Awesome ! THANKS!

Reply
0 Kudos