Managing Hyper-V 3.0 Host and VM´s with powershell

So now i have started digging into the powershell cmdlets that are available for the Hyper-V in Windows 8 Server beta. As you can see on my screendump and also on this link there are some, i would love to see some extensions when the product becomes RTM, I am spoiled with the functionality and extensibility of the PowerCLI 😛

One thing that i like is that with powershell it is easy to actually find out what NIC you want to use in your virtual switches, why Microsoft insists of showing the description instead of name in the Hyper-V virtual switch admin gui? i have no idea which nic is which,

I do have a good name for them in the Network Connections

in the wonderful world of powershell it is now easy to create a virtual switch and actually get the right nic, also with the parameter -AllowManagementOS i make sure that my Host will not share this nic.

New-VMswitch -Name Intern -NetAdapterName VMSwitch -AllowManagementOS $false

Then i can deploy my VMs, I am woundering why the virtualization team is using bytes in their parameters ? -MemoryStartupBytes -NewVHDSizeBytes, fortunately you can use -MemoryStartupBytes 512MB or 1GB and powershell calculates it to bytes. Another thing that I am wondering about is that when i create a VM i cannot set number of vCPU, i have to change that after the VM has been created?!

New-VM -Name vNiklasDC -NewVHDSizeBytes 20GB -SwitchName Intern -MemoryStartupBytes 512MB -NewVHDPath C:\VMs\vNiklasDC\vNiklasDC.vhdx
Set-VM -Name vNiklasDC -ProcessorCount 2 -DynamicMemory -MemoryStartupBytes 512MB -MemoryMaximumBytes 1GB

More updates will come as i discover more about the new Windows 8 Server beta..

 

Enable Hyper-V 3.0 with Powershell in Windows 8 Server beta

How do you enable Hyper-V with powershell in the new win 8 Server beta, as you can see when running the Get-WindowsFeature Hyper-V i only see the Hyper-V role, but i also want the administration tools, best practice says that you should run the Hyper-V server as clean as possible and then you might want to enable the management tools on the administration server, but now i only have one server and want to be able to create VMs and configure etc.. In the screenshot i had already enabled the Hyper-V role.

To enable all Hyper-V Role/features i just type like this,

Get-WindowsFeature Hyper-V* | Add-WindowsFeature

I will test some Hyper-V powershell cmdlets after this and that might result in another post 😛

Add my own custom properties and populate them with powershell in VMM2012

I have made a powershell script function to update information about what VLAN and IP the VM´s have. This for the IT Admin to easily see in the VMM 2012 Console. Of course the function can be customized to populate any other information available for the VM´s, maybe you want to display create date or something else that is not in the standard properties and you do not want to use the pre-made custom# .

I am using the Get-IPAddress from Ben Wilkinson, This requires that the VMM server can resolve the IP of the VM´s from a DNS.

If I do not have an DNS or the VLAN info is not stored, i can via the parameters update the properties by -IP or -VLANid.

As you can see on this screen dump, by default i only have custom#, to add my own i have to click on “Manage Custom Properties”

Here i press “Create” and add a name and optionally a description

Then when i have created the custom properties i want i add them,

Then it looks like this,

Now the powershell function comes into play when i am going to populate these fields with information.

function Set-CustomValue{
# Function to add custom data on VMs
#
# Niklas Akerlund /RTS 2012-02-18
    param (
   [Parameter(Position=0,Mandatory=$true,HelpMessage="A virtual machine pleaze",
    ValueFromPipeline=$True)]
    $VM,
	$VLANid = "",
	$IP = ""
    )
    . .\Get-IPAddress.ps1
    
    $VM = Get-SCVirtualMachine $VM
	
  	$CustomIP = Get-SCCustomProperty -Name "IP"
    $CustomVLAN = Get-SCCustomProperty -Name "VLAN"
    
	if ($IP -eq ""){
		$IP = Get-IPAddress -HostName $VM.Name
    }
	
	if ($VLANid -eq ""){
	    $VMnics = $VM | Get-SCVirtualNetworkAdapter
	    if($VMnics.Count -ne $null){
	        foreach ($VMnic in $VMnics){
	            $VLANid = $VLANid + $VMnic.VlanID + " "
	        }
	        Set-SCCustomPropertyValue -InputObject $VM -CustomProperty $CustomVLAN -Value $VLANid
	    }else{
	        Set-SCCustomPropertyValue -InputObject $VM -CustomProperty $CustomVLAN -Value $VMnics.VlanID
	    }
    }else {
		Set-SCCustomPropertyValue -InputObject $VM -CustomProperty $CustomVLAN -Value $VLANid
	}
    if($IP -ne ""){
        Set-SCCustomPropertyValue -InputObject $VM -CustomProperty $CustomIP -Value $IP       
    }
}

