Zum Inhalt

OpenStack Client Installation

OpenStack Client (OSC) ist ein Befehlszeilen-Client für OpenStack, der den Befehlssatz für Compute, Identity, Image, Object Storage und Block Storage APIs in einer einzigen Shell mit einer einheitlichen Befehlsstruktur zusammenführt.

In diesem Kapitel wird beschrieben, wie der OCS installiert und konfiguriert wird.

Voraussetzungen

  • Grundkenntnisse des Linux Betriebssystems (shell)
  • Zugriff auf laufende Linux-VM (In unserem Beispiel Ubuntu) mit geöffnetem Port (Egress 443) zum OpenStack API
  • Application Credentials (cloud.yaml)

Die Auszuführenden Schritte sind:

  • Installation python-openstackclient und python-keystoneclient packages
  • Konfiguration der Authentication (Application Credentials)

Note

Wir empfehlen python venv or/and pyenv. Python Version 3.9.16 ist aus eigener Erfahrung aktuell am besten geeignet.

Steps:

1) Installation pyenv

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bashrc
exec "$SHELL"

2.) Installation python 3.9.16 version in das pyenv

sudo apt update
sudo apt install build-essential libbz2-dev libreadline-dev libssl-dev zlib1g-dev libsqlite3-dev wget curl libncurses5-dev libncursesw5-dev xz-utils libffi-dev liblzma-dev
pyenv install 3.9.16 # takes a couple of minutes
echo '3.9.16' > ~/.python-version
# you can use virtualenv from within pyenv as well...

3.) Installation openstack clients

cd ~/  # this is important to guarantee the pyenv installed python 3.9.16 is used
pip install -U pip
pip install -U \
  "gnocchiclient==7.0.7" \
  "openstacksdk<0.102.0" \
  "osc-placement<4.1.0" \
  "oslo.utils<6.1.0" \
  "python-barbicanclient<5.5.0" \
  "python-cinderclient<9.2.0" \
  "python-cloudkittyclient<4.7.0" \
  "python-designateclient<5.1.0" \
  "python-glanceclient<4.2.0" \
  "python-heatclient<3.2.0" \
  "python-keystoneclient<5.1.0" \
  "python-magnumclient<4.1.0" \
  "python-mistralclient<5.0.0" \
  "python-neutronclient<8.2.0" \
  "python-novaclient<18.2.0" \
  "python-octaviaclient<3.2.0" \
  "python-openstackclient<6.1.0" \
  "python-swiftclient<4.2.0"

Tip

Um die neuesten Port Forwarding Features im Python OpenStack Client nutzen zu können müssen Sie auch das folgende Packet installieren:

#Install customized python_openstack client with port forwarding support
pip install https://s3.ewstorage.ch/pub/python_openstackclient-6.2.1.dev3-py3-none-any.whl 

4.) Einrichtung bash_completion

openstack complete | sudo tee /etc/bash_completion.d/osc.bash_completion > /dev/null
. /etc/bash_completion

5.) Konfiguration der Application Credentials

mkdir -p ~/.config/openstack

# Paste your clouds.yaml file content or copy it to
vim ~/.config/openstack/clouds.yaml

# Define default connection
export OS_CLOUD=openstack 

Note

OS_CLOUD=openstack bezieht sich auf den Konfigurationsblock in Ihrer Datei clouds.yaml, wobei Sie auch mehrere Blöcke haben können! Falls Sie die Variable OS_CLOUD nicht exportieren, können Sie auch in der Command Line den Cloud Konfigurationsblock mitgeben. Zum Beispiel openstack --os-cloud=openstack image list

Beispiel: clouds.yaml

6.) Test der Konfiguration und der Konnektivität

openstack image list
root@ewos1-admin1-prod:~# openstack image list --public
+--------------------------------------+-----------------------------------+--------+
| ID                                   | Name                              | Status |
+--------------------------------------+-----------------------------------+--------+
| 95538b63-f446-48db-a57a-c9100c194562 | AlmaLinux 10                      | active |
| 9afa452e-3343-46f7-8be2-59aa7af05541 | AlmaLinux 10 LVM                  | active |
| 12d88af5-2bd3-4907-8053-8f7e1b5439ea | AlmaLinux 9                       | active |
| 19d86022-e8de-483f-a21c-30f044dd78af | AlmaLinux 9 LVM                   | active |
| c7d50227-3398-4870-8db5-e31e5d7d2dcf | CentOS Stream 9                   | active |
| 17047aaf-51a7-4441-b2bf-dcf673e07bb7 | CentOS Stream 9 LVM               | active |
| 089f1825-a762-499e-9b4b-5d0ef7b05068 | CirrOS 0.6.3                      | active |
| 62303abb-bcd3-4604-aedb-e282f1eef863 | Red Hat Enterprise Linux 7        | active |
| 37fd3deb-4915-4e74-97ca-9a8f3000c3fe | Ubuntu 22.04                      | active |
| 6d158068-bf79-4459-a69d-0d374231bf5b | Ubuntu 22.04 DevTools             | active |
| 888b3974-711f-4b74-9d96-5b3c4d8f658d | Ubuntu 22.04 GPU                  | active |
| 3bb383ce-7db3-46c4-99af-ee82300d9fa9 | Ubuntu 22.04 LVM                  | active |
| b152a2bd-4f31-463e-bbd4-0983d97440bb | Ubuntu 24.04                      | active |
| 455a6a66-53dd-4ecb-90a9-e57be4c43590 | Ubuntu 24.04 DevTools             | active |
| 2aa5310e-5942-49ae-91c0-f953cce26fa6 | Ubuntu 24.04 GPU                  | active |
| b10f68a1-2486-492f-80f6-6e0e6a5200fd | Ubuntu 24.04 LVM                  | active |
| 739eede2-f176-442b-8574-516701eac5bd | Windows Server 2019 Standard      | active |
| 14fe6d1d-752f-4aef-b69c-f9cb9fc4421e | Windows Server 2022 Standard      | active |
| 43ebb5db-f6cb-4bf4-a24e-5a1eafc7c12f | Windows Server 2022 Standard Core | active |
| 590ea95b-3a7a-43bb-8657-ee8645900cf7 | almalinux-9-amd64-disk-temp       | active |
| 7f438b74-7c48-47c8-b3de-969b9f60e87a | centos-9_stream-amd64-disk-temp   | active |
| ff4599a3-7814-4d5a-849d-7574b1643e98 | cirros-0.5.2-x86_64-disk          | active |
| 3eb03356-1bc6-4771-baf9-1907fd171b3c | cirros-0.6.1-x86_64-disk          | active |
| 14430020-2025-0503-0535-71358578b868 | gardenlinux-1443                  | active |
+--------------------------------------+-----------------------------------+--------+

Herzlichen Glückwunsch, Ihr OpenStack-Client funktioniert!

Weitere Informationen zu den verfügbaren Befehlen finden Sie auf den folgenden Internetseite: OpenStackClient User Manual