Windows Server 2016 Technical Preview 5 brings a new feature called VM Start Order. It enables to make dependencies between VMs or groups of VMs to start the server in the good order. Think about a complex service based on multi-tier as Active Directory, Databases, Web Servers and application servers. To start the service, you should start in this order the domain controllers then databases, application services and to finish web servers. VM Start Order feature enables you to force these dependencies.
Currently this feature can be managed only from PowerShell and for clustered virtual machines and it is available only from Windows Server 2016 Technical Preview 5.
Lab overview
To make this topic, I have deployed a four nodes Hyper-V virtual cluster based on Hyper convergence (Hyper-V and Storage Spaces Direct). The cluster is called lyn-hc01. Then I have created four VMs:
- ActiveDirectory: this is the domain controller VMs
- Databases01 & Databases02: these VMs are the SQL Server
- Application: this is the application VM
In this topic I’ll make the dependencies as below:
So I’ll create two sets called DomainController and Databases. The ActiveDirectory VM will be member of DomainController set and Databases01 & Databases02 VMs will be member of databases set. Then Application will be dependent of Databases set, and Databases will be dependent of ActiveDirectory.
PowerShell cmdlet
To get cmdlet related to VM Start Order, I run the below command.
In PowerShell Failover Cluster module, a cluster group is a resource of the cluster as virtual machines. A set is a group of virtual machine with the same role. Thanks to set, you can make a dependency between a VM and a group of VMs (or between groups of VMs). To manage these set, you can use the following cmdlets:
- New-ClusterGroupSet: cmdlet to create a set
- Get-ClusterGroupSet: cmdlet to get information about the set
- Set-ClusterGroupSet: cmdlet to edit settings of the set
- Remove-ClusterGroupSet: cmdlet to delete a set
- Add-ClusterGroupToSet: cmdlet to add a VM to the set
- Remove-ClusterGroupFromSet: cmdlet to remove a VM from the set
The following cmdlet enables to manage the dependencies between VMs or a set and VM:
- Add-ClusterGroupDependency: cmdlet to add a dependency
- Get-ClusterGroupDependency: cmdlet to get existing dependency
- Remove-ClusterGroupDependency: cmdlet to delete a dependency
The following cmdlet enables to manage the dependencies between two sets:
- Add-ClusterGroupSetDependency: cmdlet to add a dependency involving two sets
- Get-ClusterGroupSetDependency: cmdlet to get information about dependency involving two sets
- Remove-ClusterGroupSetDependency: cmdlet to delete a dependency involving two sets
To get the virtual machine cluster group, you can run the following cmdlet:
Manage the sets
To create the sets, I use the cmdlet New-ClusterGroupSet as below:
$Cim = New-CimSession lyn-hc01 New-ClusterGroupSet -Name DomainController -CimSession $Cim New-ClusterGroupSet -Name Databases -CimSession $Cim
Then I add member to group by using the following cmdlet:
$Cim = New-CimSession lyn-hc01 Add-ClusterGroupToSet -Name Databases -Group Databases01 -CimSession $Cim Add-ClusterGroupToSet -Name Databases -Group Databases02 -CimSession $Cim Add-ClusterGroupToSet -Name DomainController -Group ActiveDirectory -CimSession $Cim
In the above screenshot, you can see VMs that belong to a set in the property ProviderNames.
If you want remove a VM from a set, you have just to run the following cmdlets:
$Cim = New-CimSession lyn-hc01 Remove-ClusterGroupFromSet -Name Databases -Group Databases01 -CimSession $Cim
Manage dependencies between a VM and a set
Now that sets are created and VMs belong to them, we can create the dependencies. First I create the dependency between the Application VM and the set Databases:
$Cim = New-CimSession lyn-hc01 Add-ClusterGroupDependency -Group Application -ProviderSet Databases -CimSession $Cim
I have made a video to show you that it’s working:
Manage dependencies between sets
Now we have to make the dependency between the set databases and DomainController. In this way, when Application VM will start, the domain controller will be started first. To create the dependency, I run the following cmdlets:
I have made a second video to show you that all is working:
Have fun with VM Start Order J