Archive

Archive for the ‘Hyper-V’ Category

Hyper-V 3.0: Kleines Script zum Aufräumen

March 17th, 2013 No comments

Je nachdem wie gründlich man seinen Hyper-V Server pflegt, kann es passieren, dass im Cluster Shared Volume (CSV) ein paar Leichen übrig bleiben, da beim Löschen einer Virtuellen Maschine (VM) nicht automatisch die zugehörigen Disks (VHD) gelöscht werden.

Daher habe ich für meine Demo-Umgebung ein kleines Powershell Script geschrieben, dass alle an im Cluster registrierten VMs angehängte Disks auflistet und diese mit den im Dateisystem vorhandenen VHD Dateien abgleicht. Das Ergebnis kann dann genutzt werden, um eventuelle Leichen zu entdecken.

$vms=get-cluster | Get-ClusterResource | where {$_.ResourceType -like 'Virtual Machine'} | get-vm
$arrFiles=@()
$vms | ForEach-Object {
  $vm=$_
  #Add Hard disks to array
  $vm.HardDrives | ForEach-Object {
    $arrFiles+=$_.Path
  }
  #add isos to array
  $vm.DVDDrives | ForEach-Object {
    $arrFiles+=$_.Path
  }
}
#$arrFiles
Get-ChildItem C:\ClusterStorage -Recurse -Include *.vhd,*.vhdx,*.iso | ForEach-Object {
$file=$_.FullName
if ($arrFiles -notcontains $file) {
    write-host $file 
 }
} 
Categories: Hyper-V, Powershell Tags: ,

Hyper-V 3.0: Measure und NetworkACL

September 30th, 2012 No comments

Nachdem im letzten Artikel eine riesige Auswahl von Neuerungen in Windows 2012 vorgestellt wurden, soll dieser Artikel auf zwei Spezialitäten eingehen, die momentan nur mit PowerShell zu aktivieren sind:

  • Network ACLs: pro Virtuellen Maschine (VM) auf Netzwerkebene definieren, auf welche Zielsysteme die VM zugreifen kann. Diese “Firewall”-Funktion wird direkt durch Hyper-V durchgeführt und ist vom in der VM eingesetzten Betriebssystem unabhängig
  • Metering von VMs: Mitprotokollieren von Verbrauchswerten einer VM

Network ACL

Read more…

Hyper-V 3.0

September 30th, 2012 No comments

Im Rahmen einer Vortragsserie haben ein Kollege und ich die Neuerungen in Windows Server 2012 vorgestellt.  In diesem Post möchte ich diese nochmal zusammenfassen und einige Details erklären:

In folgenden Bereichen sehe ich Neuerungen:

Limits

  • 64vCPUs per Guest
  • 4TB per Host
  • 320 logical CPUs pro Host
  • 1TB pro VM
  • 64 Cluster Nodes
  • 4000 VMs pro Cluster

Memory Read more…

Hyper-V: Extra Rechte auf Hyper-V für Nicht-Adminuser einrichten

January 22nd, 2012 No comments

user-adminGrundsätzlich darf auf einen Hyper-V Server nur ein Administrator zugreifen (Mitglied der lokalen Administratorengruppe). Setzt man den System Center Virtual Machine Manager (SCVMM) ein, so ermöglicht dieser einem u.a. ein rollenbasiertes Management. Dabei erfindet er das Rad nicht neu, sondern setzt ein Feature des Hyper-Vs ein, dass in meinen Augen zwar gut dokumentiert aber relativ unbekannt ist.

Dazu verwendet Hyper-V das rollenbasierte Accessmanagement (RBAC) und die dafür verfügbare GUI AzMan. Die Konfigurationsinformationen werden in einer XML Datei unter ProgramData\Microsoft\Windows\Hyper-V\InitialStorage.xml abgelegt. Achtung: Verwendet man den VMM Agent, so wird der Ort der XML Datei auf ProgramData\microsoft\Virtual Machine Manager\HyperVAuthStore.xml geändert!

