How to work with DreamCompute in Windows

Overview

It is possible to use the OpenStack command-line interface on a Windows computer by installing the following:

  • Python
  • pip
  • 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

  1. Download the latest Python release from Python's website:

    This article uses Python 3.8.4.

    downloading python3
  2. After clicking the most recent Python 3 release, choose to download the Windows X86-64 executable installer.
  3. Install Python by double-clicking the file you just downloaded.
downloading python3

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.

Windows 10

  1. On the bottom left, type 'cmd' into the search bar.
  2. Click on the 'Command Prompt' icon to open it
  3. In the command prompt, enter the following:
    C:\Users\username> pip3 install python-openstackclient
    

Error message

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:

  1. Download the vs_buildtools.exe file.
  2. Click the file to run it.
  3. A pop-up window displays.
    • Under 'Desktop & Mobile' select 'C++ build tools'.
  4. 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.

  1. Locate the saved file in Windows Explorer.
  2. 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:

Troubleshooting

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:

  1. In your command prompt, navigate to the directory your openrc.bat file is located.
  2. 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.

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?