A First Look at VM Groups and VM Start Ordering in Windows Server 2016 Hyper-V #HyperV #WS2016

10 min read

Introduction

Let’s take a first look at VM Groups and VM Start Ordering in Windows Server 2016 Hyper-V.

As the name implies, VM Groups are logical groupings of multiple VMs which allows you to manage multiple virtual machines much easier.

VM Start Ordering in the other hand, provides better control around starting of VMs and dependencies between clustered virtual machines. This is very important in failover clustering environment where you have multiple virtual machines which are dependent on another VMs. As an example of a complex VM start ordering scenario, is a multi-tier application and all its interdependencies on Domain Controller, SQL Server, IIS Server, Application Server, Load Balancer, etc.

VM Groups

VM Groups is a new feature introduced in Windows Server 2016 Technical Preview 4.

There are two different types of VM Groups:

  • VM collection groups
  • Management collection groups

VM collection groups is a logical collection of virtual machines. This type of group makes it possible to carry out tasks on specific VM groups, rather than having to carry them out on each individual VM separately.
Management collection groups is a logical collection of VM collection groups. With this type of group, you can nest VM collection groups as well. In other words, you can have a management collection group inside another management collection group. The main difference between VM collection groups and management collection groups is that management groups can contain both VM groups and other management groups as well.

The two main scenarios for which Microsoft developed VM groups are for backups and VM replications. In some situations, because of distributed applications, virtual machines should be treated as a single unit instead of managing them individually. This is true in both backup and VM replica situations where you want to backup or replicate a multi-tier application.

The following new PowerShell cmdlets have been added into Hyper-V module to facilitate VM Groups scripting:

Add-VMGroupMember
Get-VMGroup
New-VMGroup
Remove-VMGroup
Remove-VMGroupMember
Rename-VMGroup

At the time of writing, VM group management tools are still being developed and they are managed through Windows PowerShell only.

Let’s now look on how to create and manage VM collection groups and Management collection groups with Windows PowerShell.

VM Collection Groups

In this example, we will create a VM Collection Group and place three virtual machines in it.

# Create new VM Group
New-VMGroup -Name VMCLGR01 -GroupType VMCollectionType –Verbose

VMGrouping-VMStartOrdering-02

Please note the Group Type is “VMCollectionType”. Only VM collection group can have virtual machines directly placed within them.

VMGrouping-VMStartOrdering-03

Next, we will add three VMs to VM Group called “VMCLGR01”.

VMGrouping-VMStartOrdering-14

# Add VMs to VM Collection Group
Add-VMGroupMember -VMGroup (Get-VMGroup VMCLGR01) -VM (Get-VM WS-VM001) -Verbose
Add-VMGroupMember -VMGroup (Get-VMGroup VMCLGR01) -VM (Get-VM WS-VM002) -Verbose
Add-VMGroupMember -VMGroup (Get-VMGroup VMCLGR01) -VM (Get-VM WS-VM003) -Verbose

VMGrouping-VMStartOrdering-04

You can verify the VMs that are belong to VM Group “VMCLGR01” by utilizing either Get-VM or Get-VMGroup cmdlets, respectively:

Get-VM | ft Name, State, Groups -AutoSize

VMGrouping-VMStartOrdering-05

Get-VMGroup VMCLGR01 | ft Name, VMMembers -AutoSize

VMGrouping-VMStartOrdering-06

You can add one of the existing VMs to the membership of a second group as well.
Here is a quick PowerShell script that will do just that:

# Create new VM Group
New-VMGroup -Name VMCLGR02 -GroupType VMCollectionType –Verbose
# Add VMs to VM Collection Group
Add-VMGroupMember -VMGroup (Get-VMGroup VMCLGR02) -VM (Get-VM WS-VM002) -Verbose

# Get-VM, we can see that WS-VM002 now belongs to both the VMCLGR01 Group and the new VMCLGR02 Group
Get-VM | ft Name, State, Groups -AutoSize

VMGrouping-VMStartOrdering-07

As you can see, there are now two VM groups: one group comprising of three VMs, and the second one with single VM as shown in the following figure:

VMGrouping-VMStartOrdering-15

VMGrouping-VMStartOrdering-16

Get-VMGroup * | ft Name, VMMembers -AutoSize

VMGrouping-VMStartOrdering-08

