Hyper-V is Microsoft’s answer to the virtualization market and over the years, it has slowly but surely made improvements...
to its hypervisor platform. This progress continues in Windows Server 2012 – let’s take a look at a couple of the highlights around Hyper-V 3.0 in the next version of Microsoft’s flagship server operating system, and in particular, how to use PowerShell to do some basic management tasks with each of these features.
Hyper-V extensible switch
The Hyper-V extensible switch is an unheralded but fantastic improvement to Windows Server 2012. It allows vendors and partners to write extensions that plug directly into the network architecture of Hyper-V, extending the functionality of the virtual network from a “panel of virtual ports” to a smart, manageable, extendable piece of virtual network hardware.
The extensions you can put into the switch enable a number of scenarios that were difficult or impossible to achieve in previous versions of Hyper-V and its virtual networks. Briefly, Microsoft’s partners have announced the following extensions will be available at or very near the release to manufacturing (RTM) of Windows Server 2012:
- Cisco has announced the Nexus 1000V for Hyper-V, which takes all of the management and configuration capabilities of the company's switches and marries it to the virtual switch as well.
- 5Nine showed an extension that serves as a virtual firewall.
- Inmon demonstrated its “sFlow” product for traffic capturing and analysis.
The extensible switch has several advantages. For one, to gain new functionality in your Hyper-V virtual networks, you don’t have to rip the whole thing out—you can add extensions that do what you want while keeping the performance and integration of the built-in virtual switch. In addition, these extensions plug in so tightly and deeply that they inherit all of the capabilities exposed within Windows Server 2012, like Live Migration. It works directly, without the extension developer having to build in special support. These extensions also use current development frameworks and have to pass certification tests, so you can be reasonably certain that they’ll perform well and won’t cause stability problems.
There are PowerShell cmdlets available to manage the extensible switch. For example, if I wanted to enable a specific extension on an extensible switch instance, I’d use the Enable-VMSwitchExtension cmdlet as follows:
Enable-VMSwitchExtension “name of extension” NameOfSwitchToUse
You can also get a catalog of available extensible switch extensions using the Get-VMSwitchExtension cmdlet, like so (while also piping the output of the cmdlet to the list formatting function, fl):
Get-VMSwitchExtension NameofSwitchToUse | fl
The Hyper-V Replica feature lets you replicate a virtual machine from one location to another with Hyper-V and a network connection. What’s special here is that you don’t have to have any shared storage. Previously, to achieve failover between virtual machines, you had to set up failover clustering which required access to shared storage like SANs, NAS devices, or at the very least a quorum disk. That shared storage requirement has been removed, which essentially means all of the movement of a virtual machine between one host and another occurs over the pipe -- they just need to be able to communicate over the network. There is no interruption of service from the virtual machine and the user will not see any difference when using the workloads on a virtual machine being replicated to another host.
This feature is particularly valuable for a couple of different scenarios:
- Failover for geographically-dispersed machines. For customers who might subscribe to a service that fails over their virtual machines to the “cloud,” a provider could stand up Windows Server 2012 in a highly connected data center, or even set of data centers. Then, customers with on-premises workloads could send replica information directly to the cloud. This enables a disaster recovery scenario that doesn’t require any software other than Windows, something not available today on the market.
- Premises-to-premises support. As demand grows or weakens, or operational requirements dictate, companies can move virtual machines between hosts at head office and corporate campuses and their smaller branch offices. Workloads can be replicated to and from branch offices as necessary for performance reasons, maintenance windows, or disaster recovery scenarios.
You can also manage Hyper-V replica from PowerShell, including cmdlets to configure replication processes. You’d start off on the host on which you want to enable replication and use the Set-VMReplicationServer cmdlet.
Set-VMReplicationServer –ReplicationEnabled 1 –ComputerName computertoenable
Do that on two hosts, and then you can set up a virtual machine to replicate between them as long as both servers are members of the same domain, with one simple command, Set-VMReplication:
Set-VMReplication –VMName targetvm –ReplicaServerName replicaservertarget –ReplicaServerPort 80
To force the replication, you can use the Start-VMInitialReplication cmdlet to kick off the actual replication itself:
Start-VMInitialReplication –VMName targetvm
It’s clear that in Windows Server 2012, Hyper-V continues to mature and evolve into a data center-class product. With PowerShell management built in right in the box for managing even the new features to this version, data center administrators will find their day to day tasks scriptable and automated at a whole new level.
ABOUT THE AUTHOR
Jonathan Hassell is an author, consultant and speaker residing in Charlotte, N.C. Jonathan's books include RADIUS, Hardening Windows and recentlyWindows Vista: Beyond the Manual