|
| 1 | +--- |
| 2 | +--- |
| 3 | + |
| 4 | +### Reconfigure a VM - Set Memory and CPUs |
| 5 | + |
| 6 | +If a VM is running it might not be possible to change CPUs and/or memory. Refer to the `cpu_hot_add_enabled`, `cpu_hot_remove_enabled`, and `memory_hot_add_enabled` properties of the VM to see if what you would like to change is possible. |
| 7 | + |
| 8 | +#### Request: |
| 9 | + |
| 10 | + POST /api/requests |
| 11 | + |
| 12 | +``` json |
| 13 | +{ |
| 14 | + "action" : "create", |
| 15 | + "options": { |
| 16 | + "request_type": "vm_reconfigure", |
| 17 | + "src_ids": ["2"], |
| 18 | + "vm_memory": "8192", |
| 19 | + "number_of_cpus": 2, |
| 20 | + "cores_per_socket": 2 |
| 21 | + } |
| 22 | +} |
| 23 | +``` |
| 24 | + |
| 25 | +#### Response: |
| 26 | +``` json |
| 27 | +{ |
| 28 | + "results": [ |
| 29 | + { |
| 30 | + "href": "http://localhost:3000/api/requests/5", |
| 31 | + "id": "5", |
| 32 | + "description": "VM Reconfigure for: VM1 - Memory: 8192 MB", |
| 33 | + "approval_state": "approved", |
| 34 | + "type": "VmReconfigureRequest", |
| 35 | + "created_on": "2021-12-15T19:25:41Z", |
| 36 | + "updated_on": "2021-12-15T19:25:41Z", |
| 37 | + "requester_id": "1", |
| 38 | + "requester_name": "Administrator", |
| 39 | + "request_type": "vm_reconfigure", |
| 40 | + "request_state": "pending", |
| 41 | + "message": "VM Reconfigure - Request Created", |
| 42 | + "status": "Ok", |
| 43 | + "options": { |
| 44 | + "src_ids": [ |
| 45 | + "2" |
| 46 | + ], |
| 47 | + "request_type": "vm_reconfigure", |
| 48 | + "vm_memory": "8192" |
| 49 | + }, |
| 50 | + "userid": "admin", |
| 51 | + "tenant_id": "1", |
| 52 | + "process": true, |
| 53 | + "initiated_by": "user" |
| 54 | + } |
| 55 | + ] |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +### Reconfigure a VM - Add a disk |
| 60 | + |
| 61 | +#### Request: |
| 62 | + |
| 63 | + POST /api/requests |
| 64 | + |
| 65 | +``` json |
| 66 | +{ |
| 67 | + "action" : "create", |
| 68 | + "options": { |
| 69 | + "request_type": "vm_reconfigure", |
| 70 | + "src_ids": ["2"], |
| 71 | + "disk_add": [ |
| 72 | + { |
| 73 | + "new_controller_type": "VirtualLsiLogicController", |
| 74 | + "thin_provisioned": true, |
| 75 | + "disk_size_in_mb": 10240, |
| 76 | + } |
| 77 | + ] |
| 78 | + } |
| 79 | +} |
| 80 | +``` |
| 81 | + |
| 82 | +The new_controller_type parameter is optional and only used if there are no more open ports on the existing controllers and a new one has to be added. |
| 83 | + |
| 84 | +The valid options are: |
| 85 | +* `VirtualLsiLogicController` |
| 86 | +* `ParaVirtualSCSIController` |
| 87 | +* `VirtualBusLogicController` |
| 88 | +* `VirtualLsiLogicSASController` |
| 89 | + |
| 90 | +### Reconfigure a VM - Remove a disk |
| 91 | + |
| 92 | +#### Request: |
| 93 | + |
| 94 | + POST /api/requests |
| 95 | + |
| 96 | +``` json |
| 97 | +{ |
| 98 | + "action" : "create", |
| 99 | + "options": { |
| 100 | + "request_type": "vm_reconfigure", |
| 101 | + "src_ids": ["2"], |
| 102 | + "disk_remove": [ |
| 103 | + { |
| 104 | + "disk_name": "[Datastore 0] vm/vm_1.vmdk", |
| 105 | + "delete_backing": true |
| 106 | + } |
| 107 | + ] |
| 108 | + } |
| 109 | +} |
| 110 | +``` |
| 111 | + |
| 112 | +You can retrieve the disk_name from the disk's `filename` property |
| 113 | +Delete backing is optional and defaults to true. |
| 114 | + |
| 115 | +### Reconfigure a VM - Resize a disk |
| 116 | + |
| 117 | +#### Request: |
| 118 | + |
| 119 | + POST /api/requests |
| 120 | + |
| 121 | +``` json |
| 122 | +{ |
| 123 | + "action" : "create", |
| 124 | + "options": { |
| 125 | + "request_type": "vm_reconfigure", |
| 126 | + "src_ids": ["2"], |
| 127 | + "disk_remove": [ |
| 128 | + { |
| 129 | + "disk_name": "[Datastore 0] vm/vm_1.vmdk", |
| 130 | + "disk_size_in_mb": 20480 |
| 131 | + } |
| 132 | + ] |
| 133 | + } |
| 134 | +} |
| 135 | +``` |
| 136 | + |
| 137 | +You can retrieve the disk_name from the disk's `filename` property |
| 138 | +Decreasing a disk's size is not supported |
0 commit comments