3.9. Managing Volumes

3.9.1. Creating Volumes

3.9.1.1. Syntax

usage: vinfra service compute volume create [-h] [-f {json,table,value,yaml}]
                                            [-c COLUMN] [--wait]
                                            [--timeout <seconds>]
                                            [--description <description>]
                                            [--network-install <network_install>]
                                            [--image <image>] --storage-policy
                                            <storage_policy> --size <size-gb>
                                            <volume-name>

Create a new compute volume.

positional arguments:
  <volume-name>         Volume name

optional arguments:
  -h, --help            show this help message and exit
  --description <description>
                        Volume description
  --network-install <network_install>
                        Perform network install ('true' or 'false').
  --image <image>       Source compute image ID or name
  --storage-policy <storage_policy>
                        Storage policy ID or name
  --size <size-gb>      Volume size, in gigabytes
...

3.9.1.2. Sample Output

This command creates a volume myvolume sized 8 GB and chooses the default storage policy for it.

# vinfra service compute volume create myvolume --storage-policy default --size 8
+--------------------------------+--------------------------------------+
| Field                          | Value                                |
+--------------------------------+--------------------------------------+
| attachments                    | []                                   |
| availability_zone              | nova                                 |
| bootable                       | False                                |
| consistencygroup_id            |                                      |
| created_at                     | 2018-09-12T12:30:12.665916           |
| description                    |                                      |
| encrypted                      | False                                |
| id                             | c9c0e9e7-ce7a-4566-99d5-d7e40f2987ab |
| imageRef                       |                                      |
| migration_status               |                                      |
| multiattach                    | False                                |
| name                           | myvolume                             |
| network_install                | False                                |
| os-vol-host-attr:host          |                                      |
| os-vol-mig-status-attr:migstat |                                      |
| os-vol-mig-status-attr:name_id |                                      |
| project_id                     | 72a5db3a033c403a86756021e601ef34     |
| replication_status             |                                      |
| size                           | 8                                    |
| snapshot_id                    |                                      |
| source_volid                   |                                      |
| status                         | creating                             |
| storage_policy_name            | default                              |
| updated_at                     |                                      |
| user_id                        | 98bf389983c24c07af9677b931783143     |
| volume_image_metadata          |                                      |
+--------------------------------+--------------------------------------+

3.9.2. Listing Volumes

3.9.2.1. Syntax

usage: vinfra service compute volume list [-h] [-f {json,table,value,yaml}]
                                          [-c COLUMN]

List compute volumes.
...

3.9.2.2. Sample Output

This command lists volumes available to the compute cluster. (The output is abridged to fit on page.)

# vinfra service compute volume list -c id -c name -c size -c status
+--------------------------------------+----------+------+-----------+
| id                                   | name     | size | status    |
+--------------------------------------+----------+------+-----------+
| c9c0e9e7-ce7a-4566-99d5-d7e40f2987ab | myvolume |    8 | available |
+--------------------------------------+----------+------+-----------+

3.9.3. Showing Volume Details

3.9.3.1. Syntax

usage: vinfra service compute volume show [-h] [-f {json,table,value,yaml}]
                                          [-c COLUMN]
                                          <volume>

Display compute volume details.

positional arguments:
  <volume>              Volume ID or name
...

3.9.3.2. Sample Output

This command shows the details for the volume myvolume.

# vinfra service compute volume show myvolume
+--------------------------------+-----------------------------------------------------+
| Field                          | Value                                               |
+--------------------------------+-----------------------------------------------------+
| attachments                    | []                                                  |
| availability_zone              | nova                                                |
| bootable                       | False                                               |
| consistencygroup_id            |                                                     |
| created_at                     | 2018-09-12T12:30:12.665916                          |
| description                    |                                                     |
| encrypted                      | False                                               |
| id                             | c9c0e9e7-ce7a-4566-99d5-d7e40f2987ab                |
| imageRef                       |                                                     |
| migration_status               |                                                     |
| multiattach                    | False                                               |
| name                           | myvolume                                            |
| network_install                | False                                               |
| os-vol-host-attr:host          | stor-1.example.com.vstoragedomain@vstorage#vstorage |
| os-vol-mig-status-attr:migstat |                                                     |
| os-vol-mig-status-attr:name_id |                                                     |
| project_id                     | 72a5db3a033c403a86756021e601ef34                    |
| replication_status             |                                                     |
| size                           | 8                                                   |
| snapshot_id                    |                                                     |
| source_volid                   |                                                     |
| status                         | available                                           |
| storage_policy_name            | default                                             |
| updated_at                     | 2018-09-12T12:30:33.167654                          |
| user_id                        | 98bf389983c24c07af9677b931783143                    |
| volume_image_metadata          |                                                     |
+--------------------------------+-----------------------------------------------------+

