Clone vCenter VS
To clone a virtual server, use the following request:
1
2
| POST /virtual_machines/:virtual_machine_id/clone.xml
POST /virtual_machines/:virtual_machine_id/clone.json
|
XML Request Example
1
| curl -i -X POST -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:password -d '<!--?xml version="1.0" encoding="UTF-8" ?--><virtual_machine><label>xml-in.vcenter</label><hostname>invcenter</hostname><initial_root_password>qweasdZXC</initial_root_password><initial_root_password_confirmation>qweasdZXC</initial_root_password_confirmation><encrypt_password>false</encrypt_password><initial_root_password_encryption_key>123123</initial_root_password_encryption_key><initial_root_password_encryption_key_confirmation>123123</initial_root_password_encryption_key_confirmation></virtual_machine>' --url http://onapp/virtual_machines/:id/clone.xml
|
JSON Request Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| curl -i -X POST -H 'Accept: application/json' -H 'Content-type: application/json' -u user:password -d '
{
"virtual_machine": {
"label": "noenc-nopass-in.vcenter",
"hostname": "invcenter",
"initial_root_password": "",
"initial_root_password_confirmation": "",
"encrypt_password": "false",
"initial_root_password_encryption_key": "",
"initial_root_password_encryption_key_confirmation": ""
}
"virtual_machine": {
"label": "Clone - vm",
"hostname": "clonedvm",
"initial_root_password": "123123",
"initial_root_password_confirmation": "123123",
"encrypt_password": true,
"initial_root_password_encryption_key": "key",
"initial_root_password_encryption_key_confirmation": "key"
}
}'
--url http://onapp.test/virtual_machines/12/clone.json
|
Where:
label - the label of cloned VS
hostname - hostname of cloned VS
initial_root_password - password for cloned VS
initial_root_password_confirmation - confirmation of a password for cloned VS
encrypt_password - true is password is encrypted; otherwise, false
initial_root_password_encryption_key - keyword to be used to decrypt the password
initial_root_password_encryption_key_confirmation - confirmation of a keyword to be used to decrypt the password
Page History
v. 6.8
Added the following parameters:
- label
- hostname
- initial_root_password
- encrypt_password
- initial_root_password_encryption_key
- initial_root_password_encryption_key_confirmation