|
|
This will cover installing and configuring the OpenStack SDK in detail on both Linux and MacOs systems and most of the steps detailed in this document come from OpenStack's official documentation found at https://docs.openstack.org/newton/user-guide/common/cli-install-openstack-command-line-clients.html which also contans details on how to install it on Windows sytems aswell.
|
|
|
|
|
|
### Steps
|
|
|
1. Install pip onto the machine used. On MacOS this can be done using the following command "easy_install pip" and on Ubuntu or Debian based systems it is an apt package install with "apt install python-dev python-pip"
|
|
|
2. Next with pip installed use that to install the the python-openstackclient using "pip install python-openstackclient". For other clients that are usually included with this install but if wanted to download seperatly to import into a python script replace "openstack" with the name of the client for example "pip install python-novaclient" will install the Nova client. On MacOS this client can be installed the same way with a pip install or can be installed via homebrew with "brew install openstackclient". On Ubuntu/Debian systems it can also be installed as a an apt package using python with the following command "sudo apt install python3-openstackclient". If when installing on MacOS with a pip install you get an error that reads "ERROR: Failed building wheel for netifaces" this is caused by an outdated version of XCode command line tools. To fix this problem uninstall the command line tools using this guide https://mac.install.guide/commandlinetools/6 then to reinstall run this command "xcode-select --install" which will open a dialog box on the desktop screen asking for confirmation to install these tools. Once the tools are installed run "xcode-select -p" to see if the xcode folder exists, if so they are installed. With this done try rerunning the commad to install the client or try installing netifaces itself using pip and this should resolve the issue.
|
|
|
3. Before procceding with the next steps check if the openstack is installed using the following command "openstack --veersion". This should display the version number which the latest as of the time of writing is the "openstack 6.5.0".
|
|
|
4. To run commands on the openstack client on the cloud it needs to have the right credentials so it can verify the user. In the top right corner of the OpenStack horizon dashboard click the dropdown and they click the download for the OpenStack RC File which will download "admin-openrc.sh" or the equivalent rc file for the relevant user. Source this file in the same directory you want to use the client in with source [file/path/to/file] this will prompt you to enter a password before the file is sourced which will be your relevant users login password.By entering in the correct password it will authorise you to use the client as that user.
|
|
|
5. If you try running the client now it will hang for a while until producing the following exceptions when failing requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='cloud.waltoninstitute.ie', port=5000): Max retries exceeded with url: /v3/auth/tokens (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x108df5890>, 'Connection to cloud.waltoninstitute.ie timed out. (connect timeout=None)'))" and "keystoneauth1.exceptions.connection.ConnectTimeout: Request to http://cloud.waltoninstitute.ie:5000/v3/auth/tokens timed out". These exceptions are due to the client not being able to resolve the url of the controller as there has not been a route set up for it in the hosts file for a DNS entry. This is why it says it is something like "Failed to discover available identity versions when contacting http://cloud.waltoninstitute.ie:5000/v3/. Attempting to parse version from URL.
|
|
|
1. Install pip onto the machine used. On MacOS this can be done using the following command "easy_install pip" and on Ubuntu or Debian based systems it is an apt package install with "apt install python3-pip"
|
|
|
2. Next with pip installed use that to install the packages needed using the requirements file.
|
|
|
To do this you need to use the following command `pip install -r requirements.txt` and have the requirements file in the directory you are running this command or replace the name of the file wih the path to it if it is housed in a different directory.
|
|
|
If when installing on MacOS with a pip install you get an error that reads "ERROR: Failed building wheel for netifaces" this is caused by an outdated version of XCode command line tools. To fix this problem uninstall the command line tools using this guide https://mac.install.guide/commandlinetools/6 then to reinstall run this command "xcode-select --install" which will open a dialog box on the desktop screen asking for confirmation to install these tools. Once the tools are installed run "xcode-select -p" to see if the xcode folder exists, if so they are installed. With this done try rerunning the commad to install the client or try installing netifaces itself using pip and this should resolve the issue.
|
|
|
|
|
|
4. Before procceding with the next steps check if the openstack is installed using the following command "openstack --veersion". This should display the version number which the latest as of the time of writing is the "openstack 6.5.0".
|
|
|
5. To run commands on the openstack client on the cloud it needs to have the right credentials so it can verify the user. In the top right corner of the OpenStack horizon dashboard click the dropdown and they click the download for the OpenStack RC File which will download "admin-openrc.sh" or the equivalent rc file for the relevant user. Source this file in the same directory you want to use the client in with source [file/path/to/file] this will prompt you to enter a password before the file is sourced which will be your relevant users login password.By entering in the correct password it will authorise you to use the client as that user.
|
|
|
6. If you try running the client now it will hang for a while until producing the following exceptions when failing requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='cloud.waltoninstitute.ie', port=5000): Max retries exceeded with url: /v3/auth/tokens (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x108df5890>, 'Connection to cloud.waltoninstitute.ie timed out. (connect timeout=None)'))" and "keystoneauth1.exceptions.connection.ConnectTimeout: Request to http://cloud.waltoninstitute.ie:5000/v3/auth/tokens timed out". These exceptions are due to the client not being able to resolve the url of the controller as there has not been a route set up for it in the hosts file for a DNS entry. This is why it says it is something like "Failed to discover available identity versions when contacting http://cloud.waltoninstitute.ie:5000/v3/. Attempting to parse version from URL.
|
|
|
Request to http://cloud.waltoninstitute.ie:5000/v3/auth/tokens timed out". To resolve this issue we need to add an entry to the hosts file to pint to the right ip for in this case pointing to cloud.waltoninstitute.ie. The entry in the hosts file '/etc/hosts' would be formatted like this.
|
|
|
10.37.93.100 controller cloud.waltoninstitute.ie.
|
|
|
In this case the DNS entry is pointing to the OpenStack controller. This is because the client has the ability to perform CRUD operations on the OpenStack cloud therefore needs access to the controller to perform these operations even if a user does not have permisions to utilize all functions.
|
... | ... | |