Skip to content

User Guides: OpenStack Client

This section provides command-line instructions for common tasks using the openstack CLI.

Prerequisite: Ensure you have installed and configured the OpenStack Client.

Managing Compute (Nova)

Launching an Instance

1. List Available Resources (Flavors, Images, Networks):

openstack flavor list
openstack image list
openstack network list
openstack keypair list
openstack security group list

2. Create the Server:

openstack server create --image <IMAGE_ID> \
                        --flavor <FLAVOR_ID> \
                        --network <NETWORK_ID> \
                        --key-name <KEYPAIR_NAME> \
                        --security-group <SECURITY_GROUP_NAME> \
                        my-instance

Resizing an Instance

1. Resize the Server:

openstack server resize --flavor <NEW_FLAVOR_ID> --wait <SERVER_ID>

2. Confirm the Resize:

openstack server resize confirm <SERVER_ID>

Migrating Instances

Live Migration: Move a running instance to another host without downtime.

openstack server migrate --live-migration [--host <HYPERVISOR_HOSTNAME>] --wait <INSTANCE_UUID>

Cold Migration: Move a stopped instance (or pause it during move) to another host.

openstack server migrate --wait <INSTANCE_UUID>

Managing Flavors

Creating Flavors

Note: creating flavors usually requires admin privileges.

openstack flavor create --id <ID> --vcpus <VCPUS> --ram <RAM> --disk <DISK> <FLAVOR_NAME>

Performance Tuning (Pinning & Hugepages)

For high-performance workloads, you can configure flavors with dedicated CPU policies and hugepages.

Properties for Dedicated Performance:

Property Value Description
hw:cpu_policy dedicated Dedicate physical cores to vCPUs.
hw:cpu_thread_policy isolate Do not share physical cores with other processes.
hw:mem_page_size 2048 Use 2MB hugepages (requires trait).
hw:vif_multiqueue_enabled true Enable multiqueue for network interfaces.
hw:vif_multiqueue_max 4 Max queues.
hw_rng:allowed true Allow Random Number Generator.
trait:CUSTOM_HUGEPAGES_2048K required Schedule only on hosts with hugepages enabled.

Example: Creating a Performance Flavor

# 1. Create the base flavor
openstack flavor create --vcpus 4 --ram 8192 --disk 50 perf.m1.large

# 2. Set the performance properties
openstack flavor set --property hw:cpu_policy='dedicated' \
                     --property hw:cpu_thread_policy='isolate' \
                     --property hw:mem_page_size='2048' \
                     --property hw:vif_multiqueue_enabled='true' \
                     --property hw:vif_multiqueue_max='4' \
                     --property hw_rng:allowed='true' \
                     --property trait:CUSTOM_HUGEPAGES_2048K='required' \
                     perf.m1.large

Hugepages Requirement

If using hugepages (hw:mem_page_size='2048'), you must ensure the trait trait:CUSTOM_HUGEPAGES_2048K='required' is set. Please contact the Tier5 support team to ensure your cloud environment supports hugepages and these traits.


Managing Images (Glance)

List Images:

openstack image list

Create Image:

openstack image create --file <IMAGE-NAME>.raw \
                       --disk-format raw \
                       --container-format bare \
                       --public \
                       --property os_distro='ubuntu' \
                       --property os_admin_user='ubuntu' \
                       --property os_version='24.04' \
                       <IMAGE-NAME>

Metadata Properties (--property):

Setting correct metadata is crucial for a good user experience in the dashboard:

  • os_distro: Determines the icon displayed in Horizon/Skyline (e.g., ubuntu, centos, windows).
  • os_admin_user: Hints the default SSH username to the user in the dashboard instance details.
  • os_version: Specifies the operating system version.

For a full list of recognized properties, refer to the OpenStack Useful Image Properties documentation.


Managing Key Pairs

Create Key Pair:

openstack keypair create my-key > my-key.pem
chmod 600 my-key.pem

List Key Pairs:

openstack keypair list

Networking (Neutron)

Network Visualization

The CLI lists networks and subnets but does not provide a topology graph.

openstack network list
openstack subnet list

Creating a Private Network

# Create Network
openstack network create my-network

# Create Subnet
openstack subnet create --network my-network \
                        --subnet-range 192.168.10.0/24 \
                        --dns-nameserver 8.8.8.8 \
                        my-subnet

Configuring Security Groups

# Create Security Group
openstack security group create my-secgroup

# Add Rules (SSH and HTTP)
openstack security group rule create --protocol tcp --dst-port 22:22 --remote-ip 0.0.0.0/0 my-secgroup
openstack security group rule create --protocol tcp --dst-port 80:80 --remote-ip 0.0.0.0/0 my-secgroup

Load Balancing (Octavia)

# 1. Create Load Balancer
openstack loadbalancer create --name my-lb --vip-subnet-id <SUBNET_ID>

# 2. Create Listener
openstack loadbalancer listener create --name my-listener --protocol HTTP --protocol-port 80 my-lb

# 3. Create Pool
openstack loadbalancer pool create --name my-pool --lb-algorithm ROUND_ROBIN --listener my-listener --protocol HTTP

# 4. Add Members (Instances)
openstack loadbalancer member create --subnet-id <SUBNET_ID> --address <INSTANCE_IP> --protocol-port 80 my-pool

Kubernetes Clusters (Magnum)

Advanced Workloads: Kata Containers

For workloads requiring stronger isolation, you can use Kata Containers with your Magnum clusters. See the Kata Containers Guide.

# List Templates
openstack coe cluster template list

# Create Cluster
openstack coe cluster create --cluster-template <TEMPLATE_ID> \
                             --master-count 1 \
                             --node-count 2 \
                             --keypair <KEYPAIR_NAME> \
                             my-cluster

# Retrieve Kubeconfig
openstack coe cluster config my-cluster > kubeconfig

Storage (Cinder)

Managing Volumes

# Create Volume
openstack volume create --size 10 my-volume

# Attach to Instance
openstack server add volume <INSTANCE_ID> my-volume

Volume Snapshots

openstack volume snapshot create --volume <VOLUME_ID> my-snapshot

Volume Backups

openstack volume backup create --name my-backup <VOLUME_ID>

Orchestration (Heat)

Stacks

# Create Stack from Template
openstack stack create -t my-template.yaml my-stack

# List Stacks
openstack stack list