djurgens
Contributor
Contributor

Having some trouble getting Customization.set() to work to customize a vm.

I'm using the Vsphere Automation Java SDK and I'm trying to get Customization of a VM to work. I'll include the spec and the enclosed customizationSpec in case there is something that isn't quite right. I keep getting an exception that the spec wasn't found. These are also the steps that I followed after creating the CustomizationSpec, any help woulld be appreciated.

Customization customizationService = stubFactory.createStub(Customization.class, sessionStubConfig);
CustomizationTypes.SetSpec setSpec = new CustomizationTypes.SetSpec.Builder().setSpec(customizationSpec).
setName(this.requestedVirtualmachineName).
build();
System.out.println("CustomizationSpec="+customizationSpec);
System.out.println("SetSpec ="+setSpec);
customizationService.set(this.vmId, setSpec);



SetSpec =SetSpec (com.vmware.vcenter.vm.guest.customization.set_spec) => {
name = cli31Q426742_ddj0916lin75u01,
spec = CustomizationSpec (com.vmware.vcenter.guest.customization_spec) => {
configurationSpec = ConfigurationSpec (com.vmware.vcenter.guest.configuration_spec) => {
windowsConfig = <null>,
linuxConfig = LinuxConfiguration (com.vmware.vcenter.guest.linux_configuration) => {
hostname = HostnameGenerator (com.vmware.vcenter.guest.hostname_generator) => {
type = FIXED,
fixedName = ddj0916lin75u01,
prefix = <null>
},
domain = q42.customer.com,
timeZone = Etc/UTC,
scriptText = <null>
},
cloudConfig = <null>
},
globalDNSSettings = GlobalDNSSettings (com.vmware.vcenter.guest.global_DNS_settings) => {
dnsSuffixList = [],
dnsServers = [146.89.138.133, 146.89.138.134, 146.89.139.10, 146.89.139.11]
},
interfaces = [AdapterMapping (com.vmware.vcenter.guest.adapter_mapping) => {
macAddress = <null>,
adapter = IPSettings (com.vmware.vcenter.guest.IP_settings) => {
ipv4 = Ipv4 (com.vmware.vcenter.guest.ipv4) => {
type = STATIC,
ipAddress = 10.20.29.19,
prefix = 26,
gateways = [10.20.29.1]
},
ipv6 = <null>,
windows = WindowsNetworkAdapterSettings (com.vmware.vcenter.guest.windows_network_adapter_settings) => {
dnsServers = [],
dnsDomain = q42.customer.com,
winsServers = <null>,
netBIOSMode = ENABLE
}
}
}, AdapterMapping (com.vmware.vcenter.guest.adapter_mapping) => {
macAddress = <null>,
adapter = IPSettings (com.vmware.vcenter.guest.IP_settings) => {
ipv4 = Ipv4 (com.vmware.vcenter.guest.ipv4) => {
type = STATIC,
ipAddress = 172.18.36.15,
prefix = 26,
gateways = []
},
ipv6 = <null>,
windows = WindowsNetworkAdapterSettings (com.vmware.vcenter.guest.windows_network_adapter_settings) => {
dnsServers = [],
dnsDomain = q42.adm.ehn.ssm.sdc.gts.ibm.com,
winsServers = <null>,
netBIOSMode = ENABLE
}
}
}, AdapterMapping (com.vmware.vcenter.guest.adapter_mapping) => {
macAddress = <null>,
adapter = IPSettings (com.vmware.vcenter.guest.IP_settings) => {
ipv4 = Ipv4 (com.vmware.vcenter.guest.ipv4) => {
type = STATIC,
ipAddress = 172.18.164.15,
prefix = 26,
gateways = []
},
ipv6 = <null>,
windows = WindowsNetworkAdapterSettings (com.vmware.vcenter.guest.windows_network_adapter_settings) => {
dnsServers = [],
dnsDomain = q42.ibr.ehn.ssm.sdc.gts.ibm.com,
winsServers = <null>,
netBIOSMode = ENABLE
}
}
}]
}
}

0 Kudos
1 Reply
djurgens
Contributor
Contributor

Here is the exception that I received as a resuilt of the set() request:
com.vmware.vapi.std.errors.NotFound: NotFound (com.vmware.vapi.std.errors.not_found) => {
messages = [LocalizableMessage (com.vmware.vapi.std.localizable_message) => {
id = com.vmware.api.vcenter.guest.customization_spec.not_found,
defaultMessage = CustomizationSpec with identifier 'cli31Q426742_ddj0916lin75u01' does not exist.,
args = [cli31Q426742_ddj0916lin75u01],
params = <null>,
localized = <null>
}],
data = <null>,
errorType = NOT_FOUND
}

0 Kudos