Luke747
Contributor
Contributor

VCenter API - Set Guest Customization

Hello. I have a bit of a problem with vCenter API trying to set a customization on a machine (vm/guest/customization API call). I create the machine via the API and set sysprep customization there. Then I let it run for 10 minutes to give customization time to finish and turn it off via API as well. After this, I wish to set IP configuration on the machine using the API, but always end up with the 400, not allowed in current state error. This makes little sense to me as the machine is in powered off state (which I can confirm by calling GET on vm/power API endpoint) and I should only be getting this error if it is not powered off.

Here are 2 slightly different configs I tried to pass in, for completeness:

{
"spec": {
"configuration_spec": {},
"global_DNS_settings": {
"dns_servers": [
"10.10.10.10",
"10.10.10.13"
],
"dns_suffix_list": []
},
"interfaces": {
"adapter": {
"ipv4": {
"type": "STATIC",
"ip_address": "10.142.142.142",
"prefix": 24,
"gateways": [
"10.142.142.1"
]
},
"ipv6": {
"type": "DHCP"
},
"windows": {
"dns_servers": [
"10.10.10.10",
"10.10.10.13"
]
}
}
}
}
}




{
"spec": {
"configuration_spec": {},
"global_DNS_settings": {},
"interfaces": {
"adapter": {
"ipv4": {
"type": "STATIC",
"ip_address": "10.142.142.142",
"prefix": 24,
"gateways": [
"10.142.142.1"
]
},
"ipv6": {
"type": "DHCP"
},
"windows": {
"dns_servers": [
"10.10.10.10",
"10.10.10.13"
]
}
}
}
}
}

Any idea why this is failing would be appreciated, as it does not make much sense to me.
VCenter version 7.0.3

Reply
0 Kudos