With the two VM groups created, we can start interacting directly with WS-VM001, WS-VM002, and WS-VM003 virtual machines by utilizing “VMCLGR01” VM Group, and we can perform actions directed only at WS-VM002 by utilizing “VMCLGR02” VM Group.

In the following example, we will enable VM replication by utilizing VMCLGR01 VM Group:

# Enable VM Replication
Enable-VMReplication -VM (Get-VMGroup VMCLGR01).VMMembers -ReplicaServerName WS16TP5-HV02 -ReplicaServerPort 80 -AuthenticationType Kerberos `
 -CompressionEnabled 1 -ReplicationFrequencySec 30 -AutoResynchronizeEnabled 1 -Verbose

# Start VM Replication
Start-VMInitialReplication -VM (Get-VMGroup VMCLGR01).VMMembers -Verbose

# Get VM Group
(Get-VMGroup VMCLGR01).VMMembers | ft Name, State, Status, ReplicationMode, ReplicationHealth –AutoSize

VMGrouping-VMStartOrdering-09

VM Collection Groups are fairly simple. They maintain a membership of virtual machines, those VM groups contain actual VMs.

Management Collection Groups

The Management Collection Groups, on the other hand, maintain a membership of VM Collection Groups. Please note that VMs cannot directly belong to the membership of a management collection.

The group name for VM and Management collection groups might be confusing a little bit, in order to differentiate between both groups, we can refer to the collection group using the first name “VM” (membership of individual virtual machines), and “Management” (membership of VM groups).

The creation of Management collection groups is nearly identical to creating VM collection groups. The following Windows PowerShell script creates a new management group type “Management” and adds both of the existing VM groups “VMCLGR01” and “VMCLGR02” to it as shown in the following figure:

VMGrouping-VMStartOrdering-17

# Create new Management Collection Group
New-VMGroup -Name MGMTGR01 -GroupType ManagementCollectionType -Verbose

# Add VM Groups (VMCLGR01 and VMCLGR02) to the Management Group
Add-VMGroupMember -VMGroup (Get-VMGroup MGMTGR01) -VMGroupMember (Get-VMGroup VMCLGR01) -Verbose
Add-VMGroupMember -VMGroup (Get-VMGroup MGMTGR01) -VMGroupMember (Get-VMGroup VMCLGR02) –Verbose

VMGrouping-VMStartOrdering-10

In order to see the VM groups and their members, you can run the following script:

# Get-VMGroup, we can see now VM Groups (VMCLGR01 and VMCLGR02) are members of MGMTGR01 management group
Get-VMGroup MGMTGR01 | ft Name, VMGroupMembers -AutoSize

# Get-VMGroup and expand the VMGroupMembers
# We can see now the virtual machines which are members of VM Groups
Get-VMGroup MGMTGR01 | Select -ExpandProperty VMGroupMembers

VMGrouping-VMStartOrdering-11

As mentioned earlier, we can also nest management collection group. In other words, nesting allows you to put management group inside a management group.

This nesting capability opens an entirely new dimension in how you can organize VMs. VMs become objects that you can group much like host groups in Virtual Machine Manager.

In the following example, we will create a new management group named ParentMGTGroup and adds our first management group that we created above “MGMTGR01” to its membership as shown in the following figure:

VMGrouping-VMStartOrdering-18

VMGrouping-VMStartOrdering-12

If you want to delete the management collection group, you need to remove first the VM groups from the management collection and then delete the management group.

The following PowerShell script will allow you to do so:

# Remove VM Group Members from Management Collection
Remove-VMGroupMember -VMGroup (Get-VMGroup MGMTGR01) -VMGroupMember (Get-VMGroup VMCLGR01) -Verbose
Remove-VMGroupMember -VMGroup (Get-VMGroup MGMTGR01) -VMGroupMember (Get-VMGroup VMCLGR02) -Verbose
# Remove Nested Management Collection
Remove-VMGroupMember -VMGroup (Get-VMGroup ParentMGTGroup)  -VMGroupMember (Get-VMGroup MGMTGR01) -Verbose
# Remove Management Collection Groups
Remove-VMGroup -Name MGMTGR01 -Force -Verbose
Remove-VMGroup -Name ParentMGTGroup -Force -Verbose

VMGrouping-VMStartOrdering-13

VM Start Ordering

Virtual machine Start Order is a new feature introduced in Windows Server 2016 Technical Preview 5 Failover Clustering. VM Start Ordering opens an entirely new dimension in how you orchestrate Virtual machines (and all groups) in a cluster. Virtual machines can now be grouped into tiers, and start order dependencies can be created between different tiers. This ensures that the most important virtual machines (such as Domain Controllers or SQL servers) are started first.

As an example, most environment today do not have a single domain controller, they have multiple DCs. In this case, you probably want to group your domain controllers VMs into a Set, so it makes sense to group these domain controllers and have all the most important VMs to have dependency on VM Set for domain controllers.

Another scenario could be a Hyper-Converged deployment (where compute and storage are sharing the same underlying hardware). In this case, you probably want to make sure the most important virtual machines are started before your management or tenant VMs are started.

In order to do so, we need to define the Sets first, place virtual machines in Sets, and then specify dependencies.

VM Start Ordering Configuration

VM Start Ordering are still being developed and they are managed through Windows PowerShell only.

The following new PowerShell cmdlets have been added into Failover Clusters module to manage the group set and group set/dependencies.

At the time of writing, the cmdlets are divided into 3 groups:

# Managing Group Dependency
Add-ClusterGroupDependency
Get-ClusterGroupDependency
Remove-ClusterGroupDependency

# Managing Group Set
New-ClusterGroupSet
Remove-ClusterGroupSet
Set-ClusterGroupSet
Get-ClusterGroupSet
Add-ClusterGroupToSet
Remove-ClusterGroupFromSet

# Managing Group Set Dependency
Add-ClusterGroupSetDependency
Get-ClusterGroupSetDependency
Remove-ClusterGroupSetDependency

Simple Scenario

Let’s start by a simple scenario, If you just want to create dependency between two virtual machines, you need to use the first set of cmdlets  (Managing Group Dependency). You need to use the Add-ClusterGroupDependency cmdlet to create dependency between VM-A and VM-B. If you are familiar with creating  dependencies between cluster resources today, this is exactly the same model.

Advanced Scenario

Let’s now look at complex scenario and see how to create and manage advanced group Set dependency with Windows PowerShell.

In the following example, we have a multi-tiered application which consists of two domain controllers, two SQL servers, two web servers and two software load balancers.

The workflow will look something like this:

VMGrouping-VMStartOrdering-19

Step 1. We start by creating the Cluster VM Set for each tier by using New-ClusterGroupSet cmdlet.

# Cluster Name
$ClusterName = "CN-CLU"

# Create new Cluster VM Set (DC)
New-ClusterGroupSet -CimSession $ClusterName -Name VMDCSET01 –Verbose

# Create new Cluster VM Set (SQL)
New-ClusterGroupSet -CimSession $ClusterName -Name VMSQLSET01 –Verbose

# Create new Cluster VM Set (IIS)
New-ClusterGroupSet -CimSession $ClusterName -Name VMIISSET01 –Verbose

# Create new Cluster VM Set (SLB)
New-ClusterGroupSet -CimSession $ClusterName -Name VMSLBSET01 –Verbose

# Get Cluster VM Set
Get-ClusterGroupSet -CimSession $ClusterName | ft Name, StartupConfig, StartupCount –AutoSize

VMGrouping-VMStartOrdering-20

As you can see in above screenshot, the StartupConfig and StartupCount are set to the default properties.

Step 2. The next step, we need to assign the right properties for each VM Set by using Set-ClusterGroupSet cmdlet.

# Assign properties for your VM Set by using Set-ClusterGroupSet cmdlet
Set-ClusterGroupSet -CimSession $ClusterName -Name VMDCSET01  -ReadySetting OS_Heartbeat -ReadyCount 1 -Verbose
Set-ClusterGroupSet -CimSession $ClusterName -Name VMSQLSET01 -ReadySetting OS_Heartbeat -ReadyCount 2 -Verbose
Set-ClusterGroupSet -CimSession $ClusterName -Name VMIISSET01 -ReadySetting OS_Heartbeat -ReadyCount 3 -Verbose
Set-ClusterGroupSet -CimSession $ClusterName -Name VMSLBSET01 -ReadySetting OS_Heartbeat -ReadyCount 4 -Verbose

# Get Cluster Group Set Properties
Get-ClusterGroupSet -CimSession $ClusterName | ft Name, StartupConfig, StartupCount -AutoSize

VMGrouping-VMStartOrdering-21

The StartupConfig is set to “OS_HeartBeat” property for each Set and StartupCount is set to sequence number from 1 to 4.

Step 3. We need to add virtual machines groups to the VM Set by using Add-ClusterGroupToSet cmdlet.

# Add Cluster Group (VMs) to the Set by using Add-ClusterGroupToSet cmdlet

# Domain Controllers VMs
Add-ClusterGroupToSet -CimSession $ClusterName -Name VMDCSET01 -Group WS-DC01 -Verbose
Add-ClusterGroupToSet -CimSession $ClusterName -Name VMDCSET01 -Group WS-DC02 -Verbose
# SQL Servers VMs
Add-ClusterGroupToSet -CimSession $ClusterName -Name VMSQLSET01 -Group WS-SQL01 -Verbose
Add-ClusterGroupToSet -CimSession $ClusterName -Name VMSQLSET01 -Group WS-SQL02 -Verbose
# Web Server VMs
Add-ClusterGroupToSet -CimSession $ClusterName -Name VMIISSET01 -Group WS-IIS01 -Verbose
 Add-ClusterGroupToSet -CimSession $ClusterName -Name VMIISSET01 -Group WS-IIS02 -Verbose
# Software Load Balancers VMs
Add-ClusterGroupToSet -CimSession $ClusterName -Name VMSLBSET01 -Group WS-SLB01 -Verbose
Add-ClusterGroupToSet -CimSession $ClusterName -Name VMSLBSET01 -Group WS-SLB02 -Verbose

# Get Cluster Group Set Properties
Get-ClusterGroupSet -CimSession $ClusterName | ft Name, GroupNames, StartupConfig, StartupCount -AutoSize

VMGrouping-VMStartOrdering-22

Step 4. Once you have your VM group Set all setup, the final step is to create dependency between either a single VM or between a VM Group Set by using Add-ClusterGroupSetDependency cmdlet.

If you want to create a dependency for a single VM, then you want to create another group Set that has a single VM in it.

In our example here, we don’t have a single VM, so we will set the dependencies between different VM Sets.

# Creating dependency between VM Set by using Add-ClusterGroupSetDependency cmdlet
Add-ClusterGroupSetDependency -CimSession $ClusterName -Name VMSLBSET01 -ProviderSet VMIISSET01 -Verbose
Add-ClusterGroupSetDependency -CimSession $ClusterName -Name VMIISSET01 -ProviderSet VMSQLSET01 -Verbose
Add-ClusterGroupSetDependency -CimSession $ClusterName -Name VMSQLSET01 -ProviderSet VMDCSET01 -Verbose

# Get Cluster Group Set Properties
Get-ClusterGroupSet -CimSession $ClusterName | ft Name, GroupNames, ProviderNames, StartupConfig, StartupCount -AutoSize

VMGrouping-VMStartOrdering-23

As you can see in above screenshot, the virtual machines groups “WS-SQL01, WS-SQL02 ” are dependent on DC VM Set “VMDCSET01”, the web server VMs “WS-IIS01, WS-IIS02” are dependent on SQL Servers VM Set “VMSQLSET01”, and last but not least, the software load balancer VMs “WS-SLB01, WS-SLB02” are dependent on web servers VM Set “VMIISSET01”.

Summary

This is the first look at VM Groups and VM Start Ordering, you might noticed some confusion around the PowerShell cmdlets for VM Start Ordering, I totally agree on this. The documentation is still very limited at this point in time. This is a brand new feature and still under development, I expect additional functionalities will be added in the future.

With VM Start Ordering, you have the ability to create a dependency between your special (most important) VMs, and give us the ability to orchestrate the start ordering between all virtual machines in your cluster. It’s an orchestration of all the VMs in your entire cluster and not just a few VMs you have on a single node.

As always, comments are welcome and encouraged. Is this something you would use? Do you have another scenarios where you can see VM Groups and VM Start Ordering is useful?

Thanks for reading!

Cheers,
[email protected]

About Charbel Nemnom 525 Articles
Charbel Nemnom is a Cloud Architect, ICT Security Expert and Microsoft Most Valuable Professional (MVP), totally fan of the latest's IT platform solutions, accomplished hands-on technical professional with over 17 years of broad IT Infrastructure experience serving on and guiding technical teams to optimize the performance of mission-critical enterprise systems. Excellent communicator is adept at identifying business needs and bridging the gap between functional groups and technology to foster targeted and innovative IT project development. Well respected by peers through demonstrating passion for technology and performance improvement. Extensive practical knowledge of complex systems builds, network design, business continuity, and cloud security.

Be the first to comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.