12 Aug 2013

Hyper-V Host Networking Requirements

Understanding these needs is a critical step in designing Hyper-V hosts, particularly those that will take advantage of new features in Windows Server 2012 (WS2012) or Windows Server 2012 R2 (WS2012R2).

Basic Hyper-V Host Network Requirements and Designs

Network design for Hyper-V hosts was much simpler before the release of WS2012 because we did not have many options. The decision making process simply came down to:

    Will my hosts be clustered?
    Will I use NIC teaming?
    Do I need a dedicated backup network?
    Is the storage connected by iSCSI?
    If I am using WS2012, do I want a Live Migration network on non-clustered hosts?

In essence, there were two designs with minor variations depending on the answers to those questions. Those two designs are standalone (or non-clustered) hosts or clustered hosts.

Requirements of a Standalone Host

In this simple design there must be two networks:

Management: This network is use to remotely manage Management OS (sometimes referred to as the host OS) of the host. Remote desktop, monitoring, backup, and Hyper-V management traffic all pass through this network by default.

Virtual Machine: A virtual switch (referred to as a virtual network prior to WS2012) is connected to this network. This network allows virtual machines to connect to the physical network of your computer room, data center, or cloud.

Basic Standalone Host Design

Note how I haven't talked about NICs yet. Instead, I have deliberately use the word "network." A NIC is a physical connection; think of it as a port and cable that you can touch. A network is a logical connection, so think of it as a role that serves a purpose. In W2008/R2 both of these networks usually did have dedicated networks.

hyper-v host networking: Basic Non-Clustered Host

Basic networking in a standalone host.

How many NICs is that? Two: one for management and one for virtual machines. Veterans of Hyper-V will know that there is a slightly different variation to this. In the properties of a virtual network (before WS2012) or virtual switch you can enable a setting called Allow Management Operating System To Share The Network Adapter.

Hyper-V Host Networking: Virtual Switch Properties

Allow the management OS to connect to the network via the virtual switch.

This modifies the basic design by creating a virtual NIC in the Management OS. That takes a few moments to comprehend – remember that the Management OS sits on top of Hyper-V. This new virtual NIC appears in Control Panel > Network Connections just like a physical NIC would. But instead of being connected to a physical switch, this new Management OS vNIC connects to your virtual network or virtual switch. That means that the management OS can connect to the physical network via the virtual switch just like a virtual machine. It also means that you no longer need a dedicated NIC for the Management OS.

Hyper-V Host Networking: shared switch

A basic host using a single Management OS virtual NIC.

Prior to WS2012 we usually advised against implementing this design in production. The problem is that there was no quality of service (QoS) prior to WS2012 to protect one network from the other flooding the network connection. For example:

  • A backup or restore job via the Management OS network would prevent virtual machines from being able to use the network.
  • A rogue virtual machine could flood the network and you would have to physically visit the host to take remedial action.

Adding a Backup Network to a Standalone Host

Modern backup tools are very light touch with their impact on hosts and networking. That because they capture changes only, and some even add deduplication functionality to that optimization. A restore, which is a time-important task, is very heavy on the network, and as previously mentioned, it could flood a physical connection and therefore put other roles on that network out of action.

This is why many engineers have decided to implement a dedicated backup network, as you can see below. Adding this additional NIC gave physical isolation to backup traffic in lieu of having QoS functionality in Windows Server 2008/R2.

Hyper-V Host Networking: backup

Adding a dedicated backup network.

Adding NIC Teaming to a Standalone Host

The designs so far have only used a single NIC for each networking role. That NIC can only be connected to a single top-of-rack (TOR) or access switch by a single cable or bus. There are several single points of failure along that chain, so the switch is the one that is most likely to fail. You can introduce fault tolerant network paths by adding NIC teaming. Before Windows Server 2012 this required the use of software that is provided by the NIC or server manufacturer. Note that use of NIC teaming software is not and never has been supported by Microsoft in Hyper-V. It can be done, but you now have to add the vendor into your support chain for Hyper-V, and you must follow the instructions very carefully to get stability and security.

