Download vSphere Templates into OpenStack Glance

Platform9 release 2.1 adds the ability to download discovered vSphere templates into OpenStack Glance.

How It Works

  • vSphere templates can be downloaded using the download command on the OpenStack command line, which will export the template as an OVA and download to the client.
  • Template download requires staging of the OVA on the appliance before passing it to the client. This, in turn, requires adding a new disk to the VMware gateway appliance with capacity at least as much as the template being downloaded.
  • Once the template is downloaded as a OVA, it can be uploaded to Glance using the image create command in the OpenStack command line.
  • Provisioning an instance out of an OVA deploys the OVA as a base template under folder pf9_ova, which is used for any future instance provisioning. This base template for the OVA is hidden and is not displayed in Platform9 UI.

Configure VMware Appliance for Enabling Download Support

  • Add an additional hard disk for the VMware gateway appliance in vCenter.
    In vCenter UI, add a hard disk to the appliance VM using Edit Settings.
    Choose the disk size to be at least the size of largest template in the environment.
  • If multiple templates are to be downloaded simultaneously,  the disk size should be at least the sum of the sizes of the templates being downloaded.
  • Configure the disk to be thin provisioned.
  • Reboot the gateway appliance after the hard disk has been added in vCenter UI.
  • Find the added hard disk’s name in appliance VM
    If this is the second hard disk added to the gateway appliance, the device name in the appliance VM will be /dev/sdb. If more hard disks have been added, find the device name as described here.
  • Build a file system for the hard disk
    [bash] mkfs -t xfs /dev/sdb[/bash]
  • Mount the hard drive
    [bash]mkdir /template_stage_dir & mount /dev/sdb /template_stage_dir[/bash]
  • Verify that the mount succeeded using the following command
    [bash]df -h [/bash] You should see a new entry similar to:
    [bash] /dev/sdb    497M     164MB    333M    33%    /template_stage_dir[/bash]
  • Modify user and group
    Modify the  /template_stage_dir to be owned by pf9 user and pf9group for Platform9 services to be able to access it.
    [bash]chown pf9 /template_stage_dir[/bash] [bash]chgrp pf9group /template_stage_dir[/bash]
  • Configure Glance to use this stage directory.
    [bash]vmware_template_support -s /template_stage_dir[/bash]

OpenStack Command Line

Install the OpenStack command line client on a machine that is on the same network as the appliance. Source the OpenStack RC file that can be found in Platform9 UI under Access and Security → API Access

  • Download a template using OpenStack command line
    [bash]openstack image save –file <file_name_to_download_to> <openstack_image_id>[/bash]
  • Upload an OVA using the OpenStack command line
    [bash]openstack image create –disk-format vmdk –container-format ova –file <ova_file_name_specified_above> –visibility public –name <image_name> –property pf9_descrption=”Some description”[/bash]

Caveats

Certain special characters in vCenter credentials, datacenter, datastore, template name and cluster do not work with this feature. Special characters that are known to not work include %, =, /, <, >, Space, ”,  &, +, ?, ;, !, #, [, ]

The browser you are using is outdated. For the best experience please download or update your browser to one of the following:

Leaving VMware? Get the VMware alternatives guideDownload now