3.5. Managing virtual machines

3.5.1. vinfra service compute server create

Create a new virtual machine:

usage: vinfra service compute server create [--description <description>]
                                            [--metadata <metadata>]
                                            [--user-data <user-data>]
                                            [--key-name <key-name>]
                                            [--config-drive] [--count <count>]
                                            [--ha-enabled {true,false}]
                                            [--placements <placements>]
                                            --network <id=id[,key=value,...]>
                                            --volume <source=source[,key=value,...]>
                                            --flavor <flavor> <server-name>
--description <description>
Virtual machine description
--metadata <metadata>
Virtual machine metadata
--user-data <user-data>
User data file
--key-name <key-name>
Key pair to inject
--config-drive
Use an ephemeral drive
--count <count>
If count is specified and greater than 1, the name argument is treated as a naming pattern.
--ha-enabled {true,false}
Enable or disable HA for the virtual machine.
--placements <placements>
Names or IDs of placements to add the virtual machine to.
--network <id=id[,key=value,...]>

Create a virtual machine with a specified network. Specify this option multiple times to create multiple networks.

  • id: attach network interface to a specified network (ID or name)
  • comma-separated key=value pairs with keys (optional):
    • mac: MAC address for network interface
    • fixed-ip: fixed IP address for network interface
    • spoofing-protection: enable or disable spoofing protection for network interface (on or off)
--volume <source=source[,key=value,...]>

Create a virtual machine with a specified volume. Specify this option multiple times to create multiple volumes.

  • source: source type (volume, image, snapshot, or blank)
  • comma-separated key=value pairs with keys (optional):
    • id: resource ID or name for the specified source type (required for source types volume, image, and snapshot)
    • size: block device size, in gigabytes (required for source types image and blank)
    • boot-index: block device boot index (required for multiple volumes with source type volume)
    • bus: block device controller type (scsi)
    • type: block device type (disk or cdrom)
    • rm: remove block device on virtual machine termination (yes or no)
    • storage-policy: block device storage policy
--flavor <flavor>
Flavor ID or name
<server-name>
A new name for the virtual machine

Example:

# vinfra service compute server create myvm \
--network id=private,fixed-ip=192.168.128.100 \
--volume source=image,id=cirros,size=1 --flavor tiny
+--------------+--------------------------------------+
| Field        | Value                                |
+--------------+--------------------------------------+
| config_drive |                                      |
| created      | 2019-05-29T11:24:04Z                 |
| description  |                                      |
| flavor       | disk: 0                              |
|              | ephemeral: 0                         |
|              | extra_specs: {}                      |
|              | original_name: tiny                  |
|              | ram: 512                             |
|              | swap: 0                              |
|              | vcpus: 1                             |
| ha_enabled   | True                                 |
| host         |                                      |
| id           | 8cd29296-8bee-4efb-828d-0e522d816c6e |
| key_name     |                                      |
| metadata     | {}                                   |
| name         | myvm                                 |
| networks     | []                                   |
| power_state  | NOSTATE                              |
| project_id   | b4267de6fd0c442da99542cd20f5932c     |
| status       | BUILD                                |
| task_state   | scheduling                           |
| updated      | 2019-05-29T11:24:21Z                 |
| user_data    |                                      |
| vm_state     | building                             |
| volumes      | []                                   |
+--------------+--------------------------------------+

This command creates a virtual machine myvm based on the default Cirros image and the flavor tiny, connects it to the network private with the fixed IP address 192.168.128.100, and enables HA for it.

3.5.2. vinfra service compute server list

List virtual machines:

usage: vinfra service compute server list [--long] [--limit <num>]
                                          [--marker <server>] [--name <name>]
                                          [--id <id>] [--project <project>]
                                          [--status <status>]
                                          [--task-status <task-status>]
                                          [--host <hostname>]
                                          [--placement <placement>]
