VMware {code} Community
tFable
Contributor
Contributor

Managed Object Browser: How to use Data Object with no properties (Instant Clone Guest OS Customizat

Hi, All,

I have been fighting with this for a couple of days now and I was hoping I could get some help from the community.

I am attempting to test out Guest Customizations for Instant Clones. More specifically, I am trying to construct the "spec" of VirtualMachineGuestCustomizationManager.CustomizeGuest_Task. I am referencing the properties of the spec from here

The only avenue that I (barely) know how to use to call the SOAP API's is via vCenter's Managed Object Browser. While I know how to do simple stuff with simple objects, I am struggling to construct the correct XML format for this.

More specifically, I do not know how to construct the "ip" section to allow for DHCP configuration.

I can see that that ip is a CustomizationIpGenerator type that this data object is, in turn, is extended by the  CustomizationDhcpIpGenerator. For the life of me, though, I cannot figure out how to construct the correct xml so it works in the Managed Object Browser.

I'm just trying to proof this works before we put in more serious work to add instant clones customizations to our workflow.

Here's the xml for the "spec" of the CustomizeGuest_Task

<spec>
<!-- optional -->
<options>
</options>
<identity>
<hostname>
<name>hostname1/name>
</hostname>
</identity>
<globalIPSettings>
</globalIPSettings>
<!-- optional -->
<!-- array start -->
<!-- optional -->
<nicSettingMap>
<!-- optional -->
<adapter>
<ip>
</ip>
</adapter>
</nicSettingMap>
<!-- array end -->
</spec>

I really appreciate any help! Thanks!
t
Labels (2)
Reply
0 Kudos
1 Reply
doskiran
Enthusiast
Enthusiast

Please check this sample code,

Java Code:

 

CustomizationAdapterMapping cAdapterMapping = new CustomizationAdapterMapping();
CustomizationIPSettings cIPSettings = new CustomizationIPSettings();
CustomizationDhcpIpGenerator cDhcpIPGenerator = new CustomizationDhcpIpGenerator();
cIPSettings.setIp(cDhcpIPGenerator);
cIPSettings.setNetBIOS(CustomizationNetBIOSMode.enableNetBIOSViaDhcp);
cAdapterMapping.setAdapter(cIPSettings);
CustomizationAdapterMapping[] cAdapterMappingArr = new CustomizationAdapterMapping[1];
cAdapterMappingArr[0] = cAdapterMapping;

 

Spec:

 

nicSettingMap = (vim.vm.customization.AdapterMapping) [
-->       (vim.vm.customization.AdapterMapping) {
-->          macAddress = <unset>, 
-->          adapter = (vim.vm.customization.IPSettings) {
-->             ip = (vim.vm.customization.DhcpIpGenerator) {
-->             }, 
-->             subnetMask = <unset>, 
-->             gateway = <unset>, 
-->             ipV6Spec = (vim.vm.customization.IPSettings.IpV6AddressSpec) null, 
-->             dnsServerList = <unset>, 
-->             dnsDomain = <unset>, 
-->             primaryWINS = <unset>, 
-->             secondaryWINS = <unset>, 
-->             netBIOS = <unset>
-->          }
-->       }
--> ]

 

 

 

 

 

 

Tags (1)
Reply
0 Kudos