Clone virtual machine API
Clone virtual machine feature allows you to create new identical virtual machine. You can create copy of an existing virtual machine with same CPU, memory, availability priority, volumes, etc.
Clone VM API options
| Method | URI | Description |
|---|---|---|
|
POST |
|
The clone VM API creates a new identical virtual machine. |
|
GET |
|
Gets the progress of the clone VM operation. |
Clone VM API
This operation creates a clone of the virtual machine. This API takes mandatory attributes like name and network. Optional attributes are allowed in the request body. The response body contains the task URI that can be used to monitor the progress of clone VM operations.
- Response codes
-
- Normal response code: OK (200-202)
- Error response code: Bad Request (400), Forbidden (403), Not Found(404), Server Error (500)
- Request parameters
-
Table 2. Parameters in the request for cloning a VM Name Style Type Description namebody
string
New Clone VM name
networksbody
list of strings
List of SEA and SR-IOV networks.
availability_zonebody
list of strings
Optional. The availability zone from which to launch the server. When you provision resources, you specify from which availability zone you want your instance to be built.
key_namebody
string
Optional. Key pair name
block_device_mapping_v2body
Dict
Optional. Enables fine grained control of the block device mapping for an instance. This is typically used for booting servers from volumes.
flavorsbody
Dict
Optional. The flavor for your cloned instance. For example, compute, processing unit, RAM.
os:scheduler_hintsbody Dict Mandatory only when cloning a VM into a reservation. This parameter is required during deployment of any VM into reservation host groups. {"clone-vm": {"server": { "name": "clone-vm-name", -- mandatory value "networks": [ ---- mandatory { "uuid": "25082d7b-7408-4f13-857f-bbd2e5167cb2" }, { "sriov_port":{ "network_id":"bc6cfc3c-c561-4d57-bb43-75781d31afe6", "binding:profile":{ "delete_with_instance":1, "vnic_required_vfs":1, "capacity":0.02 }, "fixed_ips":[ { "subnet_id":"106496d6-7392-49c1-ad6b-5ca01b6e3bcb" } ] } } ], "metadata":{ --optional "primary_network":"f0345047-34b4-4f12-94e5-d53ee3ada553"}, "availability_zone": "Default Group" -- optional "key_name":"PUN", -- optional "block_device_mapping_v2": [{ -- optional "boot_index": "0", "uuid": "ac408821-c95a-448f-9292-73986c790911", "source_type": "image", "volume_size": "25", "destination_type": "volume", "delete_on_termination": true, "tag": "disk1", "disk_bus": "scsi"}] "flavor": { -- optional "ram": 4096, "vcpus": 1, "disk": 0, "extra_specs": { "powervm:max_proc_units": "1", "powervm:shared_weight": "128", "powervm:min_mem": "2048", "powervm:max_mem": "6144", "powervm:uncapped": "true", "powervm:proc_units": "0.5", "powervm:dedicated_proc": "false", "powervm:max_vcpu": "1", "powervm:availability_priority": "127", "powervm:min_proc_units": "0.1", "powervm:min_vcpu": "1", "powervm:storage_connectivity_group": "e846a4c9-235e-44e8-b805-c6f40eb2fd9d" }}, }, "os:scheduler_hints": { -- only when cloning VM into reservation host group "reservation": "<reservation ID>" }}} - Response body
-
Table 3. Parameters in the response for cloning a VM Name Style Type Description task_uribody
strings
For long running instance clone VM API operations, the link to the task URI is returned that can be used to monitor the progress of clone VM operations.
{ { "clone-vm":{ "task_uri":"https:<PowerVC IP>:8774/v2.1/f6920a4217cd42ba85470a77e12a7d6f/servers/get_progress?action=clone-vm&task_id=e5c2e22b-6165-425f-b5f4-0514b27d677c" } }
Get progress of clone VMs
This operation fetches progress of clone operation of the virtual machine. This API does not take any request body. The response body contains details such as progress of a task, details of cloned VM IDs (server id), whether task is completed successfully or failed.
- Response codes
-
- Normal response code: OK (200)
- Error response code: Unauthorized (401)
- Response body
-
Table 4. Parameters in the response for clone VM Name Style Type Description flow_detailsbody
string
Fetches status details of the clone virtual machine.
completed_tasksbody
string
Provides the list of completed tasks along with the status.
pending_tasksbody
string
Provides the list of pending tasks along with the status.
test_resultbody
string
Provide the new cloned virtual machine information such as server ID with additional information.
{ "details": { "flow_details": { "CloneVMTask": "SUCCESS" }, "progress": 100, "completed_tasks": { "clone_vm_deployff348d5f": "SUCCESS", "clone_volumesdf5328a5": "SUCCESS", "cleanup_cloneVM_in_errora837a653": "SUCCESS" }, "pending_tasks": {}, "test_result": { "server": { "id": "c884ba6f-6e7c-4ac7-8fce-35021cd32c7b", "links": [ { "rel": "self", "href": "https://<PowerVC IP>:8774/v2.1/02b2f9fbb64844afbb9f00352a822117/servers/c884ba6f-6e7c-4ac7-8fce-35021cd32c7b" }, { "rel": "bookmark", "href": "https://<PowerVC IP>:8774/02b2f9fbb64844afbb9f00352a822117/servers/c884ba6f-6e7c-4ac7-8fce-35021cd32c7b" } ], "OS-DCF:diskConfig": "MANUAL", "security_groups": [ { "name": "default" } ] } } } }