Deploying virtual machines to VMware vSphere

Last updated 3 April, 2019

About virtual machines

As a consumer, you can use the HPE OneSphere application UI to deploy resources that the administrator has curated for your assigned projects.

You can then deploy virtual machines from the project based on the images that are made available through the connected VMware vSphere environment.

Deploying virtual machines from HPE OneSphere to VMware environments allows you to specify the cluster, virtual machine profile, and network to connect to the virtual machine. You can then connect a storage volume to the virtual machine.

See also

Deploying a virtual machine to a VMware vSphere private cloud

Virtual machines deployed from HPE OneSphere to a VMware vSphere environment contain the default block storage and contain the compute and memory resources that are defined in the selected image in the catalog.

Prerequisites

The administrator:

Procedure
  1. From the HPE OneSphere main menu, click Projects.

    (Administrator users can click Catalog, and skip steps 2, 3, and 4.)

  2. Click a project that you want to associate with the virtual machine deployment.
  3. On the Projects screen, click Deployments.

    Members of the selected project can view and manage the virtual machine after it is deployed.

  4. From the top right corner, click the plus sign  to the right of Deployments. The Catalog screen opens.
  5. Browse or search the catalog for items labeled VMware Templates, or filter the results to show only VMware templates.

    The template is the software that will be deployed on the virtual machine to create a virtual machine instance. 

    NOTE:

    Windows templates must be prepared with cloud-init and sysprep in VMware vSphere before the images can be used by HPE OneSphere to deploy virtual machines to a VMware private cloud.

  6. Click the three dots in the lower right corner of the catalog item, then select Deploy
    If you selected the item, deselect it to see the three dots.
  7. On the Deploy panel:
    1. Enter a Name for the new virtual machine.

      NOTE:

      Be sure to specify a unique name. HPE OneSphere does not prevent you from specifying a duplicate name if another virtual machine deployment is occurring at the same time.

      Do not specify restricted characters <>={}(),";& in the virtual machine name. These characters are used as dimension values in the HPE OneSphere monitoring service.

    2. From the Project drop-down menu, select the project where the virtual machine will be deployed.
    3. From the Zone drop-down menu, select a zone where the virtual machine will be deployed.
    4. From the Virtual Machine Profile drop-down, select the pre-defined flavor.
  8. Click Customize Deployment.
    1. Click the plus sign  to the right of Networks to display a drop-down list of networks previously assigned to the project by an administrator.

      For information about how to add networks to a project, see Managing projects.

    2. Select the network and click Add. The selected network appears below the list of networks. You can add multiple networks based on your requirements.
    3. (Optional) Paste the contents of a cloud-init file into the text box.

      A cloud-init file allows you to customize the virtual machine instance with a hostname, default locale, and other details. For examples, see http://cloudinit.readthedocs.io/en/latest/topics/examples.html.

    4. (Optional) Under SSH Public Key, click Choose File and browse to a file to upload, or paste a key into the text box.

      Public SSH keys are usually located at ~/.ssh/id_rsa.pub.

      See Creating an SSH public key pair.

  9. Select the network and click Add. The selected network appears below the list of networks. You can add multiple networks based on your requirements.
  10. Click Deploy.

    After the virtual machine is deployed, you can view the details of the created virtual machine in your project.

Updating cluster connections 

For a specific zone, you can update the cluster connection, datastore connection, and the workspaces from which you allow members to access virtual machines in the zone.

Prerequisites

The administrator deployed a virtual machine to the private cloud.

Procedure
  1. From the HPE OneSphere main menu, click Providers.
  2. Click Private Zones.
  3. From the list, click the zone that contains the cluster you want to update.
  4. Click the Update Zone link below the zone name to display the Update Zone panel with the list of available cluster connections.
  5. From the Cluster Connection section, you can activate or deactivate the cluster:
    1. To activate all available clusters, enable the Connect All Available Clusters toggle.
    2. To activate a single cluster, enable the toggle next to the cluster name. Multiple clusters can be enabled at the same time.
    3. To deactivate all clusters, disable the Connect All Available Clusters toggle.
    4. To deactivate a single cluster, disable the toggle next to the cluster name.

    Log in to the VMware vCenter and monitor the activation and deactivation of the cluster.

  6. Click Update Zone.

Creating an SSH public key pair 

Create a key pair to use SSH to log in to a virtual machine instance after it is deployed.

Procedure
  1. Create an SSH public key pair. From the command line of a workstation or PC accessible to the browser used to access HPE OneSphere, enter:
    ssh-keygen -t rsa -f cloud-key

    This command generates two files:

    • cloud-key, a private key you keep secret

    • cloud-key.pub, a public key you enter on the HPE OneSphere Virtual Machine panel

      You enter the public key when you deploy a virtual machine to the public cloud or private cloud.

  2. (Optional) Log in to the deployed virtual machine from the command line.
    ssh -i cloud-key username@vm-instance-ip-address

    You can also log in to the deployed virtual machine in HPE OneSphere. Under Projects, select a deployment, then click the Console icon.

    The console is launched if the proper routing and firewall rules are in place from the host to your local client.

Customizing a Windows virtual machine instance with cloudbase-init and sysprep

HPE OneSphere uses OpenStack software to deploy virtual machines. 

IMPORTANT:

Windows images must be prepared with cloud-init and sysprep in VMware vSphere before the images can be used by HPE OneSphere to deploy virtual machines to a VMware private cloud.

HPE suggests using cloudbase-init from Cloudbase Solutions to automate Windows guest operating system initialization. For more information, see Leveraging cloud-init with HPE OneSphere.

