Downloading vSphere Templates into Image Catalog

You can download vSphere templates into your PMO image catalog 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

 mkfs -t xfs /dev/sdb
  • Mount the hard drive
mkdir /template_stage_dir && mount /dev/sdb /template_stage_dir
  • Verify that the mount succeeded using the following command
df -h 

You should see a new entry similar to:

 /dev/sdb    497M     164MB    333M    33%    /template_stage_dir
  • 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.
chown pf9 /template_stage_dir
chgrp pf9group /template_stage_dir
  • Configure Glance to use this stage directory
vmware_template_support -s /template_stage_dir

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
openstack image save --file <file_name_to_download_to> <openstack_image_id>

</openstack_image_id></file_name_to_download_to>

  • Upload an OVA using the OpenStack command line
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"

</image_name></ova_file_name_specified_above>

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, ”,  &, +, ?, ;, !, #, [, ]