LinuxCommandLibrary

openstack-volume

Manage OpenStack Block Storage volumes

TLDR

List volumes

$ openstack volume list --all-projects
copy

Show volume details
$ openstack volume show [volume_id]
copy

Create new volume
$ openstack volume create --size [size_in_GB] --image [image_id] --snapshot [snapshot_id] [--bootable|--non-bootable] [volume_name]
copy

Delete volumes(s)
$ openstack volume delete [volume_id1 volume_id2 ...]
copy

Migrate volume to a new host
$ openstack volume migrate --host [host_hostname] [instance_id]
copy

Set volume properties
$ openstack volume set --name [volume_new_name] --size [volume_new_size] [--attached|--detached] [--bootable|--non-bootable] [volume_id]
copy

SYNOPSIS

openstack volume command [options]

PARAMETERS

create
    Create a new volume.

delete
    Delete volume(s).

list
    List available volumes.

show
    Show details of a specific volume.

set
    Set volume properties.

unset
    Unset volume properties.

qos set
    Set QoS specifications to an existing volume type.

qos unset
    Unset QoS specifications from a volume type.

--os-volume-api-version volume-api-version
    Specify Volume API version to use.

--project project
    The project to operate under. Defaults to the current project, set in openstack config

--domain domain
    The domain to operate under. Defaults to the current domain, set in openstack config

DESCRIPTION

The `openstack volume` command provides a command-line interface for managing OpenStack Block Storage (Cinder) volumes. It allows users to create, delete, list, show details of, attach, and detach volumes within an OpenStack cloud environment. This command interacts with the Cinder API to perform volume operations, offering a convenient way to manage storage resources without directly using the Cinder API. It's part of the `python-openstackclient` package, a unified CLI for OpenStack. Users can perform tasks like creating volumes from snapshots, attaching volumes to virtual machines, and managing volume types and encryption. The `openstack volume` command is essential for users and administrators needing programmatic access to Cinder for storage management tasks, enabling automation and integration with other infrastructure tools. It uses API version negotiation. The tool is used both with command line and in scripts. It requires proper authentication credentials for the OpenStack cloud to operate correctly.

CAVEATS

Requires OpenStack credentials to be configured (e.g., via environment variables or openstack config). Incorrect credentials or API version may lead to authentication or functionality errors.

VOLUME ATTACHMENT

To attach a volume to a server, you need to first identify the server and the volume. Then, use the `openstack server add volume` command, providing the server ID and the volume ID. The command will return once it's scheduled for attachment. The attachment to the guest operating system inside the virtual machine will still need to be performed, for example with 'fdisk' or 'lsblk'. To detach, use 'openstack server remove volume server volume'.

HISTORY

The `openstack volume` command evolved as part of the unification effort within the OpenStack project to provide a single CLI tool (`python-openstackclient`) for interacting with various OpenStack services. Prior to this, individual service CLIs (e.g., `cinder` command) were used. The `openstack volume` command aims to provide a more consistent and user-friendly interface for managing block storage. It leverages the OpenStack APIs and is actively maintained to support new features and API versions.

SEE ALSO

openstack server(1), cinder(1)

Copied to clipboard