It is possible to use the OpenStack command-line interface on a Windows computer by installing the following:
- C++ Build tools
- The OpenStack client
You must then set some environment variables for your Windows user. You will then be able to use Windows Command Prompt or Windows PowerShell to manage your DreamCompute project.
Windows PowerShell is a command line and scripting environment. It excels at task automation and configuration management.
For help installing/locating Windows PowerShell, see Microsoft's documentation here.
Step 1 — Install Python and pip
- Download the latest Python release from Python's website:
This article uses Python 3.8.4.
- After clicking the most recent Python 3 release, choose to download the Windows X86-64 executable installer.
- Install Python by double-clicking the file you just downloaded.
Make sure that the checkbox titled 'Add Python 3.8 to PATH' is checked before proceeding through the installation wizard.
Step 2 — Install the OpenStack client
Use the command prompt to install the OpenStack client.
- On the bottom left, type 'cmd' into the search bar.
- Click on the 'Command Prompt' icon to open it
- In the command prompt, enter the following:
C:\Users\username> pip3 install python-openstackclient
When installing you may see this error.
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
To fix this:
- Download the vs_buildtools.exe file.
- Click the file to run it.
- A pop-up window displays.
- Under 'Desktop & Mobile' select 'C++ build tools'.
- Click Install
After C++ Build tools has been installed, run the command again to install the openstackclient.
Step 3 — Set environment variables
You must now set environment variables for your Windows user so your OpenStack client commands are authenticated against your project. The easiest way to do this is to download your openrc file, modify/re-save it as a Windows batch file, and execute it once.
Downloading your openrc file
View the following article for instructions:
Modify the file
Once you've downloaded your openrc file, you'll need to modify/re-save it as a batch file. Open the file in a text editor like Notepad and remove everything except the following lines:
export OS_AUTH_URL=https://iad2.dream.io:5000/v2.0 export OS_TENANT_ID=tenantid export OS_TENANT_NAME="tenantname" export OS_USERNAME="username"
Make the following adjustments to the file:
- Replace all instances of 'export' with 'setx'
- Place double quote marks (") around all of your variable values (i.e. "https://iad2.dream.io:5000/v2.0", "tenantid", etc.).
- Replace the = sign with a space
- Add a line using OS_USERNAME to store your DreamCompute password
The file should now look like this:
setx OS_AUTH_URL "https://iad2.dream.io:5000/v2.0" setx OS_TENANT_ID "tenantid" setx OS_TENANT_NAME "tenantname" setx OS_USERNAME "username" setx OS_PASSWORD "password"
Save the file with the extension 'bat' (example: dhc-openrc.bat).
Make sure that the file isn't saved with an additional .txt extension or Windows will not be able to execute the script.
Execute the file
You must now execute the script as an administrator.
- Locate the saved file in Windows Explorer.
- Right-click and select the 'Run as administrator' option.
After running the script, all necessary environmental variables should be set. However, they are not set in your current Shell session. You must now quit your current shell session and open a new one.
Open a new cmd prompt
Quit your current shell session by typing exit. Finally, open a new cmd prompt. Your environmental variables will now be active. You can confirm my running the command set.
You can now use the OpenStack command line client to manage your DreamCompute project. For a review of some of the basic commands, view the following article:
Check your environment variables
If you're having issues connecting, double-check your environment variables. You can do this either from the System Properties Control panel area, Windows PowerShell, or the Windows Command Prompt. In Windows PowerShell, run this command:
C:\Users\username> Get-ChildItem Env:OS_* Name Value ---- ----- OS_USERNAME username OS_TENANT_NAME tenantname OS_AUTH_URL https://iad2.dream.io:5000/v2.0 OS_TENANT_ID tenantid
In Windows Command Prompt, run this command:
C:\Users\username> set|findstr OS_ OS_AUTH_URL=https://iad2.dream.io:5000/v2.0 OS_TENANT_ID=tenantid OS_TENANT_NAME=tenantname OS_USERNAME=username
Re-save your openrc.bat file
If you find your OS_ variables are not present, view Step#3 above to save your openrc.bat file correctly. You can confirm if the variables are set properly by manually running the file. For example:
- In your command prompt, navigate to the directory your openrc.bat file is located.
- Run the file by typing its name, then pressing the Enter key. You should see the following output:
The following command assumes you've named the file dhc-openrc.bat.
C:\Users\username\Downloads> dhc-openrc.bat C:\Users\username\Downloads>setx OS_AUTH_URL "https://iad2.dream.io:5000/v2.0" SUCCESS: Specified value was saved. C:\Users\username\Downloads>setx OS_TENANT_ID "################################" SUCCESS: Specified value was saved. C:\Users\username\Downloads>setx OS_TENANT_NAME "#####" SUCCESS: Specified value was saved. C:\Users\username\Downloads>setx OS_USERNAME "########" SUCCESS: Specified value was saved. C:\Users\username\Downloads>setx OS_PASSWORD "################################" SUCCESS: Specified value was saved.