--long
Enable access and listing of all fields of objects.
--limit <num>
The maximum number of virtual machines to list. To list all virtual machines, set the option to -1.
--marker <server>
List virtual machines after the marker.
--name <name>
List virtual machines with the specified name or use a filter. Supported filter operator: contains. The filter format is <operator>:<value1>[,<value2>,...].
--id <id>
Show a server with the specified ID or list virtual machines using a filter. Supported filter operator: in. The filter format is <operator>:<value1>[,<value2>,...].
--project <project>
List virtual machines that belong to the specified project ID. Can only be performed by system administrators.
--status <status>
List virtual machines with the specified status.
--task-status <task-status>
List virtual machines that have the specified task status.
--host <hostname>
List virtual machines located on a node with the specified hostname.
--placement <placement>
List virtual machines added to a placement with the specified ID or use a filter. Supported filter operator: any. The filter format is <operator>:<value1>[,<value2>,...].

Example:

# vinfra service compute server list
+--------------------------------------+------+--------+------------------------+
| id                                   | name | status | host                   |
+--------------------------------------+------+--------+------------------------+
| 8cd29296-8bee-4efb-828d-0e522d816c6e | myvm | ACTIVE | node001.vstoragedomain |
+--------------------------------------+------+--------+------------------------+

This command lists all virtual machines in the compute cluster.

3.5.3. vinfra service compute server show

Display virtual machine details:

usage: vinfra service compute server show <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server show myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | True                                       |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | RUNNING                                    |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | ACTIVE                                     |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | active                                     |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command shows the details of the virtual machine myvm.

3.5.4. vinfra service compute server stat

Display virtual machine statistics:

usage: vinfra service compute server stat <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server stat myvm
+----------+----------------------------------+
| Field    | Value                            |
+----------+----------------------------------+
| datetime | 2019-05-29T11:39:46.429000+00:00 |
| metrics  | block_capacity: 1073741824       |
|          | block_usage: 268435456           |
|          | cpu_usage: 0                     |
|          | mem_usage: 149876736             |
+----------+----------------------------------+

This command shows the statistics for the virtual machine myvm.

3.5.5. vinfra service compute server set

Modify virtual machine parameters:

usage: vinfra service compute server set [--name <name>] [--description <description>]
                                         [--ha-enabled <ha_enabled>]
                                         [--no-placements | --placement placement]
                                         <server>
--name <name>
A new name for the virtual machine
--description <description>
A new description for the virtual machine
--ha-enabled {true,false}
Enable or disable HA for the virtual machine.
--no-placements
Clean up placements from the virtual machine.
--placement placement
Placement name or ID to add the virtual machine to. Specify this option multiple times to add the virtual machine to multiple placements.
<server>
Virtual machine ID or name

Example:

# vinfra service compute server set myvm --description "My new VM" --ha-enabled false
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   | My new VM                                  |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | RUNNING                                    |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | ACTIVE                                     |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | active                                     |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command adds a description to the virtual machine myvm and disables HA for it.

3.5.6. vinfra service compute server iface attach

Attach a network to a virtual machine:

usage: vinfra service compute server iface attach [--mac <mac>] [--ip <ip-address>]
                                                  [--spoofing-protection {on,off}]
                                                  --server <server> --network <network>
--mac <mac>
MAC address
--ip <ip-address>
IP address
--spoofing-protection {on|off}
Enable spoofing protection for the network interface
--server <server>
Virtual machine ID or name
--network <network>
Network ID or name

Example:

# vinfra service compute server iface attach --network myprivnet --server myvm
+---------------+--------------------------------------+
| Field         | Value                                |
+---------------+--------------------------------------+
| fixed_ip      | 192.168.129.8                        |
| id            | 690ed3f2-2301-40e2-879a-126db2ecb57b |
| mac_address   | fa:16:3e:54:59:08                    |
| network_id    | 0710372e-2bdf-4dfe-b413-eb763da37e68 |
| spoofing<...> | False                                |
+---------------+--------------------------------------+

This command attaches the virtual network myprivnet to the virtual machine myvm.

3.5.7. vinfra service compute server iface list

List virtual machine networks:

usage: vinfra service compute server iface list [--long] --server <server>
--long
Enable access and listing of all fields of objects.
--server <server>
Virtual machine ID or name

Example:

