Upgrading aSimpleProMP in System Center Virtual Machine Manager 2008 R2 to System Center 2012 – Virtual Machine Manager Microsoft Corporation Published: July, 2012 Copyright This document is provided "as-is". Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes. You may modify this document for your internal, reference purposes. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Active Directory, Bing, Excel, Hyper-V, Internet Explorer, Silverlight, SQL Server, Windows, Windows Intune, Windows PowerShell, Windows Server, and Windows Vista are trademarks of the Microsoft group of companies. All other trademarks are property of their respective owners. Revision History Release Date Changes June 27, 2012 Original release of this guide. Contents Introduction .................................................................................................................................................. 3 MP Schema ................................................................................................................................................... 3 References ................................................................................................................................................ 3 Class Definition and Relationships ............................................................................................................ 4 Discovery ................................................................................................................................................... 6 Recovery.................................................................................................................................................... 7 Built-In event triggers ........................................................................................................................... 7 Built-In Recovery WriteAction module ................................................................................................. 7 Override Groups........................................................................................................................................ 9 Introduction This document describes the details of how to upgrade a Physical Resource Optimization (PRO) management pack “aSimplePROMP” in System Center Virtual Machine Manager 2008 R2 to System Center 2012 – Virtual Machine Manager. For information about authoring a PRO management pack using System Center Virtual Machine Manager 2008 R2, see: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=192 MP Schema References The PRO Framework in System Center 2012 – Virtual Machine Manager has been extended with the addition of management pack objects and modules. In order to use some of these new classes and modules you need to include four new references to the System Center 2012 – Virtual Machine Manager management pack and remove old references to the System Center 2008 Virtual Machine Manager R2 management pack. You need to add references to VMM library, PRO library, PRO V2 Library, and System Center 2012 VMM Discovery management packs, as follows: <Reference Alias="PRO"> <ID>Microsoft.SystemCenter.VirtualMachineManager.PRO.Library</ID> <Version>3.0.6007.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="PROV2Library"> <ID>Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Library</ID> <Version>3.0.6007.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="VMMDiscovery"> <ID>Microsoft.SystemCenter.VirtualMachineManager.2012.Discovery</ID> <Version>3.0.6007..0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> <Reference Alias="VMMLibrary"> <ID>Microsoft.SystemCenter.VirtualMachineManager.Library</ID> <Version>3.0.6007.0</Version> <PublicKeyToken>31bf3856ad364e35</PublicKeyToken> </Reference> Class Definition and Relationships In System Center Virtual Machine Manager 2008 R2 there is only a single public base class for PRO. In System Center 2012 - Virtual Machine Manager there are seven new base classes (Host, HostCluster, VMMServer, Cloud, Service, VirtualMachine, ComputerTier), which are illustrated below: <!-- V2 Target classes --> <ClassType ID="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.VirtualMachine" Accessibility="Public" Abstract="true" Base="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Base" Hosted="false" Singleton="false" > <Property ID="VMName" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="Owner" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="CreationTime" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="Description" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="TotalRAM" Type="int" Key="false" /> <Property ID="NoOfVirtualDisks" Type="int" Key="false" /> <Property ID="NoOfNICs" Type="int" Key="false" /> <Property ID="MaxSizeOfVirtualDisks" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="ProcessorCount" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="DeploymentPath" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="CostCenter" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="HostName" Type="string" Key="false" CaseSensitive="false" Length="255" /> </ClassType> <ClassType ID="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.VMMServer" Accessibility="Public" Abstract="true" Base="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Base" Hosted="false" Singleton="false" > <Property ID="Version" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="ServiceAccount" Type="string" Key="false" CaseSensitive="false" Length="255" /> </ClassType> <ClassType ID="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Service" Accessibility="Public" Abstract="true" Base="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Base" Hosted="false" Singleton="false"> <Property ID="Owner" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="Release" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="ServiceTemplateName" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="ServicePriority" Type="string" Key="false" CaseSensitive="false" Length="255" /> </ClassType> <ClassType ID="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Cloud" Accessibility="Public" Abstract="true" Base="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Base" Hosted="false" Singleton="false" > <Property ID="HostGroup" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="Owner" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="CPUCountInitial" Type="int" Key="false" /> <Property ID="CustomQuotaCount" Type="int" Key="false" /> <Property ID="LibraryStorageGB" Type="int" Key="false" /> <Property ID="MemoryGB" Type="int" Key="false" /> <Property ID="StorageGB" Type="int" Key="false" /> <Property ID="VMCount" Type="int" Key="false" /> </ClassType> <ClassType ID="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Host" Accessibility="Public" Abstract="true" Base="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Base" Hosted="false" Singleton="false" > <Property ID="HostGroup" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="NumberOfProcessors" Type="int" Key="false" /> <Property ID="TotalRAM" Type="int" Key="false" /> <Property ID="NoOfVMsDeployed" Type="int" Key="false" /> <Property ID="VirtualizationPlatform" Type="string" Key="false" CaseSensitive="false" Length="255" /> </ClassType> <ClassType ID="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.HostCluster" Accessibility="Public" Abstract="true" Base="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Base" Hosted="false" Singleton="false" > <Property ID="ClusterReserve" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="HostGroup" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="NodeCount" Type="int" Key="false" /> <Property ID="NodeNames" Type="string" Key="false" CaseSensitive="false" Length="255" /> <Property ID="VirtualizationPlatform" Type="string" Key="false" CaseSensitive="false" Length="255" /> </ClassType> <!-- ComputerTier --> <ClassType ID="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.ComputerTier" Accessibility="Public" Abstract="true" Base="Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Base" Hosted="false" Singleton="false" > </ClassType> For aSimpleProMP you need to change the base class from 2008 Public to New V2 Host target. Note: The 2008 Public class still exists for backwards compatibility, however it is recommended that you upgrade to the newly defined V2 PRO target classes. Since the management pack needs to run on the target host you need to add a hosting relationship for the class object. If the management pack runs on the Management Server, then this relationship is not needed. <EntityTypes> <ClassTypes> <ClassType ID="aSimpleProMP.NewClass" Accessibility="Internal" Abstract="false" Base="PROV2!Microsoft.SystemCenter.VirtualMachineManager.Pro.V2.Host" Hosted="true" Singleton="false"> <Property ID="Version" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" /> </ClassType> </ClassTypes> <RelationshipTypes> <RelationshipType ID="Computer.Hosts.aSimplePROMP.NewClass" Accessibility="Public" Abstract="false" Base="System!System.Hosting"> <Source>Windows!Microsoft.Windows.Computer</Source> <Target>aSimpleProMP.NewClass</Target> </RelationshipType> </RelationshipTypes> </EntityTypes> Discovery Discovery needs to remove the 2008 Hyper-V target as this is no longer discovered by System Center 2012 – Virtual Machine Manager and be replaced by the VMM library class for VMHost. Using the VMMLibrary objects ensures future backwards compatibility. This is illustrated below: <Discovery ID="aSimpleProMP.NewDiscovery" Enabled="true" Target="VMMLibrary!Microsoft.SystemCenter.VirtualMachineManager.VMHost" ConfirmDelivery="false" Remotable="true" Priority="Normal"> Recovery Built-In event triggers In System Center 2012 – Virtual Machine Manager, PRO Packs no longer need a WriteAction to trigger alerts for the distributed Rules to pick up. Instead, there is a new built-in action that generates alerts for you. Since the aSimpleProMP consists of only a recovery action, you need to make only one change, as follows: Recovery WriteAction for generating a Recovery event: <Recovery ID="aSimpleProMP.NewRecovery" Accessibility="Internal" Enabled="false" Target="aSimpleProMP.NewClass" Monitor="aSimpleProMP.NewMonitor" ResetMonitor="false" ExecuteOnState="Error" Remotable="true" Timeout="300"> <Category>Custom</Category> <WriteAction ID="CreateRecoveryEvent" TypeID="PROV2Library!Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Recovery.CreateEvent"> <Name>"$Target/Property[Type="PRO!Microsoft.SystemCenter.VirtualMachineManager.PRO.Base"]/Na me$"</Name> <VMMServer>"$Target/Property[Type="PRO!Microsoft.SystemCenter.VirtualMachineManager.PRO.Base" ]/VMMServer$"</VMMServer> <PROTipID>"$Data/StateChange/DataItem/EventOriginId$"</PROTipID> <EventID>60</EventID> <EventSource>VMMPro</EventSource> <ScriptParameters>0</ScriptParameters> </WriteAction> </Recovery> Diagnostic ProbeAction for generating a Diagnostic event: PROV2Library!Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Diagnostics.CreateEvent Built-In Recovery WriteAction module System Center 2012 – Virtual Machine Manager features a new WriteAction for creating a remote powershell session to VMMServer and loading the new PowerShell Module (note: VMM no longer has a Snap-in module). It will then pass back the session and variables so that recovery scripts can operate. Variables that can be used are $VMMServer=”Name of VMMServer”, $HostName=”Name of Hosted object”, $PROTipID=”PROTip Guid ID”. The module also allows additional parameters to be passed through if needed through the script parameters as shown above in the Recovery module. With System Center 2012 –Virtual Machine Manager, you only need to handle VMM tasks in the WriteAction module, as follows: <WriteActionModuleType ID="aSimpleProMP.Recovery" Accessibility="Internal" Batching="false"> <Configuration> <xsd:element minOccurs="1" name="EventDescription" type="xsd:string" /> </Configuration> <OverrideableParameters> <OverrideableParameter ID="EventDescription" Selector="$Config/EventDescription$" ParameterType="string" /> </OverrideableParameters> <ModuleImplementation Isolation="Any"> <Composite> <MemberModules> <WriteAction ID="Recovery" TypeID="PROV2Library!Microsoft.SystemCenter.VirtualMachineManager.PRO.V2.Recovery.RecoveryScrip tModule"> <EventDescription>$Config/EventDescription$</EventDescription> <ScriptBody> ############################################################################# # Description: This is where you insert the VMM PowerShell script that executes # in order to enable a recovery. The logic of this script is dependent on the scenario, # its causes and its appropriate resolution. This script merely invokes a successful # PRO Tip Implementation. Full details on scripts are provided in the documentation provided. ############################################################################# ############################################################################# # DISCLAIMER: # Copyright (c) Microsoft Corporation. All rights reserved. This # script is made available to you without any express, implied or # statutory warranty, not even the implied warranty of # merchantability or fitness for a particular purpose, or the # warranty of title or non-infringement. The entire risk of the # use or the results from the use of this script remains with you. ############################################################################# Param($eventContent); #Set the PRO tip status to Resolved once the processing is complete Set-PROTip -PROTipId $ProtipId -TipStatus Resolved; </ScriptBody> <TimeoutSeconds>120</TimeoutSeconds> </WriteAction> </MemberModules> <Composition> <Node ID="Recovery" /> </Composition> </Composite> </ModuleImplementation> <OutputType>System!System.CommandOutput</OutputType> <InputType>System!System.BaseData</InputType> </WriteActionModuleType> Override Groups The Overrides that were needed in the System Center Virtual Machine Manager 2008 R2 management pack for Groups are no longer needed to turn monitors on/off, and should be removed. <Overrides> <MonitorPropertyOverride ID="aSimpleProMP.EnableC" Context="MicrosoftSystemCenterVirtualMachineManagerPro2008Library!Microsoft.SystemCenter.Virtual MachineManager.Pro.2008.EnableC.Group" Enforced="false" Monitor="aSimpleProMP.NewMonitor" Property="Enabled"> <Value>true</Value> </MonitorPropertyOverride> <RecoveryPropertyOverride ID="aSimpleProMP.EnableWC" Context="MicrosoftSystemCenterVirtualMachineManagerPro2008Library!Microsoft.SystemCenter.Virtual MachineManager.Pro.2008.EnableWC.Group" Enforced="false" Monitor="aSimpleProMP.NewMonitor" Property="Enabled"> <Value>true</Value> </RecoveryPropertyOverride> <RecoveryPropertyOverride ID="aSimpleProMP.RecoveryC" Context="MicrosoftSystemCenterVirtualMachineManagerPro2008Library!Microsoft.SystemCenter.Virtual MachineManager.Pro.2008.RecoveryC.Group" Enforced="false" Monitor="aSimpleProMP.NewMonitor" Property="Enabled"> <Value>true</Value> </RecoveryPropertyOverride> <MonitorPropertyOverride ID="aSimpleProMP.RecoveryWC" Context="MicrosoftSystemCenterVirtualMachineManagerPro2008Library!Microsoft.SystemCenter.Virtual MachineManager.Pro.2008.RecoveryWC.Group" Enforced="false" Monitor="aSimpleProMP.NewMonitor" Property="Enabled"> <Value>true</Value> </RecoveryPropertyOverride> </Overrides>