你好,
登录prism后,我打开API参考和登录凭据。
然后进入“VMs——>Clone Section”,通过API克隆虚拟机。
我通过两个方法得到虚拟机uuid,我认为我得到相同的uuid
1)ssh到CVM,并给出“acli vm.list”
2)当控制台url,使用uuid= " string "
两者具有相同的uuid。所以我曾经通过api克隆虚拟机,但我得到错误如下:
给定的输入无效。虚拟机UUID不能指定,使用幂等标识符获取UUID
”
我也尝试得到现有的和创建新的幂等标识符,但在克隆虚拟机执行它,它给出错误“uuid不存在”。
请建议我,我认为uuid是正确的,但什么导致了错误。
请帮助。
最佳答案AnishWalia20
\u00a0<\/p>
Using the above POST method you can get the idempotence identifier<\/strong> of the VM.\u00a0<\/p> Also as the above documentation suggests\u00a0It is mandatory to provide the count for how many identifiers we need and the lifetime until we can use it in the POST \u201c\/idempotence_identifiers<\/strong>\u201d\u00a0API.\u00a0<\/p> Below is an example with CURL: anish.singhwalia@C02XF4HA:~$ curl -k -X POST --header \"Content-Type: application\/json\" --header\u00a0<\/p> \"Accept: application\/json\" --header \"Authorization: Basic AYWtrr7y23TnV0YW5peC8\" -d \"{ \u00a0<\/p> Now we can check the above task details\u00a0and identify the UUID of the cloned VM: \u00a0<\/p> I hope the above clarifies the procedure and helps you\u00a0 Let me know if you need anything else.<\/p> \u00a0<\/p>","className":"post__content__best_answer"}">
\u00a0<\/p>
\\\"count\\\": 1,
\\\"valid_duration_in_minutes\\\": 527040
}\" \"https:\/\/10.136.107.69:9440\/api\/nutanix\/v3\/idempotence_identifiers\"
{\"client_identifier\": null, \"count\": 1, \"expiration_time\": \"2020-12-23T07:59:57Z\", \"uuid_list\": [\"a1d6b81b-a76c-495c-9a71-508167f810dd<\/strong>\"]}<\/p>
We can use now the returned idempotence identifier(a1d6b81b-a76c-495c-9a71-508167f810dd<\/strong>) in the \/clone API<\/strong>
anish.singhwalia@C02XF4HA::~$ curl -k -X POST --header \"Content-Type: application\/json\" --header \"Accept: application\/json\" --header \"Authorization: Basic AYWtrr7y23TnV0YW5peC8\" -d \"{
\\\"metadata\\\": {
\\\"uuid\\\": \\\"a1d6b81b-a76c-495c-9a71-508167f810dd<\/strong>\\\"
}
}\" \"https:\/\/10.136.107.69:9440\/api\/nutanix\/v3\/vms\/9276242d-34r1-69f3-dfe8-5d1cb15569k2\/clone<\/a>\"
{\"task_uuid\": \"9bb26a3e-18cf-4fea-941a-cfe5e542c076<\/strong>\"}<\/p>
anish.singhwalia@C02XF4HA:~$ curl -k -X GET --header \"Accept: application\/json\" --header \"Authorization: Basic AYWtrr7y23TnV0YW5peC8\" \"https:\/\/10.136.10769:9440\/api\/nutanix\/v3\/tasks\/9bb26a3e-18cf-4fea-941a-cfe5e542c076<\/a>\"
{\"status\": \"SUCCEEDED\", \"last_update_time\": \"2019-12-23T08:01:31Z\", \"logical_timestamp\": 2, \"entity_reference_list\": [{\"kind\": \"vm\", \"uuid\": \"a1d6b81b-a76c-495c-9a71-508167f810dd<\/strong>\"}], \"start_time\": \"2019-12-23T08:01:18Z\", \"creation_time\": \"2019-12-23T08:01:18Z\", \"start_time_usecs\": 1577088078927590, \"cluster_reference\": {\"kind\": \"cluster\", \"uuid\": \"r4fd3d69-3df4-5g3d-448e-6b9312655365<\/strong>\"}, \"subtask_reference_list\": [], \"completion_time\": \"2019-12-23T08:01:31Z\", \"creation_time_usecs\": 1577088078874113, \"progress_message\": \"//www.jhbzcj.com/next/prism-for-infra-and-it-ops-26/\", \"operation_type\": \"ProcessVmClone\", \"completion_time_usecs\": 1577088091347015, \"percentage_complete\": 100, \"api_version\": \"3.1\", \"uuid\": \"9bb26a3e-18cf-4fea-941a-cfe5e542c076<\/strong>\"}<\/p>