Deploying a virtual machine using the OpenStack Nova CLI (Test only)

Last updated 23 July, 2018

Deploying a virtual machine using the OpenStack CLI 

The following procedure describes how to deploy a virtual machine instance in a connected private zone using the OpenStack Nova networking service.

OpenStack commands cannot be used on deployments without Neutron services, because the network endpoints are not configured to use Nova.

TIP:

Steps 4 through 14 list the available operations.

Slide the scroll bar to see the full width of command line examples.

Prerequisites
  • HPE OneSphere portal is up and running.

  • VMware ESXi environment is connected to HPE OneSphere as a private cloud zone.

  • A proxy connection is configured, and no_proxy is set for the HPE OneSphere Controller VM.

  • OpenStack Glance endpoints are reachable.

  • A virtual machine instance where the OpenStack Nova client is installed is in the same network as the HPE OneSphere Controller VM.

  • For creating volumes from images, images are uploaded using glance image-create. Currently, vSphere templates cannot be used for creating volumes. The volume is marked bootable and instances can be created from this volume.

Procedure
  1. Install python-novaclient version 7.0.0 on a Linux machine.
    # pip install python-novaclient=7.0.0
  2. Source the OpenStack RC file. See Sourcing your OpenStack RC file for details.
  3. Set the environment variable for the proxy server you want to use in the OpenStack RC file.
    export http_proxy=http://<server-ip>:<port>/
    export https_proxy=http://<server-ip>:<port>/
    export no_proxy=http://<Glanceserver-ip>/

Creating images and networks for KVM servers using the OpenStack Neutron CLI 

Before deploying a virtual machine to a KVM server, you must create an image and a network using the OpenStack CLI.

Prerequisites

The administrator:

  • Connected a KVM server to HPE OneSphere using HPE OneSphere Connect.

  • Enabled the KVM server in the Server Connection section of the Providers > Private Zones > Update Zone screen in the HPE OneSphere portal.

  • Created a project. Select the project in the HPE OneSphere portal in your browser, and note the project ID at the end of the URL. An example is shown in bold below, beginning with 2b64. The project ID is required while creating a network.

    Example: /project?uri=%2Frest%2Fprojects%2F2b64d9fa5f3b4e99bbd62986aaed828c

Procedure
  1. Log in to the KVM server where the OpenStack CLI is installed and source the OpenStack RC file. See Installing OpenStack CLI clients for more information.
  2. (Optional) Configure high availability for the image library on KVM servers.
  3. Create an image using one of the following methods.
    1. Use the OpenStack CLI to create an image.
      openstack image create --disk-format <disk format> --container-format 
       <container format> --public --file <image file with path> <image name>
    2. Download and copy an existing image to /var/opt/hpe/imagelibrary/data/ on the KVM server where the Image Library role is enabled.

      NOTE:

      • The server on which you are executing OpenStack commands must be in the same network as the KVM server where the Image Library role is enabled.

      • If you configured a proxy server when you connected HPE OneSphere to the KVM server where the Image Library role is enabled, exclude the server's IP address from your proxy configuration.

  4. Create a network.
    neutron net-create --provider:physical_network <physnet-name> 
    --provider:network_type vlan --provider:segmentation_id <vlan-id> <network-name>

    NOTE:

    You must obtain the physnet-name from the enabled KVM server. If the bridge that is created in the KVM server is br-physnet1, the physnet name will be physnet1.

  5. Create a subnet.
    neutron subnet-create <net-name> <cidr>
  6. Assign the network to the respective project.

    Obtain the project ID by selecting the project in the HPE OneSphere portal in your browser. The project ID is appended to the URL.

    neutron rbac-create --target-tenant <project-id> --action access_as_shared --type network 
    <network-id>

    NOTE:

    Do not use the OpenStack client for this network to project association. Use the neutron client only, as in the above example.

    NOTE:

    It takes approximately 10 minutes to reflect the newly created image and network in the HPE OneSphere portal.