Ich beschreibe hier die Vorgehensweise, wie man einer zusätzlichen benutzergruppe das Recht einräumen kann auf die Konsole der Virtuellen Maschinen zugreifen zu können:

Zuerst startet man die AzMan Konsole:

image

Read more…

SCVMM: mit Powershell Teil 1

December 4th, 2011 No comments

Ich habe gerade das Glück etwas mehr mit Powershell und System Center Virtual Machine Manager 2012 (SCVMM, RC) zu arbeiten. Daher werde ich hier wieder ein paar Codesnippsel posten, um bestimmte Funktionen zu automatisieren:

die erste Funktion soll eine neue Cloud für Hyper-V erzeugen . Zusätzlich wird ein neue Rolle für diese Cloud angelegt, die nur VMs verwalten darf.

#creates a new cloud and a corresponding usergroup
function createCloud([string]$name,[string]$hostgroupname)
{
   #retrieving first GUID for creating the new cloud
     $job= ([System.Guid]::NewGuid().toString())
   #define Cloud limitations (here: no limit)
     Set-SCCloudCapacity -JobGroup $job -UseCustomQuotaCountMaximum $true -UseMemoryMBMaximum $true -UseCPUCountMaximum $true -UseStorageGBMaximum $true -UseVMCountMaximum $true
   #setting the used network (here: the network has the same name as the cloud)
     $resources = @()
     $resources += Get-SCLogicalNetwork -Name $Name
   #defining that the cloud can be used on hyper-v server
     $addCapabilityProfiles = @()
     $addCapabilityProfiles += Get-SCCapabilityProfile -Name "Hyper-V"
   #adding the settings to the cloud with the defined GUID
     Set-SCCloud -JobGroup $job -RunAsynchronously -AddCloudResource $resources -AddCapabilityProfile $addCapabilityProfiles
   #adding the cloud to the hostgroup
     $hostGroups = @()
     $hostGroups += Get-SCVMHostGroup -Name $hostgroupname
   #creating the cloud and the rest from the first job :-) 
     New-SCCloud -JobGroup $Job -VMHostGroup $hostGroups -Name $Name -RunAsynchronously

#creating the usergroup
   #GUID for the second job
     $job= ([System.Guid]::NewGuid().toString())
   #the roleis for the newly created cloud
     $scopeToAdd = @()
     $scopeToAdd += Get-SCCloud -name $name
   #the user of this role can start, stop and shutdown virtual machines in the cloud and start a remote control
     Set-SCUserRole -JobGroup $job -AddScope $scopeToAdd -Permission @("RemoteConnect", "Shutdown", "Start", "Stop") -ShowPROTips $false
     $cloud = Get-SCCloud -Name $name
   #add all settings to the role
     Set-SCUserRoleQuota -Cloud $cloud -JobGroup $job -QuotaPerUser -UseCPUCountMaximum -UseMemoryMBMaximum -UseStorageGBMaximum -UseCustomQuotaCountMaximum -UseVMCountMaximum
   #create the role with the job guid
     New-SCUserRole -Name $name -UserRoleProfile "SelfServiceUser" -Description "" -JobGroup $job
}

Die Funktion kann einfach per


createCloud "MeineCloud" "Alle Hosts"

aufgerufen werden.

EventID 21502 im Hyper-V Cluster

August 11th, 2011 No comments

Als Ergänzung vom Blog-Eintrag Re-Import von VMs folgt eine Lösung, wenn nach einem Re-Import die Maschine im Cluster nicht startbar ist. Die Detailansicht im Cluster-Manager sieht wie im nachfolgenden Bild aus:

image001-hv

Die Konfiguration sollte eigentlich immer Online sein. Sie steht für die Registrierung der Virtuellen Maschine auf dem jeweiligen Hyper-V Knoten.
Read more…

Categories: Deutsch, Hyper-V Tags: , ,

SCVMM/Hyper-V: Löschen von VMs

