Quantcast
Channel: VMware Communities : Discussion List - vSphere Client SDK
Viewing all articles
Browse latest Browse all 2218

Unable to apply profile to a VM programmatically at the time of configure and clone of a VM.

$
0
0

We are encountering an issue while asigning policy to a VM using vSphere SDK.

Issue: at the time of un-registering a VM the VM loses its profile, while registering it again we wish to reapply the policy.

As per our understanding this can be done using re-configuring the VM. We tried to apply the policy to the VM at the time of reconfiguration using the property VirtualMachineDefinedProfileSpec.

https://www.vmware.com/support/developer/converter-sdk/conv60_apireference/vim.vm.DefinedProfileSpec.html#field_detail

 

Please find the code snippet for the same below:

 

l_VMConfSpec --> configuration specs for VM config specification.

ns2__VirtualMachineDefinedProfileSpec *pVDevProfileConfSpec2 = soap_new_ns2__VirtualMachineDefinedProfileSpec(m_vim.soap, -1);

pVDevProfileConfSpec2->profileData = soap_new_ns2__VirtualMachineProfileRawData(m_vim.soap, -1);

pVDevProfileConfSpec2->profileId = m_wsStoragePolicyId; //unique id of profile

l_VMConfSpec.vmProfile.push_back(pVDevProfileConfSpec2);

 

No error is returned from VMware at the time of reconfiguration.

 

 

Is this the correct way to assign profile to a VM?


tianhao64


Viewing all articles
Browse latest Browse all 2218

Trending Articles



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