-
Notifications
You must be signed in to change notification settings - Fork 0
OpenStack CLI
The OpenStack CLI is a Command-Line Interface for interacting with OpenStack, running on Aristotle. This page covers installation and some of the basic features of the CLI. For more information, please refer to the official documentation.
The OpenStack CLI client can be installed on any host with python
and pip
installed. To install, run
pip install --upgrade python-openstackclient python-swiftclient
either as root or as yourself, depending on where and how python is installed on the machine you are running this on. This command will also install the OpenStack SDK for python. You may also need to add the install directory to your PATH
by running
export PATH=$PATH:$HOME/.local/bin
Just use a nix-shell
wrapper for installing the pip dependencies mentioned above: https://github.com/federatedcloud/openstack-nix-shell
Openstack CLI client does not support Globus Single Sign On. To access your account on an Aristotle federated cloud site:
-
Request the admin of the cloud site to set a temporary password on your account. Please specify the cloud site in your request.
-
Log into the web console for the cloud using Globus Single Sign On.
-
Change your password using the temporary password from the cloud admin.
-
Under Project -> API Access, download "Openstack RC File (Identity API v3)" as shown.
-
A file named
<project name>-openrc.sh
will be downloaded to your computer. Optionally modify OS_PASSWORD environment variable in the OpenRC file. Otherwise you will be prompted for the password every time the RC file is sourced. -
Copy
<project name>-openrc.sh
file to the host with OpenStack CLI client installed and you are ready to go!
On the host where the OpenStack CLI client is installed:
- Source the OpenStack RC file. Enter your CAC account password when prompted. You will need to do this step before you can use the OpenStack CLI client in a new terminal session. In addition, if you want to switch between multiple projects, you will need to source the RC file for the project that you want to switch to.
$ source <project name>-openrc.sh
Please enter your OpenStack Password for project <project name> as user <user name>:
- You should be able to list available images like this:
$ openstack image list
+--------------------------------------+----------------------------+--------+
| ID | Name | Status |
+--------------------------------------+----------------------------+--------+
| bb0efad8-5d21-46de-ba8b-6522b3328b48 | centos-7.5 | active |
| 9387131a-91ef-4cae-a3b7-da20c586af70 | ubuntu-18.04-LTS | active |
+--------------------------------------+----------------------------+--------+
- Run
openstack command help
to get the list of available commands. Use the-h
option with any command to get detailed syntax help. For example:
$ openstack image list -h
usage: openstack image list [-h] [-f {csv,json,table,value,yaml}] [-c COLUMN]
[--max-width <integer>] [--fit-width]
[--print-empty] [--noindent]
[--quote {all,minimal,none,nonnumeric}]
[--sort-column SORT_COLUMN]
[--public | --private | --shared]
[--property <key=value>] [--name <name>]
[--status <status>] [--long]
[--sort <key>[:<direction>]]
[--limit <num-images>] [--marker <image>]
List available images
optional arguments:
-h, --help show this help message and exit
--public List only public images
--private List only private images
--shared List only shared images
:
:
- Use the
swift
command to access object store:
$ swift stat
Account: v1
Containers: 1
Objects: 1
Bytes: 4611840
X-Timestamp: 1539699805.38623
X-Account-Bytes-Used-Actual: 4612096
X-Trans-Id: tx00000000000000000000d-005bc5f45c-38952d-default
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
$ swift stat
Account: v1
Containers: 1
Objects: 1
Bytes: 4611840
X-Timestamp: 1539699998.81229
X-Account-Bytes-Used-Actual: 4612096
X-Trans-Id: tx00000000000000000000e-005bc5f51e-38952d-default
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes
$ swift help
usage: swift [--version] [--help] [--os-help] [--snet] [--verbose]
[--debug] [--info] [--quiet] [--auth <auth_url>]
[--auth-version <auth_version> |
--os-identity-api-version <auth_version> ]
:
:
Command-line interface to the OpenStack Swift API.
Positional arguments:
<subcommand>
delete Delete a container or objects within a container.
download Download objects from containers.
list Lists the containers for the account or the objects
for a container.
post Updates meta information for the account, container,
or object; creates containers if not present.
:
:
: