Possible Owner in Failover Cluster. Part 3

Possible Owner

  • Part 1 covers some theory and GUI configuration.
  • Part 2 focus on setting Preferred Owners with PowerShell.
  • Part 3 (this) will explain logic behind Possible Owners in PowerShell function.
  • Part 4 will cover the last step – setting anti-affinity groups.
  • Part 5 will describe reporting of current configuration in the cluster.

    Today let’s focus on logic behind Possible Owners feature in Failover clustering.

    General concept

    This is a little trickier. Before a VM can have its ‘Possible Owner’ property set, it must be on one of the Hyper-V nodes first. There can be a few scenarios – VM1 and 4 Hyper-V Nodes: Node1-4.

    • I want to reset configuration to defaults – in other words set it to Node1-4
    • I want to set configuration to Node2 and VM is on Node2
    • I want to set configuration to Node1-2 and VM is on Node2
    • I want to set configuration to Node1-2 and VM is on Node3

First, in the begin{} block I will:

  • create PSSesion to the Cluster
  • if $PossibleOwner not set, I’ll assign all current cluster nodes to it
  • If $PossibleOwner I will validate whether provided nodes are valid

Then I’ll loop through each VM. If it’s found then:

  • I’ll get it’s current configuration
  • Compare to expected and if there’s a mismatch I’ll proceed
    • Scenario 1 is the simplest – I’ll just set PossibleOwner to all nodes.
    • Scenario 2 and 3 are similar, but provided parameter $PossibleOwner will be used
    • Scenario 4 requires some additional work:
      • First, I need to reset PossibleOwner to default to allow migration
        • If the VM is turned on – I’ll use Live Migration
        • If the VM is turned off – I’ll use Quick Migration
      • After migration was successful I can finally set PossibleOwner to desired state
  • In the end I’ll return a custom object for each processed VM with 4 parameters:
    • Cluster
    • VMName
    • CurrentNode VM is
    • OwnerNode value which is the PossibleOwner we wanted to achieve
  • And finally will remove PSSession

    Full Script

    Here’s the full script:

 

And here’s the output from PowerShell Core:

  • Reset to defaults

  • Set to two nodes. VMs are on one of the nodes:

  • Set to two different nodes than VMs are on:

Summary

This one requires a little bit of more work than before. Mainly because involves moving VMs between nodes. One last to go and we’ll get into reporting 🙂

Advertisements

One thought on “Possible Owner in Failover Cluster. Part 3

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s