SCVMM: Remove an Alias or Konflikt mit Hyper-V Powershell
Wer die Powershell Module von SCVMM und die Community Module zu Hyper-V gleichzeitig benutzen will, bekommt bei einigen Funktionen einen Konflikt.
Eigentlich sind alle Funktionen vom SCVMM eindeutig mit einem SC bezeichnet. So heißt die Funktion, um das Objekt einer Virtuellen Maschine zu erhalten get-SCVirtualMachine. Wahrscheinlich aus historischen Gründen gibt es aber eine Alias namens “get-VM” auf diese Funktion.
Die CodePlex Hyper-V Funktionen haben keinen gesonderten Namensraum. Hier heißt die Funktion für die Virtuelle Maschine einfach get-VM. Dies wäre nicht so schlimm, wenn die Funktion nicht auch intern fleißig genutzt wird. Möchte man die CodePlex Funktionen nutzen, um Differenzielle Disks zu erstellen (etwas was der SCVMM auch in 2012 nicht anbietet), so funktioniert dies nicht mehr, wenn beide Module geladen sind.
SCVMM: mit Powershell Teil 1
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
EventID 21502 im Hyper-V Cluster
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:
Die Konfiguration sollte eigentlich immer Online sein. Sie steht für die Registrierung der Virtuellen Maschine auf dem jeweiligen Hyper-V Knoten.
SCVMM/Hyper-V: Löschen von VMs
Kann 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:
Support policy for Microsoft SQL Server products that are running in a hardware virtualization environment
If 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:
- SQL 2005 or higher is supported on Hyper-V or a hypervisor validated in the SVVP program
- Snapshots of the VM are NOT supported.
- Hyper-V Dynamic Memory is supported but only useful with SQL Server version Enterprise and Datacenter
Re-Import VMs into Hyper-V
Normaly 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:
- importVM.cmd “GUID” “Path to Virtual Machine” creates the link and corrects the permissions on the link and the vm folder
- 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:
- 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 ——
Storage Migration mit SCVMM und Hyper-V kontrollieren
Wenn man am PC ein so ungeduldiger Mensch wie ich ist, dann möchte man bei einer Storage Migration mit dem SCVMM irgendwann mehr sehen, als nur die (bereits relativ detaillierte) Statusanzeige des Jobs in der System Center Virtual Machine Manager (SCVMM) Konsole.
Der längste Teil des Verschiebens ist im allgemeinen das Kopieren der VHD Dateien. SCVMM verwendet dazu den Bits Agent auf dem Hyper-V Server. Das hat den Vorteil, dass dieser nur die zur Verfügung stehende Bandbreite nutzt und somit nicht den normalen Produktionsverkehr stört.
Definieren des zu verwendenden Netzwerkes für LiveMigration
In 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:
Windows 2008 R2 SP1 Beta – Dynamic Memory
Einige der wenigen Neuerungen im Service Pack 1 für Windows 2008 R2 ist Dynamic Memory für die Hyper-V Rolle. Eine gute Erklärung findet man unter http://blogs.technet.com/b/virtualization/archive/2010/07/12/dynamic-memory-coming-to-hyper-v-part-6.aspx.
Zum Testen habe ich einen der Hyper-V Server Knoten im Cluster mit der Betaversion ausgestattet. Wie im Artikel oben beschrieben wird das Verändern des genutzten Speichers durch die Gast-OS durchgeführt. Dazu scheint Microsoft ein neues Device in den VMBus einzuhängen.
VirtualBox 3.2.0 Beta mit interessanten neuen Funktionen
Heute ist die Beta zur Version 3.2 von VirtualBox im Forum publiziert worden. Unterstütz wird jetzt z.B. ein Memory Balloning, dass sogar erst Hyper-V in irgendeiner Form erst mit Windows 2008 R2 SP1 erhalten wird.
Hier die Liste der weiteren Features:
VirtualBox Version 3.2.0 is a major update. The following major new features were added:
- Following the acquisition of Sun Microsystems by Oracle Corporation, the product is now called Oracle VM VirtualBox and all references were changed without impacting compatibility.
- Experimental support for Mac OS X guests
- Memory ballooning to dynamically in- or decrease the amount of RAM used by a VM (64-bit hosts only) (see the manual for more information)
- CPU hot-plugging for Linux (hot-add and hot-remove) and certain Windows guests (hot-add only) (see the manual for more information)
- New Hypervisor features: with both VT-x/AMD-V on 64-bit hosts, using large pages can improve performance (see the manual for more information); also, on VT-x, unrestricted guest execution is now supported (if nested paging is enabled with VT-x, real mode and protected mode without paging code runs faster, which mainly speeds up guest OS booting)
- Support for deleting snapshots while the VM is running
- Support for multi-monitor guest setups in the GUI (see the manual for more information)
- USB tablet/keyboard emulation for improved user experience if no Guest Additions are available
- LsiLogic SAS controller emulation
- RDP video acceleration
- NAT engine configuration via API and VBoxManage
- Guest Additions: added support for executing guest applications from the host system
- OVF: enhanced OVF support with custom namespace to preserve settings that are not part of the base OVF standard
Da die Software jetzt in Oracle VM VirtualBox umbenannt wird, ist die Wahrscheinlichkeit wohl groß, dass Oracle sie auch weiterpflegen wird.