a screendump of my powershell console, as you can see I am using the (Get-SCVMHostCluster).Nodes to get all virtual machines on these, also i am using a foreach (%) to run the population on each VM.

And this is how it looks in the VMM console,

 

Migrate VM´s in SCVMM 2012 from one cluster to a new

I have made a simple powershell function that can move VM´s from one cluster to another and also set the network configuration, this because the old cluster had one way of setup regarding the virtual machine network and the new another more flexible with promiscuous mode set on the HP nic team so i do not need to create one virtual switch for every vlan. The function also checks if the actual VM has snapshots before moving it. (the SCVMM calls it checkpoints, which is stupid to call it one thing in hyper-v and another in SCVMM!)

the powershell function looks like this:

function Migrate-VM {

param (
   [Parameter(Position=0,Mandatory=$true,HelpMessage="A virtual machine pleaze",
    ValueFromPipeline=$True)]
    $VM,
    [Parameter(Mandatory=$true)]$VMHost,
    $VMnic,
    $VMnetwork = "VMs",
    $Datastore = "C:\ClusterStorage\Volume1",
    [switch]$StartVM
    )
    
    if( Get-SCVirtualMachine $VM | Get-SCVMCheckpoint) {
		$VM = Get-SCVirtualMachine $VM
		Write-Host " Please remove snapshots and do a shutdown of the VM:" + $VM.Name
    }else{
	    $JobGroupID = [guid]::NewGuid()
	    
	    $VMHost = Get-SCVMHost $VMHost
	    $VMnic = Get-SCVirtualMachine $VM | Get-SCVirtualNetworkAdapter
	    
	    $LogicalNetwork = (Get-SCLogicalNetworkDefinition -VLanID $VMnic.VlanID).LogicalNetwork

	    Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $VMnic -RunAsynchronously -VirtualNetwork $VMnetwork -LogicalNetwork $LogicalNetwork -VLanEnabled $true -VLanID $VMnic.VlanID -JobGroup $JobGroupID -EnableVMNetworkOptimization $false -EnableMACAddressSpoofing $false
	    if($StartVM){
	        Move-SCVirtualMachine -VM $VM -VMHost $VMHost -HighlyAvailable $true -Path $Datastore -StartVMOnTarget -RunAsynchronously -UseLAN -JobGroup $JobGroupID
	    }else
	    {
	        Move-SCVirtualMachine -VM $VM -VMHost $VMHost -HighlyAvailable $true -Path $Datastore -RunAsynchronously -UseLAN -JobGroup $JobGroupID
	    }
    }   
    
}

And this screendump shows some different ways of running it,

VM inventory function with Powershell on SCVMM 2012

Had a plan to do a blog post last week but was so busy studying for the VCP 5 test. I wrote the test on friday and i passed 🙂

I have created a little powershell function, this to get the inventory information about the virtual machines running in hosts or clusters that are connected to a System Center Virtual Machine Manager. This function collects number of configured vCPU´s, Memory, information about the connected virtual harddisks. This kind of information could be handy as in the case with one customer that has not yet implemented a host based backup solution and still use agents in their VM´s, so if they need to recover machines it is good to know what size and configuration it had if it is lost by some reason. This report can also be handy for some info on how much your datastores are filled. As you can se i both report the maximum size and the current (as dynamic disks are not allocating the whole size at creation time)

The function both export a csv and a HTML report

After importing it to excel it can look something like this:

And the html output is very simple but can be put on a internal web for IT production

I have used the Get-SCVirtualDisk to get the Bus Type and LUN id as this information is not available in Get-SCVirtualHarddisk, this information can be good if i lost the virtual machine configuration and want to connect the virtual harddisks to the right controller.