# vinfra service compute server iface list --server myvm
+----------------+----------------+-------------------+-----------------+
| id             | network_id     | mac_address       | fixed_ip        |
+----------------+----------------+-------------------+-----------------+
| 690ed3f2-<...> | 0710372e-<...> | fa:16:3e:54:59:08 | 192.168.129.8   |
| a5b13bf3-<...> | 1bf2c9da-<...> | fa:16:3e:b9:33:bb | 192.168.128.100 |
+----------------+----------------+-------------------+-----------------+

This command lists the virtual networks that the virtual machine myvm is attached to. It also shows VM’s IP address in each network.

3.5.8. vinfra service compute server iface detach

Detach a network interface from a virtual machine:

usage: vinfra service compute server iface detach --server <server> <interface>
--server <server>
Virtual machine ID or name
<interface>
Network interface ID

Example:

# vinfra service compute server iface detach 471e37fd-13ae-4b8f-b70c-90ac02cc4386 \
--server 6c80b07f-da46-4a8a-89a4-eecb8faceb27
Operation successful.

This command detaches the network interface with the ID 471e37fd-13ae-4b8f-b70c-90ac02cc4386 from the VM with the ID 6c80b07f-da46-4a8a-89a4-eecb8faceb27.

3.5.9. vinfra service compute server volume attach

Attach a volume to a virtual machine:

usage: vinfra service compute server volume attach --server <server> <volume>
--server <server>
Virtual machine ID or name
<volume>
Volume ID or name

Example:

# vinfra service compute server volume attach e4cb5363-1fb2-41f5-b24b-18f98a388cba \
--server 871fef54-519b-4111-b18d-d2039e2410a8
+--------+--------------------------------------+
| Field  | Value                                |
+--------+--------------------------------------+
| device | /dev/vdb                             |
| id     | e4cb5363-1fb2-41f5-b24b-18f98a388cba |
+--------+--------------------------------------+

This command attaches the available volume with the ID e4cb5363-1fb2-41f5-b24b-18f98a388cba to the VM with the ID 871fef54-519b-4111-b18d-d2039e2410a8.

3.5.10. vinfra service compute server volume list

List virtual machine volumes:

usage: vinfra service compute server volume list [--long] --server <server>
--long
Enable access and listing of all fields of objects.
--server <server>
Virtual machine ID or name

Example:

# vinfra service compute server volume list --server myvm
+--------------------------------------+----------+
| id                                   | device   |
+--------------------------------------+----------+
| e4cb5363-1fb2-41f5-b24b-18f98a388cba | /dev/vdb |
| b325cc6e-8de1-4b6c-9807-5a497e3da7e3 | /dev/vda |
+--------------------------------------+----------+

This command lists the volumes attached to the virtual machine myvm.

3.5.11. vinfra service compute server volume show

Show details of a virtual machine volume:

usage: vinfra service compute server volume show --server <server>  <volume>
--server <server>
Virtual machine ID or name
<volume>
Volume ID or name

Example:

# vinfra service compute server volume show --server myvm \
e4cb5363-1fb2-41f5-b24b-18f98a388cba
+--------+--------------------------------------+
| Field  | Value                                |
+--------+--------------------------------------+
| device | /dev/vdb                             |
| id     | e4cb5363-1fb2-41f5-b24b-18f98a388cba |
+--------+--------------------------------------+

This command shows the details for the volume with the ID e4cb5363-1fb2-41f5-b24b-18f98a388cba attached to the virtual machine myvm.

3.5.12. vinfra service compute server volume detach

Detach a volume from a virtual machine:

usage: vinfra service compute server volume detach --server <server> <volume>
--server <server>
Virtual machine ID or name
<volume>
Volume ID or name

Example:

# vinfra service compute server volume detach e4cb5363-1fb2-41f5-b24b-18f98a388cba \
--server 871fef54-519b-4111-b18d-d2039e2410a8
Operation successful.

This command detaches the volume with the ID e4cb5363-1fb2-41f5-b24b-18f98a388cba from the VM with the ID 871fef54-519b-4111-b18d-d2039e2410a8.

3.5.13. vinfra service compute server log

Display virtual machine log:

