Different datastores for different disks with vpshere provider

Continuing the discussion from How to provide additional disk for Longhorn in Rancher because I am not allowed to reply more times:

My idea is not to create a datastore cluster because I want to be able to select manually the datastores of each virtual disks to control the performance/capacity of each virtual disk.

This is the vmware template I have:

  • 1st disk, OS of the node: vSAN SSD fast datastore
  • 2nd disk, longhorn fast disk: vSAN SSD fast datastore. The template mounts the disk on /var/lib/longhorn. I can use disk selector ‘sdd’ in longhorn to use this storage.
  • 3rd disk, longhorn slow disk: HDD NFS datastore. The template mounts the disk on /var/lib/longhorn-slow. I can use disk selector ‘hdd’ in longhorn to use this storage.

However, when the vsphere provider deploys this template, all disks are deployed in the vSAN Datastore.

I think the only solution is to once deployed migrate manually the third virtual disk to the desired Datastore… This is a manual process and I need to have space in vSAN to temporary locate all disk to be manually migrated later…


Consider assigning the disk at the template level (the ‘VM storage policy’ parameter defined at the level of a specific disk) to an appropriately defined policy specifying storage compatible with it (in your case NFS datastores).


I specified different storage policies for the template:

  • vSAN Storage policy for the machine config, OS disk and first longhorn disk
  • NFS Storage policy for the second longhorn disk

However when I provision with rancher, It deploys machine configuration and all the virtual disks in the same datastore: the datastore I select in the pool form. After provisioning, I see the virtual machine is non-complaint with the storage policy. And I need to migrate the third virtual disk to one NFS Datastore to be compliant.

So, the vSphere provisioner does not take into account the VM Storage Policies of the template to deploy the nodes right.

In the context of Storage Policy, its action was to migrate a specific disk to the appropriate storage after creating VMs from the template and entering a non-complaint state with the storage policy,
However, in order for the automation based on Storage Policies to work you need a Datastore Cluster configuration, which, however, in this case is excluded due to the NFS datastores :expressionless:
From what you can see, there is nothing else but a scheduled task of a cyclically executed script, which will perform the appropriate migration according to the assumed configuration.