the function looks like this: (if you copy this you have to move the first # up to the <, the blog syntax highlighter does something and move it down :-( )

function Get-VMdata{
<#
.SYNOPSIS
Get the configuration data of the VMs in Hyper-V via SCVMM 2012
 
.DESCRIPTION
Use this function to get all VMs configuration in case of disaster or just statistics
 
.PARAMETER  xyz 
 
.NOTES
Author: Niklas Akerlund / RTS
Date: 2012-02-13
#>
param (
	$VMHostGroup = "All Hosts",
	[Parameter(ValueFromPipeline=$True)][Alias('ClusterName')]
	$VMHostCluster = $null,
	$VMHost = $null,
	[string]$CSVFile = "VMdata.csv",
    [string]$HTMLReport = "VMdata.html"
    )
	
	$report = @()
	if ($VMHostCluster -eq $null){
		$VMHosts = (Get-SCVMHostGroup -Name $VMhostGroup).AllChildHosts
	}else{
			$VMHosts = (Get-SCVMHostCluster -Name $VMHostCluster).Nodes
	}
	$VMs = $VMHosts | Get-SCVirtualMachine
	
	foreach ($VM in $VMs) {
		$VHDs = $VM | Get-SCVirtualDiskDrive
		$i = "1"
		foreach ($VHDconf in $VHDs){ 
			if($i -eq "1"){
				$data = New-Object PSObject -property @{
					VMName=$VM.Name
			        vCPUs=$VM.CPUCount
			        MemoryGB= $VM.Memory/1024
					VHDName = $VHDconf.VirtualHardDisk.Name
					VHDSize = $VHDconf.VirtualHardDisk.MaximumSize/1GB
					VHDCurrentSize = [Math]::Round($VHDconf.VirtualHardDisk.Size/1GB)
					VHDType = $VHDconf.VirtualHardDisk.VHDType
					VHDBusType = $VHDconf.BusType
					VHDBus = $VHDconf.Bus
					VHDLUN = $VHDconf.Lun
					VHDDatastore = $VHDconf.VirtualHardDisk.HostVolume
				}
				$i= "2"
			}else{
				$data = New-Object PSObject -property @{
					VMName=""
			        vCPUs=""
			        MemoryGB= ""
					VHDName = $VHDconf.VirtualHardDisk.Name
					VHDSize = $VHDconf.VirtualHardDisk.MaximumSize/1GB
					VHDCurrentSize = [Math]::Round($VHDconf.VirtualHardDisk.Size/1GB)
					VHDType = $VHDconf.VirtualHardDisk.VHDType
					VHDBusType = $VHDconf.BusType
					VHDBus = $VHDconf.Bus
					VHDLUN = $VHDconf.Lun
					VHDDatastore = $VHDconf.VirtualHardDisk.HostVolume
				}
			}
			$report +=$data	
		}
	}
	$report | Select-Object VMName,vCPUs,MemoryGB,VHDName,VHDSize,VHDCurrentSize,VHDType,VHDBusType,VHDBus,VHDLUN,VHDDatastore | Export-Csv -Path $CSVFile -NoTypeInformation -UseCulture
	$report | Select-Object VMName,vCPUs,MemoryGB,VHDName,VHDSize,VHDCurrentSize,VHDType,VHDBusType,VHDBus,VHDLUN,VHDDatastore | ConvertTo-HTML | Out-File $HTMLReport
}

and i can run it in some different ways, as you see in this screenshot, if i do not give any parameters it will use VMHostGroup “All Hosts” as default

SCVMM 2012 powershell function for configure network on hosts

After bare metal deployment of the hosts we need to configure the network on the hosts, this can be done from the SCVMM 2012 powershell console.

I have made a function of the creation of first a virtual switch and also adding the logical networks, if i do not add the networks to the particular host nic where the virtual switch is i cannot deploy virtual machines and get them connected to the network.

You can add the logical networks and their associated vlan/subnet before any host is imported into SCVMM and of course i have created a function for that also, this can take a csv file or just the parameters

Here is a screen dump if i run it without a csv file

and the result is the following

And here is the powershell code for the add logical networks function

function Add-SCLogicalNetworks{
<#
.SYNOPSIS
Add logical networks to your SCVMM fabric
 
.DESCRIPTION
With this function you add logical networks
 
.PARAMETER  CSVNetworks
Path to a CSV file with the logical network info 
 
.NOTES
Author: Niklas Akerlund / RTS
Date: 2012-02-02
#>
param (
    $CSVNetworks = "",
	$VMHostGroup = "All Hosts",
	[string]$Name = "",
	[string]$IPnet = "",
    	[string]$Octet = "24",
	[int]$VLAN = 0
    )
$VMHostGroup = Get-SCVMHostgroup $VMHostGroup

if ($CSVNetworks -ne "") {	
	$VLANs = Import-Csv $CSVNetworks -Delimiter ";"

	foreach ($VLAN in $VLANs){
	    $LogicalNetwork = New-SCLogicalNetwork -Name $VLAN.Name
	    $Network = $VLAN.IPnet + "/" + $VLAN.Octet
	    $SubnetVlan = New-SCSubnetVLan -Subnet $Network -VLanID $VLAN.VLAN
	    New-SCLogicalNetworkDefinition -Name $VLAN.Name -LogicalNetwork $logicalNetwork -VMHostGroup $VMHostGroup -SubnetVLan $SubnetVlan 
	}
}else{
	$LogicalNetwork = New-SCLogicalNetwork -Name $Name
	$Network = $IPnet + "/" + $Octet
	$SubnetVlan = New-SCSubnetVLan -Subnet $Network -VLanID $VLAN
	New-SCLogicalNetworkDefinition -Name $Name -LogicalNetwork $logicalNetwork -VMHostGroup $VMHostGroup -SubnetVLan $SubnetVlan 
}
}

when i have the logical networks i want to configure the host

And the result is the following

And this is also displayed on the physical nic

and here is the powershell code for configuring the host:

function Configure-SCVMhostNetwork{
<#
.SYNOPSIS
Configure the network on the Hyper-V Host
 
.DESCRIPTION
With this function you set virtual switch and configure logical networks
 
.PARAMETER  VMHost
The new host that is going to be configurered 

.PARAMETER refVMHost
if there are different hyper-v clusters and logical networks, use a ref host for the configuration to set it up
 
.PARAMETER VMHostnic
The nic that is going to be configured with a virtual switch (in this case a NIC team named "VM"
 
.EXAMPLE
PS C:\> Get-SCVMHost Hyp04 | Configure-SCVMhostNetwork

.EXAMPLE
PS C:\> Configure-SCVMhostNetwork -VMHost Hyp04 -refVMHost Hyp06
 
.NOTES
Author: Niklas Akerlund / RTS
Date: 2012-02-02
#>
param (
   [Parameter(Position=0,Mandatory=$true,HelpMessage="This need to be a Hyper-V Host name or object",
    ValueFromPipeline=$True)]
    $VMHost,
	[string]$refVMHost = "",
	[string]$VirtualNetworkName = "VMs",
    [string]$VMHostnic = "VM"
    )
 
$VMHost = Get-VMHost $VMHost
if ($VMHost -ne $null) {
	if ($refVMHost -eq ""){
		$LogicalNetworks = Get-SCLogicalNetwork
	}else
    {
		$LogicalNetworks = Get-SCLogicalNetwork -VMHost $refVMHost
	}
	
	$vmHostNetworkAdapter = Get-SCVMHostNetworkAdapter -VMHost $VMHost -Name $VMHostnic
	$virtualNetwork = New-SCVirtualNetwork -VMHost $VMHost -Name $VirtualNetworkName -Description "" -BoundToVMHost $false -VMHostNetworkAdapters $vmHostNetworkAdapter	   
	$vmHostNetworkAdapter = Get-SCVMHostNetworkAdapter -Name $VMHostnic -VMHost $VMHost
	foreach ($LogicalNet in $LogicalNetworks){
		Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $vmHostNetworkAdapter -AddOrSetLogicalNetwork $logicalNet
	}
}
}

 

Create and destroy Logical Networks with powershell in SCVMM 2012

I am at a customer and setting up an new environment with Hyper-V hosts and SCVMM 2012 RC, we have succesfully created host-vhd and got bare-metal deploy working including HP PSP software and NIC-Teaming configuration. The hosts are deployed with Windows 2008 R2 Datacenter Core SP1 on HP BL460c G7 blades with flexfabric and an EMC SAN delivers the disks.

Now we had to get the network configured, the customer has several VLANs and i have configured the Hyper-V hosts with the HP nic team tool and have two teamed NICs for the VM traffic. To not have to configure one virtual nic/switch for each VLAN i have enabled promiscuous mode.

Now to make it easier we create a bunch of Logical Networks with some powershell in the SCVMM 2012 powershell console, this because setting up 20 networks manually and also associate them on every host in the cluster is kind of boring, cause if i do not associate the logical networks to the hosts VM adapter i can not assign them on the VMs.

So what does the script look like, the help info from SCVMM powershell console and also view script button in the helps allot when trying to find out what i need to make it work. There are some differences in the cmdlets between vmm 2008 r2 and the 2012 rc.

# Create SCVMM virtual networks and associate them with hosts
#
# Niklas Akerlund /RTS

$VLANs = Import-Csv vlan1.csv -Delimiter ";"
$VMHostGroup = Get-SCVMHostgroup
$VMHosts = Get-SCVMHost
$LogicalNetworks = @()
foreach ($VLAN in $VLANs){
    $LogicalNetwork = New-SCLogicalNetwork -Name $VLAN.Name
    $LogicalNetworks += $LogicalNetwork
    $Network = $VLAN.IPnet + $VLAN.Octet
    $SubnetVlan = New-SCSubnetVLan -Subnet $Network -VLanID $VLAN.VLAN
    New-SCLogicalNetworkDefinition -Name $VLAN.Name -LogicalNetwork $logicalNetwork -VMHostGroup $VMHostGroup -SubnetVLan $SubnetVlan
    
}

foreach ($VMHost in $VMHosts){   
    $vmHostNetworkAdapter = Get-SCVMHostNetworkAdapter -Name "VM" -VMHost $VMHost
    foreach ($LogicalNet in $LogicalNetworks){
        Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $vmHostNetworkAdapter -AddOrSetLogicalNetwork $logicalNet
    }
}

After running the script it looks like this in the properties on one Logical Network.

After this i also want to be able to remove the Logical Networks (or at least some) when they are not needed anymore, As there are some dependencies we have to remove these first and at last the Logical Network

# Remove Logical Networks from SCVMM2012
#
# Niklas Åkerlund /RTS
#

$VLANs = Import-CSV vlan1.csv -Delimiter ";"
$VMHosts = Get-VMHost

foreach ($VLAN in $VLANs){
    $LogicalNetwork = Get-SCLogicalNetwork $VLAN.Name
    if ($LogicalNetwork -ne $null){
        foreach ($VMHost in $VMHosts){
            $VMHostNetworkAdapter = Get-SCVMHostNetworkAdapter -Name "VM" -VMHost $VMHost
            Set-SCVMHostNetworkAdapter -VMHostNetworkAdapter $VMHostNetworkAdapter -RemoveLogicalNetwork $LogicalNetwork
        }
        $LogicalNetworkDefinition = Get-SCLogicalNetworkDefinition -LogicalNetwork $LogicalNetwork 
        Remove-SCLogicalNetworkDefinition -LogicalNetworkDefinition $LogicalNetworkDefinition
    
        Remove-SCLogicalNetwork -LogicalNetwork $LogicalNetwork
    }
}

To get some more information about the powershell cmdlets look at this reference site.
.

Hyper-V R2 Core host networking problem in VMM 2008 R2

This Friday i helped a customer with a little problem, they have a Hyper-V cluster with 4 nodes, after a switch firmware upgrade they experienced some networking instability and in their search of failure they accidentally unchecked the Host access checkbox in the networking properties on the net, as their networking configuration did not allow a separate nic for the management we had to set it up with this enabled. Of course when they applied this change the host lost connection.

I instructed them to use the 59manager to configure the host locally and set the host access on this virtual switch, this did not help cause the server would still not respond. I went over to help them on site, the first thing we did was to remove the host from the cluster and then start to test and when we removed the virtual switch the nic started to respond to ping but as soon as we re-added it to the virtual switch it stopped working. We also tried to remove the nic config and set it to dhcp and then add it to the virtual switch with the host access enabled, which did not work either. After this when we tried to set the IP in SCONFIG we got an error that stated that there was an error and the address could not be set. I thought it might be some bug in the team networking sw or drivers so we updated those as well, but no more luck there either..

Then we found the following site that described the exact same problem, Microsoft Enterprise Networking Team , in this blog they referred to a script that clean out the whole hosts virtual networking config, “nvspcrub.js” , with the /p option. Well we had to try something so we ran the script and cleared the hosts all virtual switches.  Then we added a new virtual switch and checked the Host access and tried to set the IP in SCONFIG, Still same error with “Can not set IP address”, After this we where almost on our way to give up and reinstall the host, then we thought of one last chance to set the IP through netsh (this after reading about a bug with SCONFIG) so with the command

netsh int ip set add "Local area connection 3" static 192.168.8.139 255.255.255.0 192.168.8.254

It actually worked and the host started to respond to ping 🙂 , quite frustrating that we removed all the config and then find out it was a bug in sconfig that was the causing the error.

Now we had to re-add all virtual networking switches, this was of course a perfect job for powershell, so i wrote a script that took one of the other hosts config and created the same virtual switches on the failed host, also connecting to the NIC corresponding to the right net and vlan

# Create Virtual Networks on Host
#
# Niklas Akerlund /RTS

# Take ref nic from another host

Add-PSSnapin Microsoft.SystemCenter.VirtualMachineManager
$VMMserver = Get-VMMServer sbgvmm01

$Networks = Get-VirtualNetwork | where {$_.VMHost -eq "HYP04.desso.se" -and $_.HostBoundVlanId -ne "3750"}

$NICs = Get-VMHostNetworkAdapter | where {$_.VMHost -eq "HYP01.desso.se"}

$VMHost = Get-VMhost -ComputerName "HYP01.desso.se"

foreach($Network in $Networks){
$split = $Network.Name -split ' '
if ($split[1] -eq "1"){
$Name = $split[0] + " " + $split[1]
$match = $split[2] -match "\d+"
$vlanid = $Matches[0]
$vlanid = [int]$vlanid
}elseif ($split[1] -like "VLAN*"){
$Name = $split[0]
$match = $split[1] -match "\d+"
$vlanid = $Matches[0]
$vlanid = [int]$vlanid
}else{
$Name = $split[0] + " " + $split[1]
$match = $split[2] -match "\d+"
$vlanid = $Matches[0]
$vlanid = [int]$vlanid
}

$HostNIC = Get-VMHostNetworkAdapter -VMHost $VMHost | where {$_.ConnectionName -eq $Name}

if ($HostNIC -ne $null){

New-VirtualNetwork -Name $Network.Name -VMHost $VMHost -VMHostNetworkAdapters $HostNIC -BoundToVMHost $FALSE
Set-VMHostNetworkAdapter -VMHostNetworkAdapter $HostNIC -VLANEnabled $TRUE -VLANMode "Trunk" -VLANTrunkID $vlanid
write-host $HostNIC.ConnectionName
Write-Host $vlanid
}
}

After i ran this and the host got all it´s virtual networks back i could add the host back to the cluster again. Instead of some typo errors with manually entering all the virtual switches, with some powershell we could be sure that we got the same config as the other host already in the cluster!

One thing that i first missed was the -BoundToVMHost $FALSE in the New-VirtualNetwork which resulted that all my virtual networks had the Host Access checkbox marked and i had one NIC for each of them on my host, this of course was not what i wanted, one could think that this would be false as default but for some reason MS and the VMM team thought different, well no worries i created a small script to just update my virtual networks with that option (the script above is corrected after my mistake), so i ran:

# Update networks with BoundtoHost $false
#
# Niklas Akerlund /RTS

$Networks = Get-VirtualNetwork | where {$_.VMHost -eq "HYP01.desso.se" -and $_.HostBoundVlanId -ne "3750"}

foreach ($Network in $Networks){
Set-VirtualNetwork -VirtualNetwork $Network -BoundToVMHost $false
}

Where the network with the VLAN 3750 was the one i wanted the host access to stay because it was the management nic of the host.

TEC 2011 Successfully implement and Transition into Hyper-V Session

Some summary based on my own session i held at The Experts Conference 2011 in Frankfurt yesterday. I think it was about 40 people in the crowd. The TEC is about 350 attendees total.

When i have checked with Quest if i can put my whole presentation here i will do an updated posting, i will put some points what i think is crucial when setting up a new vitualization platform.

  • Assessment and Consolidation Planning
  • Design and Testing
  • Migration and Optimization
  • Capacity Planning and Performance follow up

When deciding for a new virtualization platform, no matter if it is the first or you are going to exchange an existing, there are some steps that need to be considered. First you have to know what you are running in your datacenter, what kind of operating systems and what kind of applications, also you must get a workload profile for those servers to know what their demands are. If you do not do your homework and plan for the load you will surely get some beating from your organization when you have virtualized the servers and they run like crap. As tools you can use the Microsoft Assessment and Planning Toolkit or if you already use SCCM/SCOM you will both have inventory and performance data. Another thing to consider when planning is licensing, in a big consolidation you can save quite a much money when using Datacenter licensing on the hosts.

Design your platform to be modular and easily expanded. Do serious deciding on what your boundaries are both technically and financially this should be done in a workshop with application owners and management and then documented. Do not forget about managing and monitoring software. Another thing to rethink is how to take backup in your platform, with Hyper-V integration tools you can take consistent backups with VSS snapshot support into the VMs, we recommend our customers to take backup on host level for quicker RTO. When you have decided for a platform you can do a PoC to test your decisions and see that it works as expected, Many hardware manufacturers do lend out hw for you to test for a limited time to evaluate.

When the platform is set up and correctly configured you want to do some hardware and load testing, there are several tools for this. Memtest, IOmeter, SQLiosim, Exchange jetstress, Exchange Load Gen and others. The most important thing to consider here is that you want to check that your new platform can handle the load you did measure and predict for in the analysis and design. Also test fail-over functionality so that all hardware and software works as expected when a PSU or a network cable brakes. After all testing has successfully been made you want to document this for later so you have a validation document signed.

After you have a platform set up and tested you want to start migrate and optimize workloads into this. There are some tools that can be used for this, SCVMM, disk2vhd and Quest vConverter for example. One thing to consider when doing migration is to look back at the analysis of the workloads to set the right amount of resources, both virtual processors/vm ram and vhd disk files with the partitions inside (for best performance we would like to use fixed or pass-through disks). When optimizing after migration you want to clean out hidden devices and services/software that was used for the machine in the physical world but do not have a purpose anymore!

When all your machines are migrated we want to continuously check the performance and capacity so you can prepare and implement additional host resources before it runs out. You can use SCOM/SCVMM if you have it in your environment, another great performance tool is the PAL (Performance Analysis of Logs ) that you can use in conjuction with performance counters and logman to schedule datasets on your Hyper-V Core host servers, also there is a product from Quest, vFoglight.

the last slide i had a strip from Dilbert that i find quite funny, statement though: WE DO NOT LEAVE OUR CUSTOMERS AS DOGBERT DOES AFTER A virtualization Project 😛

links

MAP 6.0

Memtest

PAL

Performance tuning win 2008 R2 SP1

 

Win 8 Server dev preview and Hyper-V NIC team

There is quite a buzz out on twitter and blogs about the new features that has come to Windows 8 and the new Hyper-V version. I want to give you a little heads up about how it works to create network team with NICs (yes it works with different nic cards. in my case a Intel and a Broadcom)

I have now installed the server on my test-machine in our office and was eager to test the NIC teaming, at first i did not understand how it was working and tried to bind two nics together in the network connections window in the control panel, as i later realized and read in Aidan Finns´s blog, that it is done through the LBFOAdmin.exe (this is opened when pressing Nic Teaming Enabled/Disabled)

There you have to highligt your server to configure it, as the new server manager can handle remote servers and you can configure several workloads at the same time and you do not have to log in to each server to administer it.

I have named my team to NET2000 and added the two nics, i have also set it to be switch independent (i have actually set it in a simple 5 port switch), you can also chose LACP or Static Teaming. For Load Distribution mode you can chose Address Hash or Hyper-V port (now i am sharing the team with the management and a hyper-v switch so i am using the Address Hash.

As yo can see i can then add several virtual nics with different vlan id. I really hope that the fix one issue though, as you can see here i have a virtual nic interface called VMnet, when i then want to add this in the hyper-v manager it does have a different name as you can see in the next screenshot. It would have been wonderful to be able to se the Name also in the virtual switch manager.

As i before had to use the same network cards from the same manufacture and use their teaming software this is a giant step forward with the win 8 and the built in teaming functions. One thing to test later when i get my hands on a nic that can handle SR-IOV is how that feature works with a team, but that is  another blog post!