usage: vinfra service compute server log <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server log myvm > myvm.log

This command prints the log of the virtual machine myvm to the file myvm.log.

3.5.14. vinfra service compute server migrate

Migrate a virtual machine to another host:

usage: vinfra service compute server migrate [--cold] [--node <node>] <server>
--cold
Perform cold migration. If not set, the migration type is determined automatically.
--node <node>
Destination node ID or hostname
<server>
Virtual machine ID or name

Example:

# vinfra service compute server migrate 6c80b07f-da46-4a8a-89a4-eecb8faceb27 \
--node e6255aed-d6e7-41b2-ba90-86164c1cd9a6
Operation successful.

This command starts migration of the VM with the ID 6c80b07f-da46-4a8a-89a4-eecb8faceb27 to the compute node with the ID e6255aed-d6e7-41b2-ba90-86164c1cd9a6.

3.5.15. vinfra service compute server resize

Resize a virtual machine:

usage: vinfra service compute server resize --flavor <flavor> <server>
--flavor <flavor>
Apply flavor with ID or name
<server>
Virtual machine ID or name

Example:

# vinfra service compute server resize myvm --flavor small
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | SHUTDOWN                                   |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | SHUTOFF                                    |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | stopped                                    |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command changes the flavor of the virtual machine myvm to small.

3.5.16. vinfra service compute server start

Start a virtual machine:

usage: vinfra service compute server start <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server start myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | SHUTDOWN                                   |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | SHOTOFF                                    |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | stopped                                    |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command starts the virtual machine myvm.

3.5.17. vinfra service compute server pause

Pause a virtual machine:

usage: vinfra service compute server pause <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server pause myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | RUNNING                                    |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | ACTIVE                                     |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | active                                     |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command pauses the running virtual machine myvm.

3.5.18. vinfra service compute server unpause

Unpause a virtual machine:

usage: vinfra service compute server unpause <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server unpause myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   | My new VM                                  |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | PAUSED                                     |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | PAUSED                                     |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| vm_state      | paused                                     |
| user_data     |                                            |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command unpauses the paused virtual machine myvm.

3.5.19. vinfra service compute server suspend

Suspend a virtual machine:

usage: vinfra service compute server suspend <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server suspend myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | RUNNING                                    |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | ACTIVE                                     |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | active                                     |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command suspends the running virtual machine myvm.

3.5.20. vinfra service compute server resume

Resume a virtual machine:

usage: vinfra service compute server resume <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server resume myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | SHUTDOWN                                   |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | SUSPENDED                                  |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | suspended                                  |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command resumes the suspended virtual machine myvm.

3.5.21. vinfra service compute server reboot

Reboot a virtual machine:

usage: vinfra service compute server reboot [--hard] <server>
--hard
Perform hard reboot
<server>
Virtual machine ID or name

Example:

# vinfra service compute server reboot myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | RUNNING                                    |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | ACTIVE                                     |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | active                                     |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command reboots the virtual machine myvm.

3.5.22. vinfra service compute server reset-state

Reset virtual machine state:

usage: vinfra service compute server reset-state [--state-error] <server>
--state-error
Reset virtual machine to ‘ERROR’ state
<server>
Virtual machine ID or name

Example:

# vinfra service compute server reset-state myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | SHUTDOWN                                   |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | VERIFY_RESIZE                              |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | resized                                    |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command resets the transitional state of the virtual machine myvm to the previous one.

3.5.23. vinfra service compute server stop

Shut down a virtual machine:

usage: vinfra service compute server stop [--hard | --wait-time <seconds>] <server>
--hard
Power off a virtual machine
--wait-time <seconds>
Shutdown timeout, after which a virtual machine will be powered off. Specify ‘-1’ to set an infinite timeout.
<server>
Virtual machine ID or name

Example:

# vinfra service compute server stop myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | RUNNING                                    |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | ACTIVE                                     |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | active                                     |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command stops the virtual machine myvm.

3.5.24. vinfra service compute server cancel-stop

Cancel shutdown for a virtual machine:

usage: vinfra service compute server cancel-stop <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server cancel-stop myvm
Operation successful.

