DreamCompute command-line interface cheat sheet

Overview

This article lists several common commands for your reference.

  • If you have multiple images or volumes with the same name, you must use IDs instead of names in the commands below.
  • Some of the examples below contain a back slash character at the end of each line. This back slash continues the command on the next line. If you like, you can remove this character and put the entire command on a single line.

Images

List images you can access:

[user@localhost]$ openstack image list

Delete specified image:

[user@localhost]$ openstack image delete IMAGE

Describe a specific image:

[user@localhost]$ openstack image show IMAGE

Compute

List instances and check status of instance:

[user@localhost]$ openstack server list

List flavors:

[user@localhost]$ openstack flavor list

Boot an ephemeral instance:

[user@localhost]$ openstack server create --image IMAGE \
--flavor FLAVOR --key-name KEY INSTANCE_NAME

Show details of instance:

[user@localhost]$ openstack server show INSTANCE

View console log of instance:

[user@localhost]$ openstack console log show INSTANCE

Generate console URL for instance:

[user@localhost]$ openstack console url show INSTANCE

Set metadata on an instance:

[user@localhost]$ openstack server set --property newmeta='my meta data' INSTANCE

Create and verify details of an instance snapshot:

[user@localhost]$ openstack server image create --name IMAGE --wait INSTANCE
[user@localhost]$ openstack image show IMAGE
 

Pause, suspend, stop, resize, rebuild, reboot an instance

Pause – stores the state of the VM in RAM. A paused server continues to run in a frozen state. Pausing instances does not make them unbillable:

[user@localhost]$ openstack server pause INSTANCE

Unpause – returns a paused server back to an active state:

[user@localhost]$ openstack server unpause INSTANCE

Suspend – suspends a server. Administrative users may wish to suspend a server if it's infrequently used or to perform a system maintenance. When you suspend a server, its VM state is stored on disk, all memory is written to disk, and the virtual machine is stopped. Suspending instances does not make them unbillable:

[user@localhost]$ openstack server suspend INSTANCE

Unsuspend – resumes a suspended server to an active state:

[user@localhost]$ openstack server resume INSTANCE

Lock – locks a server. This prevents any non-administrative users with access to your DreamCompute project from modifying or manipulating the instance itself using either the DreamCompute dashboard ('https://iad2.dreamcompute.com') or the OpenStack command-line client:

[user@localhost]$ openstack server lock INSTANCE

Unlock – unlocks a server in locked state so additional operations can be performed on the server by non-admin users. By default, only owner or administrator can unlock a server:

[user@localhost]$ openstack server unlock INSTANCE

Stop:

[user@localhost]$ openstack server stop INSTANCE

Start:

[user@localhost]$ openstack server start INSTANCE

Resize:

[user@localhost]$ openstack resize --flavor FLAVOR INSTANCE
[user@localhost]$ openstack resize --confirm --wait INSTANCE
[user@localhost]$ openstack resize --revert --wait INSTANCE

Rebuild:

[user@localhost]$ openstack server rebuild --wait INSTANCE

Reboot:

[user@localhost]$ openstack server reboot --wait --soft INSTANCE
[user@localhost]$ openstack server reboot --hard --wait INSTANCE

Block Storage

Used to manage volumes that attach to instances and volume snapshots.

Create a new and empty 6 GB volume:

[user@localhost]$ openstack volume create --size 6 VOLUME

Boot an instance to attach the new volume to:

[user@localhost]$ openstack server create --image IMAGE \
--flavor FLAVOR --key-name KEY INSTANCE

List volumes and view status of volume:

[user@localhost]$ openstack volume list

Attach volume to an instance after an instance is active and volume is available:

[user@localhost]$ openstack server add volume INSTANCE VOLUME

Did this article answer your questions?

Article last updated PST.