(Previous version) Deploying a virtual machine using the OpenStack Nova CLI

The following topic described how to deploy an instance (virtual machine) on a private cloud with nova networking service. For the successful installation, ensure to install withpython-novaclient the version 7.0.0.

NOTE:

OpenStack commands cannot be used on deployments without Neutron services since the network endpoints are not configured to use Neutron.

Prerequisites
  • HPE OneSphere web portal is up and running.

  • VMware ESXi environment is on-boarded with a given zone.

  • Set a proxy connection.

  • Glance endpoints should be reachable. Set no_proxy settings for gateway VM.

  • An instance from where nova clients are used must be in the same network as HPE gateway

  • For creating volumes from images, use the images which are uploaded using glance image-create. Currently, vSphere templates cannot be used for creating volumes. The volume is marked bootable and instances can be created from this volume.

Procedure
  1. Install python-novaclient on any Linux machine to use OpenStack CLI.
    # pip install python-novaclient=7.0.0
    Refer OpenStack Client documentation for setting up OpenStack clients and other environmental details.
  2. Source the OpenStack RC file.
  3. Set the environment variable for the proxy server you want to use in the OpenStack RC file.
    export http_proxy=http://<server-ip>:<port>/
    export https_proxy=http://<server-ip>:<port>/
    export no_proxy=http://<Glanceserver-ip>/

    You can create an instance from an image or a bootable volume.

(Previous version) Creating images and networks for KVM servers using the OpenStack Neutron CLI 

Before deploying a virtual machine to a KVM server, you must create an image and a network using the OpenStack CLI.

Prerequisites

The administrator:

  • Connected a KVM server to HPE OneSphere using HPE OneSphere Connect.

  • Enabled the KVM server in the Server Connection section of the Providers > Private Zones > Update Zone screen in the HPE OneSphere portal.

  • Created a project. Select the project in the HPE OneSphere portal in your browser, and note the project ID at the end of the URL. An example is shown in bold below, beginning with 2b64. The project ID is required while creating a network.

    Example: /project?uri=%2Frest%2Fprojects%2F2b64d9fa5f3b4e99bbd62986aaed828c

Procedure
  1. Log in to the KVM server where the OpenStack CLI is installed and source the OpenStack RC file. See Installing OpenStack CLI clients for more information.
  2. (Optional) Configure high availability for the image library on KVM servers.
  3. Create an image using one of the following methods.
    1. Use the OpenStack CLI to create an image.
      openstack image create --disk-format <disk format> --container-format 
       <container format> --public --file <image file with path> <image name>
    2. Download and copy an existing image to /var/opt/hpe/imagelibrary/data/ on the KVM server where the Image Library role is enabled.

      NOTE:

      • The server on which you are executing OpenStack commands must be in the same network as the KVM server where the Image Library role is enabled.

      • If you configured a proxy server when you connected HPE OneSphere to the KVM server where the Image Library role is enabled, exclude the server's IP address from your proxy configuration.

  4. Create a network.
    neutron net-create --provider:physical_network <physnet-name> 
    --provider:network_type vlan --provider:segmentation_id <vlan-id> <network-name>

    NOTE:

    You must obtain the physnet-name from the enabled KVM server. If the bridge that is created in the KVM server is br-physnet1, the physnet name will be physnet1.

  5. Create a subnet.
    neutron subnet-create <net-name> <cidr>
  6. Assign the network to the respective project.

    Obtain the project ID by selecting the project in the HPE OneSphere portal in your browser. The project ID is appended to the URL.

    neutron rbac-create --target-tenant <project-id> --action access_as_shared --type network 
    <network-id>

    NOTE:

    Do not use the OpenStack client for this network to project association. Use the neutron client only, as in the above example.

    NOTE:

    It takes approximately 10 minutes to reflect the newly created image and network in the HPE OneSphere portal.