A couple of weeks back I had the pleasure of meeting Anders Madsen who is the lead engineer for the very popular and useful tool called ovftool. While having a discussion on a variety of topics with Anders I came to learn about a cool little feature of the OVF specification call Dynamic Disks. This lesser-known feature has actually been around since OVF 1.1 but I suspect that most people have probably not heard of this capability unless you are intimately familiar with the OVF format which I I know I am not.
When you deploy an OVF you are pretty much deploying a static pre-configured Virtual Appliance that contains a certain amount of cpu, memory and storage. One can easily increase the CPU/Memory of the appliance after provisioning or leverage OVF's Flexible Deployment Options during the deployment of an OVF. On the Storage front it is a bit more difficult since the maximum capacity of each virtual disk is already pre-defined. Similar to CPU/Memory, once the OVF has been deployed you can easily extend the virtual disk(s) but you must also ensure you extend it in the guestOS either manually or automatically using built-in intelligence from the application.
What would be really nice is to have the ability to specify the capacity of a given set of virtual disks during deployment run-time instead of relying on a fixed capacity which is what Dynamic Disks allows you to do. This capability is only applicable for empty virtual disks and does not apply to virtual disks that already contain data such as an operating system or data disk. A great use case for such a feature could be an NFS Server Virtual Appliance where you would have an OS installed on the first virtual disk and then a couple other virtual disks that would be used for the underlying NFS Server volumes. Instead of having a fixed size for the NFS Server Virtual Appliance, it can be dynamically configured during deployment and it is up to the application to have the appropriate logic to handle the setup of the virtual disks during first bootup.
Here is an example of what this would like when deploying an OVF using Dynamic Disks:
You can see from the above screenshot, the OVF I am deploying contains two Dynamic Disks which have a default value of 5GB and 10GB. However, during the deployment I can change these default values to something different.
Instead of of 5GB and 10GB, I decided to change it to 10GB and 15GB and these values will be reflected by the platform that will be used to deploy the OVF whether that is vSphere, Fusion or Workstation. Another great use case for Dynamic Disks is to update the OVF I built to quickly help setup and test VMware VSAN (Virtual SAN) using Nested ESXi. The OVF that I created contains three empty virtual disks: 2GB for ESXi installation, 4GB for virtual SSD and 8GB for mechanical disk. Instead of requiring a user to reconfigure the virtual disks after deployment, you can now specify the capacity you want for each of the virtual disks using the new OVF that I have created here.
I hope to see more Virtual Appliances take advantage of Dynamic Disks capability as it can be useful for providing customized deployment options while still maintaining the notion of a pre-configured system. If you wish to create your own OVF that utilizes Dynamic Disks, please take a look at the instructions below.
Step 1 - Create a Virtual Machine like you normally would that contains both empty and non-empty virtual disks. In the example I have created a VM in vSphere which contains one virtual disk which would contain an OS (in this example its just empty) and two additional virtual disks (disk 2 and 3) which will be used for Dynamic Disks.
Step 2 - Export the VM to an OVF and delete the virtual disks files that will be used as Dynamic Disks as well as the OVF Manifest file as the contents will change.
Step 3 - Next we will need to make a couple of edits to the OVF descriptor file and the first change is to delete the virtual disks reference entries that will be used for Dynamic Disks. In this example that will be disk2 and disk3 as seen in the screenshot below.
Step 4 - We now need to delete the fileRef property for our two virtual disks located in DiskSection which is usually located at the top of the file. We also need to modify the capacity values into variables that will be used within the OVF file. You can select any name you want for the variable and in this example I chose ${disk1size} and ${disk2size}.
Step 5 - Finally, you need to add two new property entries which is embedded in the ProductionSection of the OVF descriptor and usually located towards the bottom of the file. Also make sure this sits under the VirtualHardwareSection but before the VirtualSystem tag as seen in the screenshot below.
<ProductSection> <Info>Information about the installed software</Info> <Product>NFS Server</Product> <Vendor>virtuallyGhetto</Vendor> <Version>1.0</Version> <Property ovf:key="disk1size" ovf:runtimeConfigurable="false" ovf:type="int" ovf:qualifiers="MinValue(1) MaxValue(10000)" ovf:value="5" ovf:userConfigurable="true"> <Label>NFS Datastore Size for Disk 1</Label> <Description>The size of the disk in gigabytes.</Description> </Property> <Property ovf:key="disk2size" ovf:runtimeConfigurable="false" ovf:type="int" ovf:qualifiers="MinValue(1) MaxValue(10000)" ovf:value="10" ovf:userConfigurable="true"> <Label>NFS Datastore Size for Disk 2</Label> <Description>The size of the disk in gigabytes.</Description> </Property> </ProductSection>
The two disk variables that we defined earlier is used in this section that allows you to specify a default value as well as some additional text that can be displayed for each property. Instead of having you copy/paste from the blog I have provided a sample OVF that consumes Dynamic Disks in which you can use as an example for creating your own. To use this OVF you will need to download the following two files and then import into your environment:
Once you have made all the necessary changes, you can then deploy the new OVF and the OVF wizard should now detect that Dynamic Disks are being used and you should see a message similar to the one below.
Art says
Hi William,
After adding dynamic disk size, I'm getting error: Unsupported value 'disk-size' for attribute 'capacity' on element 'disk'
Can you please help with this?
Edgar Salazar says
William - I had the same issue, after some poking around I found the following: "OVA deployment directly to ESX or ESXi is not supported. You must use VMware vCenter Server (VirtualCenter). To verify the server type, use VMware vSphere Client to select the server in the left column. In the right window, above the Summary tab, you check whether the server is VMware ESX/ESXi or VMware vCenter Server."
Source: http://www.ibm.com/support/knowledgecenter/en/SSNS6R_2.2.0/doc/topics/ICON/topics/tsicn_ovafailsproperty.html
Art says
Edgar - Is there a way to deploy OVF directly to ESXI without having problems with properties ?
varsha says
Not exactly related to this post but related to ovf template customize property. When i m adding ovf:qualifiers="MinLen(1)" to any property into ovf template its adding space into ui(OVF customize property page). You have any solution for this issue and also can we restrict user to move on the next page if password field is blank or password and confirm password does not match.