Manage Volume
Volumes support multiple actions such as attaching and detaching to an instance, resizing, deleting, and so on.
#
RequirementsThe full documentation can be found on the openstack website
#
Attach a volume to an instanceAttach your volume to a server, specifying the server ID and the volume ID:
openstack server add volume [--device <device>] <server> <volume>
Run the command
openstack server add volume server-development-001\ volume-nvme-100gb --device /dev/vdb
openstack volume show volume-nvme-100gb
The output shows that the volume is attached to the server
+------------------------------+----------------------------------------------------------------------------------------------------- --------+| Field | Value |+------------------------------+--------------------------------------------------------------------------------------------------------------+| attachments | [{'id': '761c0e3e-ad82-48a7-9b76-34c70c46dd96', 'attachment_id': || | '862c1c35-b6cc-4db3-9c15-010671cd2fd1', 'volume_id': '761c0e3e-ad82-48a7-9b76-34c70c46dd96', || | 'server_id': '389512f5-fa80-447a-9742-a6e4e7f96051', 'host_name': None, || | 'device': '/dev/sdb', 'attached_at': '2021-09-29T16:17:58.000000'}] | | availability_zone | nova | | bootable | false || consistencygroup_id | None | | created_at | 2021-09-29T12:14:16.000000 | | description | None | | encrypted | False | | id | 761c0e3e-ad82-48a7-9b76-34c70c46dd96 | | multiattach | False | | name | volume-nvme-100gb | | os-vol-tenant-attr:tenant_id | 60ed74df25964615886b64d33dbaee7f | | properties | | | replication_status | None | | size | 100 | | snapshot_id | None | | source_volid | None | | status | in-use | | type | NVMe | | updated_at | 2021-09-29T16:17:59.000000 | | user_id | 063459e21cd4432e86cf376c34e2b9ed | +------------------------------+--------------------------------------------------------------------------------------------------------------+
The full documentation about command can be found on the #volume-attach
#
Detach a volume to an instanceDetach your volume from a server, specifying the server ID and the volume ID:
openstack server remove volume <server> <volume>
Run the command
openstack server remove volume server-development-001 volume-nvme-100gb
The output shows that the volume is no longer attached to the server:
+------------------------------+--------------------------------------+| Field | Value |+------------------------------+--------------------------------------+| attachments | [] || availability_zone | nova || bootable | false || consistencygroup_id | None || created_at | 2021-09-29T12:14:16.000000 || description | None || encrypted | False || id | 761c0e3e-ad82-48a7-9b76-34c70c46dd96 || multiattach | False || name | volume-nvme-100gb || os-vol-tenant-attr:tenant_id | 60ed74df25964615886b64d33dbaee7f || properties | || replication_status | None || size | 100 || snapshot_id | None || source_volid | None || status | available || type | NVMe || updated_at | 2021-09-29T16:24:05.000000 || user_id | 063459e21cd4432e86cf376c34e2b9ed |+------------------------------+--------------------------------------+
The full documentation about command can be found on the #volume-detach
#
Delete a volumeTo delete your volume, you must first detach it from the server. Check #volume-detach
openstack volume delete [--force | --purge] <volume>
Run the command
openstack volume delete volume-nvme-100gb
The full documentation about command can be found on the #volume-delete
All changes will be visible in the Cloudify.ro dashboard in a few minutes.