How to setup and use the OpenStack Client for project observation.
Any command with `conda` can also use `mamba`, which has faster environment installation.
Some of the data produced by these commands, especially user lists, may be sensitive. It is recommended to use the OpenStack Client on Cheaha rather than a local machine.
Anaconda and Mamba are available as modules on Cheaha. Use `module load Anaconda` or `module load Mamba` to use them.
## Setup
1. Enter `conda env create --file env.yml` to build the environment.
- We have OpenStack series `Ussuri` which uses `python-openstackclient=5.2.2` but `5.8.0` is backwards compatible.
2. Download the `<project>-openrc.sh` file from the OpenStack Horizon Dashboard for Cloud.rc at `https://dashboard.cloud.rc.uab.edu/project/`.
- Select the project you're interested in first.
- Each project will create a distinct file.
- If you wish to observe more than one project, you'll need to access and download each project's `<project>-openrc.sh` file.
**Do NOT** store your password in an `openrc.sh` file and do not put these files on the internet or in git! If you think you might lose track of the file, you can always get it again using the dashboard.
## Use
Each session, start with
1. Enter `. <project>-openrc.sh` to source the file for the project you wish to observe.
- If you downloaded the file from the OpenStack Horizon Dashboard, you will be prompted for your password.
2. Enter `conda activate openstack-cli` to activate the Anaconda environment with the client.
### Show Project Limits
`openstack limits show --absolute`
### Show Aggregate Resource Usage over Time
`openstack usage show`
### Observation Commands
The `<command> list` commands are used to get an overview. If you need more details on a specific entity, use `<command> show $ID`.
- Instances: `openstack server list`
- Images: `openstack image list`
- Networks: `openstack network list`
- Routers: `openstack router list`
- Ports: `openstack port list`
- Floating IPs: `openstack floating ip list`
- Security Groups: `openstack security group list`
- Security Group Rules: `openstack security group rule list`
- Users: `openstack user list` (may be restricted)
#### Formatting Outputs
By default, output is formatted as a pretty-printed ASCII table. You can select a different format using the `--format` flag with a suitable choice. For list commands, you can use `csv,json,value,yaml`. For `show` commands you can use `json,shell,value,yaml`. The formatter `value` will output a Python structure, and `shell` will output a comma separated list of `key=value`.
#### Help
Use `<full-command> --help` to get more information about possible flags.
### Management Commands
In principle it is possible to use the OpenStack Client to do anything you can do with the Horizon Dashboard, and more. There is a considerable learning curve to doing things this way and, while it is powerful, it is not recommended for novice users. If you have a use case that requires the SDK (this is unusual) please contact support and we can work with you.