我正在使用VMWare vCenter REST API从OVF库项目部署新的虚拟机。该API的一部分允许使用extra_paramaters,但我无法使其正常运行。具体来说,我想为自定义OVF模板属性设置PropertyParams,例如IP,gtw,DNS,root_pwd ...
此帖子连续PropertyParams when deploying VM from OVF,但@Thomas_Ferriez示例不起作用。
您能否提供更多信息?它在我的环境中不起作用(已部署VM,但未设置自定义)。如何设置IP,DNS,root_pwd? OVF是否需要vApp配置?
跟随github链接无济于事。 https://github.com/vmware/vsphere-automation-sdk-rest/issues/18
过滤器请求输出为:
REQ:/ rest / com / vmware / vcenter / ovf / library-item / id:7181de7c-8903-4e62-a775-c079878bd98e?〜action = filter
返回:
{
"value": {
"annotation": "",
"storage_groups": [],
"name": "vm-test",
"EULAs": [],
"networks": [
"mynet"
],
"additional_params": [
{
"@class": "com.vmware.vcenter.ovf.ovf_params",
"approximate_sparse_deployment_size": -1,
"variable_disk_size": false,
"approximate_download_size": -1,
"type": "SizeParams",
"approximate_flat_deployment_size": 19327352832
},
{
"@class": "com.vmware.vcenter.ovf.ovf_params",
"supported_allocation_scheme": [
"OVF_ENVIRONMENT"
],
"supported_ip_protocol": [
"IPV4"
],
"supported_ip_allocation_policy": [
"STATIC_MANUAL"
],
"type": "IpAllocationParams",
"ip_allocation_policy": "STATIC_MANUAL",
"ip_protocol": "IPV4"
}
]
部署请求(用于部署VM但不对其进行自定义)是:
REQ:/ rest / com / vmware / vcenter / ovf / library-item / id:7181de7c-8903-4e62-a775-c079878bd98e?〜action = deploy
返回: {“ deployment_spec”:
{
"accept_all_EULA": true,
"name": "clientok2",
"default_datastore_id": "datastore-13",
"additional_parameters":
[
{
"@class": "com.vmware.vcenter.ovf.property_params",
"properties":
[ {
"instance_id": "",
"class_id": "",
"description": "default gateway",
"id": "gateway",
"label": " Default Gateway Address ",
"category": "LAN",
"type": "ip",
"value": "10.10.10.1",
"ui_optional": true
}
],
"type": "PropertyParams"
}
]
},
"target" : {
"resource_pool_id" : "resgroup-1022",
"folder_id" : "group-v4",
"host_id" : "host-10"
}
] }}
返回很好,但是未在VM上设置自定义:
{
"value": {
"resource_id": {
"id": "vm-2374",
"type": "VirtualMachine"
},
"error": {
"warnings": [],
"information": [],
"errors": []
},
"succeeded": true
}
}
非常感谢您的回答!