The following procedure describes how to create and modify a Windows VM that you can use to create a template. The template will be automatically imported into the HPE OneSphere catalog when HPE OneSphere is connected to your VMware environment.

Procedure
  1. In VMware vSphere, create a new VM with a single virtual disk with sufficient storage and memory allocations.
  2. Deploy the Windows operating system in the VM.
  3. Install VMware Tools on the VM after Windows installation is complete.

    In the vSphere VM menu, select Guest, then Install/Upgrade VMware Tools.

  4. Install cloudbase-init on the virtual machine.
    1. Download the installer from https://cloudbase.it/cloudbase-init/#download.
    2. Run the installer.
    3. Enter a user name to create a user account in the "Administrators" group, for example, "Admin".
    4. Check the Use metadata password option.
    5. Click Next and wait until the installation completes.
    6. At the end of the installation, select the option to run the Sysprep package to create a generalized image.
    7. Click Finish to close the installer.
  5. (Optional) Modify the configuration settings of cloudbase-init.
    1. Open the file cloudbase-init.conf in an editor. The default location is C:Program Files (x86)Cloudbase SolutionsCloudbase-Initconfcloudbase-init.conf on the new VM.
    2. Modify the file with details specific to your environment. Following is an example cloudbase-init.conf file.

      See http://cloudbase-init.readthedocs.io/en/latest/userdata.html for more information.

      [DEFAULT]
      username=Admin
      groups=Administrators
      inject_user_password=true
      config_drive_raw_hhd=true
      config_drive_cdrom=true
      config_drive_vfat=true
      bsdtar_path=C:Program FilesCloudbase SolutionsCloudbase-Initbinbsdtar.exe
      mtools_path=C:Program FilesCloudbase SolutionsCloudbase-Initbin
      verbose=true
      debug=true
      logdir=C:Program FilesCloudbase SolutionsCloudbase-Initlog
      logfile=cloudbase-init.log
      default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
      logging_serial_port_settings=
      mtu_use_dhcp_config=true
      ntp_use_dhcp_config=true
      local_scripts_path=C:Program FilesCloudbase SolutionsCloudbase-InitLocalScripts
  6. Create a template from the VM. This template is imported into the HPE OneSphere Catalog, and can be selected when deploying virtual machines from your project in HPE OneSphere.

    See "Clone a Virtual Machine to a Template in the vSphere Web Client" in VMware Documentation.

Customizing Windows VM and accessing it through a remote desktop session

As an administrator, customizing a Windows virtual machine helps you to load the VM easily, which in turn allows you to access the virtual machine through a remote desktop session.

Prerequisites
Procedure
  1. Launch the HPE OneSphere portal URL in a supported web browser.
  2. From the HPE OneSphere main menu, select Providers
  3. From the Providers screen, select Private Zones.
  4. From the Private Zones screen, click the Open Advance Console link.
  5. On the top right of the Private Cloud Control screen, click the Region drop-down list and select the zone of your choice.
  6. On the top right of the Private Cloud Control screen, click the Tenant drop-down list and select the project of your choice.
  7. From the Private Cloud Control main menu, select Images

    NOTE:

    The template created using Custom attributes on Microsoft Windows images are listed on the Imported Image screen.

  8. From the Private Cloud Control main menu, select Instances and click +New VM Instance.
  9. Select the Windows Image with Cloudbase-init installed. See Customizing a Windows virtual machine instance with cloudbase-init and sysprep.
  10. On the New VM Instance screen, select Flavor and click Next.
  11. On the New VM Instance screen, select Network(s) and click Next.
  12. On the New VM Instance screen, select Instances and click Next.
  13. In the cloud-config textbox, paste the appropriate customization script for Windows VM customization.

    For example: if you want to change the time zone, then enter the following script in the cloud-config textbox.

    #ps1_x86
    rem cmd
    tzutil /s "India Standard Time"
  14. Click Finish.
  15. Click Create Instance and Capture the projected password.
  16. Log in to remote desktop session and access the virtual machine using the IP address provided on the Instance menu. 

    NOTE:

    Use the password captured in the previous step at first login.

    Result: The virtual machine is customized, time zone is changed, and the disk size has expanded to the flavor size.

    After the first boot, it takes 7-8 minutes to reflect the customized changes.

Custom attributes on Microsoft Windows images

When a Windows image (VMDK file) is automatically uploaded to HPE OneSphere from your VMware vCenter environment, the OpenStack Glance service may populate incorrect values for your SCSI controller (vmware_adaptertype) and for your NIC type (hw_vif_model). Examine the output from the glance image-create command to verify the correct settings.

  • If you are using a virtual SCSI controller, the vmware_adaptertype property might be incorrectly set to lsiLogic instead of lsiLogicsas. You can change the property using the command:

    glance image-update --property vmware_adaptertype=lsiLogicsas <vm-id>
  • If you did not specify a value for hw_vif_model, the default VirtualE1000 is used. For a Windows instance, use a Vmxnet3 virtual NIC (VirtualVmxnet3).

    glance image-update --property hw_vif_model=VirtualVmxnet3 <vm-id>

Following are the values of hw_vif_model for various adapter types.

Adapter Type

Value of hw_vif_model

E1000 (default)

VirtualE1000

E1000e

VirtualE1000e

Flexible

VirtualPCNet32

Vmxnet

VirtualVmxnet

Vmxnet3

VirtualVmxnet3

For more information, see Create or update an image (glance) and Images with VMware vSphere from OpenStack Documentation.