This command cancels shutdown for the virtual machine myvm if it has the “powering-off” task state.

3.5.25. vinfra service compute server shelve

Shelve a virtual machine:

usage: vinfra service compute server shelve <server>
<server>
Virtual machine ID or name.

Example:

# vinfra service compute server shelve myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | SHUTDOWN                                   |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | SHOTOFF                                    |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | stopped                                    |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command unbinds the virtual machine myvm from the node it is hosted on and releases its reserved resources such as CPU and RAM.

3.5.26. vinfra service compute server unshelve

Unshelve a virtual machine:

usage: vinfra service compute server unshelve <server>
<server>
Virtual machine ID or name.

Example:

# vinfra service compute server unshelve myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | SHUTDOWN                                   |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | SHELVED_OFFLOADED                          |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | shelved_offloaded                          |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command spawns the virtual machine myvm on a node with enough resources to host it.

3.5.27. vinfra service compute server evacuate

Evacuate a stopped virtual machine from a failed host:

usage: vinfra service compute server evacuate <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server evacuate myvm
+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | SHUTDOWN                                   |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | SHUTOFF                                    |
| task_state    |                                            |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | stopped                                    |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command evacuates the stopped VM myvm from its node to another, healthy compute node.

3.5.28. vinfra service compute server delete

Delete a virtual machine:

usage: vinfra service compute server delete <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server delete myvm
Operation accepted.

This command deletes the virtual machine myvm.

3.5.29. vinfra service compute server rescue

Put a virtual machine to the rescue mode:

usage: vinfra service compute server rescue [--image <image>] <server>
<server>
Virtual machine ID or name
--image <image>
Boot from image ID or name

Example:

# vinfra service compute server rescue myvm --image cirros

+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   | My new VM                                  |
| fault         |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| host_status   | UP                                         |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | RUNNING                                    |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | ACTIVE                                     |
| task_state    |                                            |
| traits        | []                                         |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | active                                     |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command sends the myvm virtual machine to the rescue mode with the cirros image.

3.5.30. vinfra service compute server unrescue

Exit a virtual machine from the rescue mode:

usage: vinfra service compute server unrescue <server>
<server>
Virtual machine ID or name

Example:

# vinfra service compute server unrescue myvm

+---------------+--------------------------------------------+
| Field         | Value                                      |
+---------------+--------------------------------------------+
| config_drive  |                                            |
| created       | 2019-05-29T11:24:04Z                       |
| description   | My new VM                                  |
| fault         |                                            |
| flavor        | disk: 0                                    |
|               | ephemeral: 0                               |
|               | extra_specs: {}                            |
|               | original_name: tiny                        |
|               | ram: 512                                   |
|               | swap: 0                                    |
|               | vcpus: 1                                   |
| ha_enabled    | False                                      |
| host          | node001.vstoragedomain                     |
| host_status   | UP                                         |
| id            | 8cd29296-8bee-4efb-828d-0e522d816c6e       |
| key_name      |                                            |
| metadata      | {}                                         |
| name          | myvm                                       |
| networks      | - id: 79b3da71-c6a2-49e8-97f8-9431a065bed7 |
|               |   ipam_enabled: true                       |
|               |   ips:                                     |
|               |   - 192.168.128.100                        |
|               |   mac_addr: fa:16:3e:d8:42:f6              |
|               |   name: private                            |
|               |   spoofing_protection: true                |
| orig_hostname | node001                                    |
| placements    | []                                         |
| power_state   | RUNNING                                    |
| project_id    | b4267de6fd0c442da99542cd20f5932c           |
| status        | RESCUE                                     |
| task_state    |                                            |
| traits        | []                                         |
| updated       | 2019-05-29T11:24:21Z                       |
| user_data     |                                            |
| vm_state      | rescued                                    |
| volumes       | - delete_on_termination: false             |
|               |   id: edd3df0a-95f5-4892-9053-2793a3976f94 |
+---------------+--------------------------------------------+

This command stops the rescue mode for the myvm virtual machine.

If you face issues stopping the rescue mode for a Windows VM, refer to Exiting the rescue mode for Windows virtual machines.