Today I was asked about the following configuration:
A user has a stretched Hyper-V cluster running between two datacenters. This stretched cluster is sitting on top of replicated storage. However, the storage appears in a different location on either side of the cluster. How can this be made to work?
So the configuration is like this:
The problem is that when a virtual machine moves from one side of the cluster to the other – it needs to have its storage path changed automatically.
Fortunately, Hyper-V has all the infrastructure you need for this. The key piece of technology to use here is Hyper-V storage resource pools. Hyper-V storage resource pools allow you to remove path details from the virtual machine configurations.
For this configuration what I want to do is to:
- Create a storage resource pool – with the same name – on each node in the cluster.
- Configure the storage resource pool to point to the right storage path for each node.
- Configure my virtual machines to utilize this storage resource pool.
Creating the storage resource pool is done using PowerShell.
On the first two nodes I want to run this command:
New-VMResourcePool -Name "VHDs" -ResourcePoolType VHD -Paths "E:"
Then on the second two nodes I want to run this command:
New-VMResourcePool -Name "VHDs" -ResourcePoolType VHD -Paths "F:”
Once I have configured these storage resource pools – the Hyper-V UI will magically detect them. Now when I go to configure the virtual hard drives I see a resource pool option:
Once I have selected the appropriate resource pool – I can now move this virtual machine (with import / export, quick migration or live migration) and the virtual hard disk path will be automatically updated to the correct path for the Hyper-V host it is running on.