vCloud Director abstracts many vSphere features. One example is vApp or VM datastore placement. In the current VCD version (1.5.x) end-users do not have any control over which datastore will be used for placement of their virtual disks other then selection of appropriate Org VDC. Org VDCs are carved out Provider VDCs where the datastore assignment is done by vCloud Administrator.
The algorithm that vCloud Director uses for the datastore selection is quite simple and if no fast provisioning (aka linked clones) is used the one with the most free space is selected.
During my recent VCD implementation my customer had vSphere virtualization policy of using dedicated VM Swap local datastores. This is a common practice driven by being economical and not wasting expensive shared storage for virtual machine swap files. The decision of placing VM Swap files is done in vSphere on cluster level and each cluster host can use different datastore. This creates interesting situation when vCloud Director asks vSphere to create a VM on particular datastore but vSphere (after powering on the VM) creates the swap on different one. If the swap datastore is not managed by the Provider VDC an error message is displayed:
“Virtual Machine is on a datastore not managed by vCloud Director”
Although everything still works it is not nice to see such an error particularly for the end user who knows nothing about the underlying infrastructure. Also it might have impact on Chargeback in service provider implementations where swap storage will not be charged for. It is not an option to assign this swap datastore(s) to the Provider VDC as they will be used for vApp/VM placement and nobody wants to run their VMs off the local datastore (low performance, no HA/DRS).
Does this mean that dedicated swap datastore policy cannot be used in vCloud Director environment? Fortunately there is a way out of this. Add all the swap datastores to the Providers VDC and disable them. The disable feature is usually used when the VCD Administrator does not want vCloud Director to put any more VMs on given datastore – for example during maintenance/storage migration. In our case vCloud Director does not complain anymore because the datastore is managed by VCD but it does not place any VMs there. Following screenshot shows a Provider VDC with 5 shared datastores and 4 local swap datastores.