vsphere6.5 REST API使用其他参数部署ovf

时间:2018-09-25 15:15:16

标签: rest api vsphere

我想使用vSphere 6.5 REST api部署和自定义VM。 https://vdc-repo.vmware.com/vmwb-repository/dcr-public/1cd28284-3b72-4885-9e31-d1c6d9e26686/71ef7304-a6c9-43b3-a3cd-868b2c236c81/doc/operations/com/vmware/vcenter/ovf/library_item.deploy-operation.html

以下uri可以正常运行而无需自定义虚拟机。

  POST https://myserver/rest/com/vmware/vcenter/ovf/library-item/id:6fbf5ec7-9954-4580-82ee?~action=deploy
  BODY
{
"deployment_spec": {
    "accept_all_EULA": true,
    "default_datastore_id": "datastore-334",
    "name": "deploytest1",
    "storage_provisioning": "thin"
},
"target": {
    "folder_id": "group-v881",
    "resource_pool_id": "resgroup-578"
}}

我想自定义网络设置和域。以下身体结构不起作用,我想念什么?

 {
 "deployment_spec": {
    "accept_all_EULA": true,
    "default_datastore_id": "datastore-334",
    "name": "deployvm1",
    "storage_provisioning": "eagerZeroedThick",
    "network_mappings": [
        {
            "key": "1",
            "value": "network-899"
        }
    ],
    "additional_parameters": [
     {
        "@class": "com.vmware.vcenter.ovf.property_params",
         "properties": 
            [
                {
                    "instance_id": "",
                    "class_id": "",
                    "description": "The gateway IP for this virtual appliance.",
                    "id": "gateway",
                    "label": "Default Gateway Address",
                    "category": "LAN",
                    "type": "ip",
                    "value": "10.1.2.1"
                },
                {
                    "instance_id": "",
                    "class_id": "",
                    "description": "The gateway IP for this virtual appliance.",
                    "id": "network",
                    "label": "Network IP",
                    "category": "LAN",
                    "type": "ip",
                    "value": "10.1.2.1"
                },
                {
                    "instance_id": "",
                    "class_id": "",
                    "description": "The gateway IP for this virtual appliance.",
                    "id": "network",
                    "label": "Netmask",
                    "category": "LAN",
                    "type": "ip",
                    "value": "255.255.0.0"
                }

            ],
        "type": "PropertyParams"
    }
]
},
"target": {
    "folder_id": "group-v881",
    "resource_pool_id": "resgroup-1576"
}

}

我正在寻找示例或任何帮助。谢谢

0 个答案:

没有答案