May 19th, 2011 No comments

timerKann mir einer das mal erklären? Löscht man in Hyper-V eine VM, die Snapshots hat, dann werden erst alle Snapshots gelöscht, also in das Hauptfile zurückgeschrieben und dann die entsprechende Disk. Was für einen Sinn macht das?

Besonders extrem wird es, wenn man ein Storage Migration mit SCVMM (System Center Virtual Machine Manager 2012) macht. Dabei wird eine neue VM angelegt, die Disks kopiert und dann die alte VM mit den Disks gelöscht. Was dann bei einer VM mit Snapshots passiert kann man sich denken:

Ansicht des Jobs im SCVMM 2012:

scvmm

Wie man sieht wurden die Disks innerhalb 3 Minuten kopiert und jetzt (ca. 14:05) hängt er immer noch beim Entfernen der VM.

In der Hyper-V Konsole sieht es zu dem Zeitpunkt so aus:

hyper-v

Destroying ist bei 25% Smiley

Ich kann mir den Sinn davon nicht erklären. Vielleicht irgendein anderer hier??

Support policy for Microsoft SQL Server products that are running in a hardware virtualization environment

May 15th, 2011 No comments

checkmarkIf you want to know if it is supported to run the SQL Server in a virtualized environment than this is the right article for you:

http://support.microsoft.com/kb/956893/en-us

Summaries:

  1. SQL 2005 or higher is supported on Hyper-V or a hypervisor validated in the SVVP program
  2. Snapshots of the VM are NOT supported.
  3. Hyper-V Dynamic Memory is supported but only useful with SQL Server version Enterprise and Datacenter
Categories: English, Hyper-V Tags: , ,

Re-Import VMs into Hyper-V

May 3rd, 2011 2 comments

toolsNormaly you can only import a Virtual Machine (VM) into Hyper-V if you have exported it. If you lose your Hyper-V settings or have to import it into a new Hyper-V Server in case of a desaster recovery than you can use the steps descripted in this (and other) blog post: http://blogs.msdn.com/b/robertvi/archive/2008/12/19/howto-manually-add-a-vm-configuration-to-hyper-v.aspx

The problem is that you have to handle many long pathes and cryptical GUIDs. I had to do that for a bunch of different VMs and being chronical lacy I created three batch files for it:

  1. importVM.cmd “GUID” “Path to Virtual Machine” creates the link and corrects the permissions on the link and the vm folder
  2. importSnapshot.cmd “SnapshotGuid” “VMGuid” “Path to Snapshot” creates the snapshot link and the right permission.

Not very impressiv? Well, the third batch files combines this two scripts:

  1. addMachine.cmd: Takes the basis path (the path where the sub-folder Virtual Machine, Snapshots exists) and extracts the VM-GUID, all Snapshots-GUIDs and the other pathes to automaticly create the links and permissions.

So with one simple command (addMachine.cmd C:\ClusterStorage\Volume4\VM1) you can import the complete VM.

— addMachine.cmd ——

Read more…

Definieren des zu verwendenden Netzwerkes für LiveMigration

March 15th, 2011 No comments

icon-17In einigen Fällen möchte man definieren, welche Netzwerkkarte(n) ein Hyper-V Cluster für die Übertragung der RAM Inhalte bei einer Live Migration verwenden soll.

Diese Option ist in der Cluster Konsole relativ versteckt und kann pro Virtueller Maschine definieren. Damit ich sie beim nächsten Mal wiederfinde dokumentiere ich sie mal hier:

Zuerst schaut man sich in der Clusterkonsole die Details einer Virtuellen Maschine an:

LiveMigrationNetzwerk1

Danach öffnet man die Eigenschaften der Clusterressource (im Bild blau markiert).

In diesem Dialog kann man auf der Registerkarte die zu verwendenden Netzwerke und auch deren Priorität auswählen.

LiveMigrationNetzwerk2

Categories: Deutsch, Hyper-V Tags: , ,