Microsoft added built-in and completely supported NIC teaming to WS2012, meaning you no longer have to use third-party software for this design. That simplifies support, and to be honest, simplifies implementation – it is standardized across servers, supports mixed vendor teams, and can be automated with PowerShell or System Center.

Adding NIC teaming, as shown below, does increase network path fault tolerance but it also increases costs:

    Double the NICs
    Double the switches (purchase, support, power, administration, and so on

Hyper-V Host Networking: NIC Team

Adding NIC Teaming.

NIC teaming seems like the automatic sensible choice for everyone. However, in a (huge) cloud where fault tolerance is built into application rather than at the host layer, concepts like host clusters and NIC teaming make absolutely no sense. The rack is considered as a fault domain, and virtual machines in the same tier of a service are spread across racks. This allows those cloud "landlords" to use very simple hosts (single power supply, NICs, TOR switches, and so on) while the service still stays highly available.

Further Standalone Host Thoughts

So far we haven't considered some of the concepts that WS2012 have introduced to non-clustered Hyper-V hosts:
  • SMB 3.0 Storage: Non-clustered hosts can store virtual machines on common SMB 3.0 shares. This allows for the introduction of highly available storage (instead of DAS) for easier recovery from non-clustered host failure. It also introduces the possibility of Live Migration. Note that SMB Multichannel can use multiple NICs.
  • Live Migration: Non-clustered hosts can perform Live Migration of virtual machines on SMB 3.0 storage and Shared-Nothing Live Migration. Live Migration is bandwidth intensive; a network can be added to hosts (with or without NIC teaming) and designated as the Live Migration network.
As you can see, the number of NICs that you might deploy to implement these networks keeps growing and adding costs to the project. Wait till you see what clustering has for us!

The Clustered Host

Clustering has a need for quality guaranteed networking to ensure clustering stability. Without QoS in Windows Server, each network requires its own NIC. And you are going to have to double those NICs if you want to have network path fault tolerance.

The following networks are required in a clustered host. Note: Please ignore materials on non-Hyper-V clustering where fewer networks are required:
  • Management: To manage the host remotely.
  • Virtual Machine: To let virtual machines connect to the physical network.
  • Cluster Communications: This private (non-routed) network is used to provide the heartbeat between cluster nodes to assess health. This network must be reliable. In W2008/R2 Hyper-V, this network is also used for Redirected IO (it has the lowest metric). Note that in WS2012, Redirected IO uses SMB 3.0, and therefore can use multiple NICs over SMB Multichannel.
  • Live Migration: Having two private (non-routed) networks is considered good practice in clustering because it gives the cluster heartbeat a second private, and therefore reliable, path. Relying on the Management network could be foolish if it becomes swamped, for example, by a virtual machine deployment. This second private network will primarily be used for Live Migration traffic. Remember, if you have multiple clusters then make sure this network is common between those clusters for Shared-Nothing Live Migration.
  • Storage: Usually two adapters will be used to connect the hosts to either SMB 3.0 or SAN storage. These adapters could be SAS controllers, and thus outside the scope of this networking discussion. However they could be iSCSI NICs (use MPIO, not NIC teaming) or they could be for SMB 3.0 (do not use NIC teaming if implementing RDMA/SMB Direct).
  • Backup: Once again, we will add a backup network to isolate backup/restore traffic from the management network.
Without the storage network and NIC teaming, that gives us a total of 5 NICs.  Adding NIC teaming and we have 10 NICs.  If we include iSCSI or SMB 3.0 storage, we now have 12 NICs.  That is a lot of NICs, cables, switch ports, electricity, complexity, expense, management, and critically, more stuff that can break.

Remember, in the below diagram:

    The use of iSCSI (shown) or NICs for SMB 3.0 (not shown) are dependent on the type of storage you require
    The backup network is not listed as required by Microsoft, but it is strongly recommended to ensure a host is manageable during the restoration of a virtual machine

Hyper-V Host Networking

A clustered host with fault tolerant networking.

Are These Designs for WS2012 Hyper-V?

To paraphrase American comedian Denis Leary: I got two words for ya: Hell No! Earlier in this document we stressed that the networks (or roles) did not necessarily map to NICs (physical connections). But they do in the case of W2008/R2 Hyper-V because we have no means to guarantee a minimum level of service for the functions of Hyper-V/Failover Clustering in those legacy operating systems. WS2012 introduces a new concept for Hyper-V called converged networks, also known as converged fabrics. Using built-in QoS we can create minimum bandwidth rules. That opens up a wide range of new design options where we use fewer, larger bandwidth NICs, and merge our networks into those NICs. Here's a teaser for you in the image below, in which just two 10 GbE NICs provide all the networking functionality of a clustered host, with two more dedicated NICs for iSCSI storage:

Hyper-V Host Networking: converged

Convergence via the virtual switch plus dedicated iSCSI NICs

Windows Server 2012 Hyper-V Live Migration

Windows Server 2012 Live Migration and how this flexibility solution works.

What Is Live Migration?

Live Migration is the equivalent of vMotion. The purpose of this feature is to move virtual machines from one location to another without any downtime. Well, that's the perception of Live Migration and vMotion. As anyone who as ever used these features in a lab will know, there is actually some downtime when vMotion or Live Migration are used. A better definition would be: Live Migration (or vMotion) allows you to move virtual machines without losing service availability. That's a very subtle difference in definitions, which we will explain later on in this article.

The purpose of Live Migration is flexibility. Virtual machines are abstracted from the hardware on which they run. This flexibility allows us to match our virtual machines to our resources and to replace hardware more easily. It makes IT and the business more agile and response – all without impacting on the operations of the business.

Back to Basics

Often there is confusion between Live Migration and high availability (HA). This is due to the fact that Live Migration (and vMotion) historically required a host cluster with shared storage. But things have changed, and it's important to understand the differences between Live Migration and HA.

Live Migration is a proactive operation. Maybe an administrator wants to power down a host and is draining it of virtual machines. The process moves the virtual machines, over a designated Live Migration network, with no drop in services availability. Maybe System Center wants to load balance virtual machines (VMM Dynamic Optimization). Live Migration is a planned and preventative action – virtual machines move with no downtime to service availability.

High availability, on the other hand, is reactive and unplanned. HA is the function of failover clustering in the Windows Server world. Hosts are clustered and virtual machines are marked as being highly available. Those virtual machines are stored on some shared storage, such as a SAN, a shared Storage Pool, or a common SMB 3.0 share. If a host fails, all of the virtual machines there were running on it stop. The other hosts in the cluster detect the failure via failed heartbeats. The remaining hosts failover the virtual machines that were on the now dead host. Those failed over virtual machines automatically power up. You'll note that there is downtime.

Read those two paragraphs again. There was no mention of failover clustering when Live Migration was discussed as a planned operation. Windows Server 2012 Hyper-V Live Migration does not require failover clustering: You can do Live Migration without the presence of a cluster. However, HA is the reason that failover clustering exists.

There are two very important promises made by Microsoft when it comes to Live Migration:
  1. The virtual machine will remain running no matter what happens. Hyper-V Live Migration does not burn bridges. The source copy of a virtual machine and its files remain where they are until a move is completed and verified. If something goes wrong during the move, the virtual machine will remain running in the source location. Those who stress-tested Live Migration in the beta of Windows Server 2012 witnessed how this worked. It is reassuring to know that you can move mission critical workloads without risk to service uptime.
  2. No new features will prevent Live Migration. Microsoft understands the importance of flexibility. All new features will be designed and implemented to allow Live Migration. Examples of features that have caused movement restrictions on other platforms are Single Root IO Virtualization (SR-IOV) and virtual fiber channel. There are no such restrictions with Hyper-V – you can quite happily move Hyper-V virtual machines with every feature enabled.
Live Migration Changes in Windows Server 2012 Hyper-V

Windows Server 2012 features a number of major changes to Live Migration, some of which shook up the virtualization industry when they were first announced.

    * Performance enhancements: Some changes were made to the memory synchronization algorithm to reduce page copies from the source host to the destination host.
    * Simultaneous Live Migration: You can perform multiple simultaneous Live Migrations across a network between two hosts, with no arbitrary limits.
    * Live Migration Queuing: A clustered host can queue up lots of Live Migrations so that virtual machines can take it in turn to move.
    * Storage Live Migration: We can move the files (all or some) of a virtual machine without affecting the availability of services provided by that virtual machine.
    * SMB 3.0 and Live Migration: The new Windows Server shared folder storage system is supported as shared storage for Live Migration with or without a Hyper-V cluster.
    * Shared Nothing Live Migration: We can move virtual machines between two non-clustered hosts, between a non-clustered host and a clustered host, and between two clustered hosts.

Performance Enhancements

Let's discuss how Live Migration worked in Windows Server 2008 R2 Hyper-V before we look at how the algorithm was tuned. Say a virtual machine, VM01, is running on HostA. We decide we want to move the virtual machine to HostB via Live Migration. The process will work as follows:
  1. Hyper-V will create a copy of VM01's specification and configure dependencies on HostB.
  2. The memory of VM01 is divided up into a bitmap that tracks changes to the pages. Each page was copied from the first to the last from HostA to HostB. Each page was marked as clean after it was copied.
  3. The virtual machine is running so memory is changing. Each changed page is marked as dirty in the bitmap.  Live Migration will copy the dirty pages again, marking them clean after the copy. The virtual machine is still running, so some of the pages will change again and be marke as dirty. The dirty copy process will repeat until (a) it has been done 10 times or (b) there is almost nothing left to copy.
  4. What remains of the VM01 that has not been copied to HostB is referred to as the state. At this point VM01 is paused on HostA.
  5. The state is copied from HostA to HostB, thus completing the virtual machine copy.
  6. VM01 is resumed on HostB.
  7. If VM01 runs successfully on HostB then all trace of it is removed from Host  
This process moves the memory and processor of the virtual machine from HostA to HostB, both in the same host cluster. The files of the virtual machine are on some shared storage (a SAN in Windows Server 2008 R2) that is used by the cluster.

It is between the pause in step 4 and the resume in step 6 that the virtual machine is actually offline. This is where a ping test drops a packet. Ping is a tool based on the ICMP diagnostic protocol. Ping is designed to find latency. That's exactly what happens when that ping fails to respond during Live Migration or vMotion. The virtual machine is briefly unavailable. Most applications are based on more tolerant protocols which will allow servers several seconds to respond. Both vMotion and Live Migration take advantage of that during the switch over of the virtual machine from the source to the destination host. That means your end users can be reading the email, using the CRM client, or connected to a Citrix XenApp server, and they might not notice anything other than a slight dip in performance for a second or two. That's a very small price for a business-friendly feature like Live Migration or vMotion.

Aside from the cluster requirement, the other big change in this process in Windows Server 2012 is that the first memory copy from HostA to HostB has been tuned to reflect memory activity. The initial page copy is prioritized, with least used memory being copied first, and the most recently used memory being copied last. This should lead to fewer copy iterations and faster Live Migration of individual virtual machines.

Simultaneous Live Migration

In Windows Server 2008 R2, we could only perform one simultaneous Live Migration between any two hosts within a cluster. With host capacities growing (up to 4 TB RAM and 1,024 VMs on a host) we need to be able to move virtual machines more quickly. Imagine how long it would take to drain a host with 256 GB RAM over a 1 GbE link! Hosts of this capacity (or greater) should use 10 GbE networking for the Live Migration network. Windows Server 2008 R2 couldn't make full use of this bandwidth – but Windows Server 2012 can. Combined with simultaneous Live Migration, Hyper-V can move lots of virtual machines very quickly, taking advantage of 10 Gbps, 40 Gbps, or even 56 Gbps networking! This makes large data center operations happen very quickly.

The default number of simultaneous Live Migrations is two, as you can see in the below screenshot. You can tune the host based on its capabilities. Running too many Live Migrations at once is expensive; not only does it consume the bandwidth of the Live Migration network (which might be converged with other networks) but it also consumes resources on the source and destination hosts. Don't worry – Hyper-V will protect you from yourself. Hyper-V will only perform the number of concurrent Live Migrations that it can successfully do.

Windows Server 2012 Hyper-V Live Migration simultaneous

A common question is this: My source host is configured to allow 20 concurrent Live Migrations and my destination host will allow five. How many Live Migrations will be done? The answer is simple: Hyper-V will respect every host's maximum, so only five Live Migrations will happen at once between these two hosts.

You might also notice in the above screenshot that Storage (Live) Migration also has a concurrency limit, which defaults to two.
Live Migration Queuing

Imagine you have a cluster with two nodes, HostA and HostB. Both nodes are configured to allow ten simultaneous Live Migrations. HostA is running 100 virtual machines and you want to place this host in maintenance mode. Failover Cluster manager will orchestrate the Live Migration of the virtual machines. All virtual machines will queue up, and up to ten (depending on host resources) will live migrate at the same time. As virtual machines leave HostA, other virtual machines will start to live migrate, and eventually all of the virtual machines will be running on HostB.

Storage Live Migration

A much sought-after feature for Hyper-V was the ability to relocate the files of a virtual machine without affecting service uptime. This is what Storage Live Migration gives us. The tricky bit is moving the active virtual hard disks because they are being updates. Here is how Microsoft made the process work:

   
* The running virtual machine is using its virtual hard disk which is stored on the source device.
   
* An administrator decides to move the virtual machine's files and Hyper-V starts to copy the virtual hard disk to the destination device.
   
* The IO for the virtual hard disk continues as normal but now it is mirrored to the copy that is being built up in the destination device.
   
* Live Migration has a promise to live up to; the new virtual hard disk is verified as successfully copied
   
* Finally the files of the virtual machine can be removed from the source device

Windows Server 2012 Hyper-V storage live migration

Storage Live Migration can move all of the files of a virtual machine as follows:

   
* From on folder to another on the same volume
   
* To another drive
   
* From one storage device to another, such as from a local drive to an SMB 3.0 share
   
* You can move files from one server to another

When using Storage Live Migration, you can choose to:

   
* Move all files into a single folder for the virtual machine
   
* Choose to only move some files
   
* Scatter the various files of a virtual machine to different specified locations

SMB 3.0 and Live Migration

Windows Server 2012 introduces SMB 3.0 – an economic, continuously available, and scalable storage strategy that is supported by Windows Server 2012 Hyper-V. Live Migration supports storing virtual machines on SMB 3.0 shared storage. This means that a virtual machine can be running on HostA and be quickly moved to run on HostB, without moving the files of the virtual machine. Scenarios include a failover cluster of hosts using a common SMB 3.0 share and a collection of non-clustered hosts that have access to a common SMB 3.0 share.
Shared-Nothing Live Migration

Thanks to Shared-Nothing Live Migration we can move virtual machines between any two Windows Server 2012 Hyper-V hosts that do not have any shared storage. This means we can move virtual machines:

  • Move the virtual machine that is stored on the local drive of a non-clustered host to another non-clustered host, and store the files on the destination host's storage.
  • From a non-clustered host to a clustered host, with the files placed on the cluster's shared storage. Then we can make the virtual machine highlight available to add it to the cluster.
  • Remove the highly available attribute of a virtual machine and move it from a clustered host to a non-clustered host.
  • Remove the highly available attribute of a virtual machine and move it from a host in a source cluster to a host in a destination cluster, where the virtual machine will be made highly available again

In other words, it doesn't matter what kind of Windows Server 2012 or Hyper-V Server 2012 host you have. You can move that virtual machine.

Hyper-V Is Breaking Down Barriers to IT Agility

You can easily move virtual machines from one host to another in Windows Server 2012 Hyper-V. The requirements for this are as follows.

  1. You are running Windows Server 2012 Hyper-V on the source and destination hosts.
  2. The source and destination hosts have the same processor family (all Intel or all AMD).
  3. If there are mixed generations of processor then you might have to enable processor compatibility mode in the settings of the virtual machine. It is a good idea to always buy a new processor when acquiring new hosts – this gives you a better chance at buying compatible host processors in 12-18 months' time.
  4. The hosts must be in the same domain.
  5. You have at last 1 GbE of connectivity between the hosts. This bandwidth can be a share of a greater link that is guaranteed by the features of converged networking (such as QoS). Ideally, you will size the Live Migration network according to the amount of RAM in the hosts and the time it takes to drain the host for maintenance.

With all of those basic requirements configured, the only barrier remaining to Live Migration is the network that the virtual machine is running one. For example, if the virtual machine is running on 192.168.1.0/24 then you don't want to live migrate it to a host that is connected to 10.0.1.0/24. You could do that, but the virtual machine would be unavailable to clients unless the destination host was configured to use Hyper-V Network Virtualization, but that's a whole other article!

11 Aug 2013

Master virtualization with a new Windows PowerShell cmdlet



In Windows Server 2012, Microsoft has made it possible to fully manage your Hyper-V-based virtualization infrastructure and virtual machines (VMs) from the PowerShell command line. In fact, Windows Server 2012 contains dozens of server virtualization-specific Windows PowerShell v3 commands. Each PowerShell cmdlet may not benefit every data center, but others provide important management capabilities.

The PowerShell v3 syntax may seem confusing at first, but it is well worth learning, especially if you find yourself managing large numbers of virtual machines.

This slideshow outlines five of the most important PowerShell v3 commands every virtualization admin should know.

Get-VM is probably the single most heavily used PowerShell v3 command related to server virtualization. When used without any switches, the Get-VM cmdlet returns a list of all the VMs that are present on the host server. As you can see in the figure, this list also includes information about the VMs' state, their CPU and memory usage, uptime and status. You can also use this command to retrieve granular information about a specific VM through a series of command-line switches.



The Invoke-Command cmdlet performs bulk PowerShell operations against multiple targets. This allows you to more easily manage large numbers of VMs because you can run the cmdlet against multiple Hyper-V hosts. Simply include the –ComputerName switch with the names of the target servers separated by commas and the command that you want to run on the remote servers enclosed in braces.

Suppose for a moment that you want to retrieve the name, state and status of all VMs running on servers named Lab1 and Lab2. You could accomplish this task with the following PowerShell v3 command:

Invoke-Command –ComputerName Lab1, Lab2 {Get-VM | FT VMName, State, PrimaryStatusDescription}

The image shows an example of this command. As you can see, the Invoke-Command directs the Get-VM command at multiple Hyper-V hosts. It also retrieves specific attributes for each VM by specifying those that should be displayed.



The Get-ClusterGroup cmdlet is a part of Windows Server 2012's failover clustering feature, but it is extremely useful in virtual server environments. Most production virtual servers are clustered as a way of improving VM reliability. The Get-ClusterGroup cmdlet reports on the health of clustered VMs.

Running the Get-ClusterGroup cmdlet by itself will retrieve information about all clustered resources, which can include things other than VMs. To limit the list to VMs, you must include the Where GroupType –EQ 'VirtualMachine' option. The full <a href="http://searchservervirtualization.techtarget.com/guides/Get-schooled-in-advanced-Microsoft-PowerShell-v3-cmdlets">PowerShell v3 command looks</a> like this:

Get-ClusterGroup | Where GroupType –EQ 'VirtualMachine' | Get-VM

The image shows the command in action. In the figure, I redirect the output to the Get-VM cmdlet to retrieve a list of clustered VMs; however, you can easily adapt this technique to perform any bulk operation on your clustered VMs.



You can use the Start-VM cmdlet to start any virtual machine. This very simple cmdlet does not require any command-line switches aside from the VM name. Similarly, if you want to stop a VM, use the Stop-VM cmdlet, as shown in the figure. These PowerShell v3 cmdlets come in very handy for performing scripted operations that require a VM to be rebooted.



The New-VM cmdlet creates a brand-new virtual machine from the PowerShell v3 command line. If you use this cmdlet without specifying any attributes other than the name of the VM to be created, then it creates and provisions a VM with the following resources:

    * 512 MB of memory
    * DVD drive
    * 1 virtual processor

You can, of course, script the VM creation process to allocate additional resources such as virtual network adapters and virtual hard drives, but doing so requires additional commands and command-line switches. The figure illustrates how Microsoft gives you the tools to create VMs from the command line.