3.9.4. Changing Volume Parameters

3.9.4.1. Syntax

usage: vinfra service compute volume set [-h] [-f {json,table,value,yaml}]
                                         [-c COLUMN]
                                         [--description <description>]
                                         [--network-install <network_install>]
                                         [--storage-policy <storage_policy>]
                                         [--bootable <bootable>]
                                         [--name <name>]
                                         <volume>

Modify volume parameters

positional arguments:
  <volume>              Volume ID or name

optional arguments:
  -h, --help            show this help message and exit
  --description <description>
                        Volume description
  --network-install <network_install>
                        Perform network install ('true' or 'false').
  --storage-policy <storage_policy>
                        Storage policy ID or name
  --bootable <bootable>
                        Make bootable ('true' or 'false').
  --name <name>         A new name for the volume
...

3.9.4.2. Sample Output

This command changes the storage policy of the volume myvolume to mystorpolicy.

# vinfra service compute volume set myvolume --storage-policy mystorpolicy
+--------------------------------+-----------------------------------------------------+
| Field                          | Value                                               |
+--------------------------------+-----------------------------------------------------+
| attachments                    | []                                                  |
| availability_zone              | nova                                                |
| bootable                       | False                                               |
| consistencygroup_id            |                                                     |
| created_at                     | 2018-09-12T12:30:12.665916                          |
| description                    |                                                     |
| encrypted                      | False                                               |
| id                             | c9c0e9e7-ce7a-4566-99d5-d7e40f2987ab                |
| imageRef                       |                                                     |
| migration_status               |                                                     |
| multiattach                    | False                                               |
| name                           | myvolume                                            |
| network_install                | False                                               |
| os-vol-host-attr:host          | stor-1.example.com.vstoragedomain@vstorage#vstorage |
| os-vol-mig-status-attr:migstat |                                                     |
| os-vol-mig-status-attr:name_id |                                                     |
| project_id                     | 72a5db3a033c403a86756021e601ef34                    |
| replication_status             |                                                     |
| size                           | 8                                                   |
| snapshot_id                    |                                                     |
| source_volid                   |                                                     |
| status                         | available                                           |
| storage_policy_name            | mystorpolicy                                        |
| updated_at                     | 2018-09-12T12:55:29.298717                          |
| user_id                        | 98bf389983c24c07af9677b931783143                    |
| volume_image_metadata          |                                                     |
+--------------------------------+-----------------------------------------------------+

3.9.5. Extending Volumes

3.9.5.1. Syntax

usage: vinfra service compute volume extend [-h] --size <size_gb> <volume>

Extend a compute volume.

positional arguments:
  <volume>          Volume ID or name

optional arguments:
  -h, --help        show this help message and exit
  --size <size_gb>  Size to extend to

3.9.5.2. Sample Output

This command extends the volume myvolume to 16 GB.

# vinfra service compute volume extend myvolume --size 16
Operation successful

3.9.6. Attaching Volumes to Virtual Machines

3.9.6.1. Syntax

usage: vinfra service compute server volume attach [-h]
                                                   [-f {json,table,value,yaml}]
                                                   [-c COLUMN] --server
                                                   <server>
                                                   <volume>

Attach a volume to a compute server.

positional arguments:
  <volume>              Volume ID or name

optional arguments:
  -h, --help            show this help message and exit
  --server <server>     Compute server ID or name
...

3.9.6.2. Sample Output

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.

# 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 |
+--------+--------------------------------------+

3.9.7. Detaching Volumes from Virtual Machines

3.9.7.1. Syntax

usage: vinfra service compute server volume detach [-h] --server <server>
                                                   <volume>

Detach a volume from a compute server.

positional arguments:
  <volume>           Volume ID or name

optional arguments:
  -h, --help         show this help message and exit
  --server <server>  Compute server ID or name

3.9.7.2. Sample Output

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

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

3.9.8. Deleting Volumes

3.9.8.1. Syntax

usage: vinfra service compute volume delete [-h] [-f {json,table,value,yaml}]
                                            [-c COLUMN] [--wait]
                                            [--timeout <seconds>]
                                            <volume>

Delete a compute volume.

positional arguments:
  <volume>              Volume ID or name
...

3.9.8.2. Sample Output

This command deletes the volume myvolume2.

# vinfra service compute volume delete myvolume2
Operation successful