Tivoli Provisioning Manager is a core provisioning engine for cloud platforms that automates best practices — specifically handy for common data center provisioning activities — through its ability to maintain configurations and manage changes to resources. (See a list of Tivoli Provisioning Manager data center automation features.) Figure 1 describes the layers of a cloud platform.
Figure 1. Cloud platform reference architecture
You can see Tivoli Provisioning Manager is on the provisioning management layer providing provisioning services; Hyper-V is a virtual platform which virtualizes and manages the physical resources.
By default, Tivoli Provisioning Manager can support Hyper-V with such limited functionalities as basic computer discovery, but most of the provisioning services have to be developed from scratch. In this article, we detail two approaches to implement Hyper-V provisioning on Tivoli Provisioning Manager and provide sample code and the configurations in Tivoli Provisioning Manager.
Two approaches to Tivoli Provisioning Manager-enabled Hyper-V support
Hyper-V provides WMI (Windows Management Instrumentation) as the entry API for the management of infrastructure and operating systems data. Based on WMI, there are three ways to implement Hyper-V provisioning through Tivoli Provisioning Manager:
- PowerShell
- VBScript
- The Java™ API
For VBScript and the Java API, there is not much difference in configuration and design so we will only detail the process for VBScript. You can use the VBScript process for the Java API.
The route from Tivoli Provisioning Manager to Hyper-V is illustrated in Figure 2:
Figure 2. Approaches to integrate Hyper-V in Tivoli Provisioning Manager
Let's provide a little more information on the approaches here, then we'll deliver more detail in the next few sections.
The PowerShell approach in a nutshell
PowerShell is an automation framework that consists of a command line shell associated with a scripting language and integrated with the .NET framework. It provides full access to WMI and COM (the Component Object Model binary-interface standard for software components that enables interprocess communication and dynamic object creation in a large range of programming languages); this enables administrators to perform administrative tasks on both local and remote Windows systems.
PowerShell 2.0 for Hyper-V (used in this article) provides a set of commands named cmdlets that allow the user to perform various operations on Hyper-V, including VM creation, destruction, and power-on and power-off.
Basically, you can implement Hyper-V provisioning with the cmdlets, although for some more enhanced features like IP assignment to a new VM, you have to call the WMI API.
The VBScript approach in a nutshell
Visual Basic Scripting (VBScript) is an Active Scripting language which is modeled on
Visual Basic. It is a lightweight language with a fast interpreter for use in a wide
variety of Microsoft-supported environments. VBScript can call the WMI API to perform VM
management and by defining the language of scriptlet as vbscript, Tivoli Provisioning Manager can also support VBScript.
The Java API approach (also in a nutshell)
This approach requires invoking the Java API to perform WMI API. Several APIs provided in the market can be used to perform the task, including com4j, j-Interop, J-Integra. Generally, the approach is to develop Java code which calls the WMI API from one end and develop a Tivoli Provisioning Manager workflow to call Java code on the other end.
Since the VBScript and Java API approaches are so similar, we'll only go into detail for the PowerShell and VBScript approaches.
Implementing the PowerShell approach
Since Tivoli Provisioning Manager doesn't support Hyper-V server as a host platform and operations can't be triggered via Tivoli Provisioning Manager on Hyper-V directly, we introduce the SCVMM (System Center Virtual Machine Manager) into the architecture as the intermediate server to manage Hyper-V server remotely. The architecture can be seen in Figure 3.
Figure 3. Hyper-V provisioning architecture via PowerShell
SCVMM comes with built-in PowerShell which can manage the Hyper-V through the command line. You must install it on the Windows OS which is identified by Tivoli Provisioning Manager. This makes SCVMM act as an intermediate server between Hyper V and Tivoli Provisioning Manager and enables Tivoli Provisioning Manager to execute commands on the SCVMM, which in turn fires the commands on Hyper-V host for various operations like VM creation, VM destroy, etc.
Configuring Tivoli Provisioning Manager
Both the Hyper-V server and SCVMM server have to be defined in Tivoli Provisioning Manager. The prerequisite is that Hyper-V server and SCVMM server are installed and configured properly; you can add hosts and create virtual machines through the SCVMM console as shown in Figure 4.
Figure 4. Adding Hyper-V server as a host in SCVMM
In Figure 4, you can see that one host (r3p13physic) is added to SCVMM and three virtual machines (HyperV002, HyperV003, HyperV-Manual) are created on the host.
The SCVMM server is treated as the host platform in Tivoli Provisioning Manager and the Hyper-V server is stamped on the host platform. The configuration steps in Tivoli Provisioning Manager are:
- Configure the Hyper-V server in Tivoli Provisioning Manager as a computer by specifying host name, IP address, and subnet mask.
- Configure the SCVMM server in Tivoli Provisioning Manager as a computer by specifying host name, IP address, subnet mask, resources, and credentials.
- Define the newly added SCVMM server as host platform in Tivoli Provisioning Manager. The important point is that resources like CPU, memory, and disk should be specified with the same value as that of Hyper-V server since you're creating a virtual machine on the Hyper-V server but deploying SCVMM to invoke the operations.
Figure 5 shows how to add CPU to SCVMM server.
Figure 5. Adding CPU resource for SCVMM server in Tivoli Provisioning Manager
-
Stamp the Hyper-V server on the SCVMM host platform by defining a variable
HyperVand specifying its value as the server name of the Hyper-V host in the SCVMM host platform. In this way, you can get the real Hyper-V server from the intermediate host platform during the provisioning.
Workflow should be written in Tivoli Provisioning Manager to implement the provisioning. Two sample workflows are provided:
- Listing 1 is designed to create a virtual machine based on a template.
- Listing 2 is designed to assign IP to one newly created VM where you can see that PowerShell with SCVMM is enough to create a VM (and then perform other similar tasks), but also one in which WMI API is still employed to assign IP to the created VM.
SCVMM 2008 R2 PowerShell is used in the sample code in Listing 1.
Listing 1. VM creation via PowerShell
var cmdlet1 = "Get-VMMserver localhost" var cmdlet21 = "New-VM -Template '" + templateName + "' -Name '" + vmName + "' -VMHost '" + hypervServer + "'" var cmdlet22 = "-Path '"+vmPath+"' -JobGroup '"+guid+"' -RunAsynchronously -TimeZone 4 -AnswerFile $null -RunAsSystem -StartAction NeverAutoTurnOnVM -StopAction SaveVM" var createVMCmd = "\"" + cmdlet1 + ";" + cmdlet21 + ";" + cmdlet22 + "\"" var executeVMCmd = Jython["PowerShell.exe -PSConsoleFile " + vmmPSPath + " -Command " + createVMCmd] Device.ExecuteCommand(DeviceID,executeVMCmd , "", "default","600", "error", returnCode, errorString, returnResult) |
As you can see, the New-VM cmdlet is called and one template is
used as input to create a virtual machine. Note that the template should already have been in the SCVMM library.
In this sample code in Listing 2, the WMI object Win32_NetworkAdapterConfiguration is called to set the static IP of the newly created virtual machine.
Listing 2. IP assigned to newly created VM
var VMMNetworkIndex = "$VMMIndex = (Get-WMIObject -computername '" + vmName + "' -class
Win32_NetworkAdapterConfiguration | where {$_.DHCPEnabled -eq 'true'}).Index"
var VMNetworkConfig = "$networkConfig = (Get-WMIObject -computername '" + vmName + "'
-class Win32_NetworkAdapterConfiguration | where {$_.Index -eq $VMMIndex})"
var setIP = "$networkConfig.EnableStatic('" + vmIPAddress + "','" + vmSubnetMask + "')"
var cmd = "\"" + VMMNetworkIndex + ";" + VMNetworkConfig + ";" + setIP + "\""
var executeCmd1 = Jython["PowerShell.exe -PSConsoleFile " + vmmPSPath + " -Command "
+ cmd]
Device.ExecuteCommand(hostPlatformID, executeCmd1 , "", "default", "600",
"ignore", returnCode, errorString, returnResult)
|
Implementing the VBScript approach
Another platform, Windows Server with Hyper-V enabled, is applied in this architecture. Hyper-V plays a server virtualization role that is used to enable Windows server virtualization capability. After enabling the Hyper-V role in the server, you can use the server as the host platform in Tivoli Provisioning Manager for provisioning.
VBScript is defined in the Tivoli Provisioning Manager workflow and can be copied to and executed on the host. WMI operations for Hyper-V are called in VBScript and will invoke virtual machine provisioning on the Windows Server.
Figure 6 describes the architecture:
Figure 6. Hyper-V provisioning architecture via VBScript
Configuring Tivoli Provisioning Manager
Since the Windows Server is identified in Tivoli Provisioning Manager, you only need to add the server in Tivoli Provisioning Manager. First, add the server to Tivoli Provisioning Manager computer through Computer and Inventory Discovery as shown in Figure 7.
Figure 7. Windows server discovery in Tivoli Provisioning Manager
Then define the newly added computer as a host platform in Tivoli Provisioning Manager. With these two steps finished, Tivoli Provisioning Manager can start provisioning on the basis of this host platform.
To use VBScript in the Tivoli Provisioning Manager workflow, a scriptlet whose language is vbscript is employed. In this scriptlet, VBScript can call the WMI API to complete provisioning operations like virtual machine creation and so on. The sample workflow provided in Listing 3 is for creating a VM.
Listing 3. VM creation via VBScript
scriptlet(vmName, hostName) language = vbscript target=DeviceID timeout=3600
<<EOF4VMCreate
Dim WMIService
Dim VSManagementService
Dim VSGlobalSettingData
Dim InParam
Set WMIService = GetObject("winmgmts:\\" & hostName & "\root\virtualization")
Set VSManagementService = WMIService.ExecQuery("SELECT * FROM
Msvm_VirtualSystemManagementService").ItemIndex(0)
Set VSGlobalSettingData = WMIService.Get("Msvm_VirtualSystemGlobalSettingData")
.SpawnInstance_()
VSGlobalSettingData.ElementName = vmName
Set InParam = VSManagementService.Methods_("DefineVirtualSystem")
.InParameters.SpawnInstance_()
InParam.SystemSettingData = VSGlobalSettingData.GetText_(1)
VSManagementService.ExecMethod_("DefineVirtualSystem", InParam)
EOF4VMCreate
|
In this sample code, WMI object Msvm_VirtualSystemManagementService is used to define a virtual system. This workflow creates a virtual machine with specified host name.
The scriptlet in the vbscript language running in the Windows OS should have Cygwin installed beforehand, but you have an alternative way to avoid Cygwin: Save the script in a .VBS file and use the Device.ExecuteCommand to execute the vbscript file.
In this article, we introduced two approaches and architectures to show how to implement Hyper-V provisioning through Tivoli Provisioning Manager in a cloud environment. We demonstrated how to reconfigure Tivoli Provisioning Manager since Tivoli Provisioning Manager doesn't support Hyper-V provisioning by default.
The first approach we described applies a Hyper-V server + SCVMM + PowerShell architecture:
- The Hyper-V server is a lightweight and pure host platform providing a virtualization solution.
- SCVMM plays the role of management server which interacts with Tivoli Provisioning Manager directly.
- SCVMM also enriches the PowerShell and provides an enhanced PowerShell interface which facilitates the Tivoli Provisioning Manager call.
The second approach we introduced employs a Windows server with Hyper-V role + VBScript architecture:
- The Windows Server with Hyper-V role integrates the Hyper-V host and management server, providing a consolidated view for provisioning.
In real-world situations, developers or designers should balance the approaches and make decisions on which approach to use depending on requirements and available resources.
This article represents views of the authors, not necessarily IBM.
Tivoli Provisioning Manager features
The following is a list of features you can expect from Tivoli Provisioning Manager and the advantages each delivers to data center management:
- Advanced image management functions. Provides faster deployment of applications with image library and image mobility support; speeds application deployment.
- Enhanced scalability, including the ability to create thousands of virtual machines simultaneously. Delivers support for large virtualized environments by scaling automation for enterprise needs; provides optimized resource utilization.
- Enhanced compliance reporting. Improved security and compliance reporting with out-of-the-box reporting; helps manage risks and audits.
- Ability to move running AIX LPARs. Improved utilization of server resources by dynamically moving workloads helps to balance workloads for resource optimization.
- Improved patch management support for Windows and Solaris operating systems. Easier and faster updated support through patching by Microsoft Security Bulletin number instead of individual patching.
- Pre-built best practice automation packages. Delivers solutions for many common tasks.
- Development toolkit for building flexible, customized automation packages. Helps you quickly tailor automates solutions to your environment and IT or business processes.
- Integrates with an organization's existing IT infrastructure.
Learn
-
For more on Tivoli Provisioning Manager:
- Learn to use VBScript scriptlets in Tivoli Provisioning Manager.
- Find a host of hot topic documents for Tivoli Provisioning Manager.
- developerWorks Tivoli is a great place for information on Tivoli Provisioning Manager, including the recent article "Create a virtual data center with Tivoli Provisioning Manager."
-
For more on Hyper-V:
- Hyper-V Server 2008 R2
- Virtualization with Hyper-V
- SCVMM Virtual Machine Manager
- Overview of the Hyper-V architecture
- Introduction to Hyper-V and WMI
- How to automate Hyper-V with VBScript or PowerShell
- The PowerShell Management Library for Hyper-V
-
Here's how to access WMI from a Java environment.
-
Visit IBM's Tivoli Provisioning Manager site for more data on Tivoli Provisioning Manager
-
In the developerWorks cloud developer resources, discover and share knowledge and experience of application and services developers building their projects for cloud deployment.
Discuss
-
There is a Tivoli Provisioning Manager community forum on developerWorks, as well as a Tivoli Provisioning Manager software provisioning group.
-
Join a cloud computing group on My developerWorks.
-
Read all the great cloud blogs on My developerWorks.
-
Join the My developerWorks community, a professional network and unified set of community tools for connecting, sharing, and collaborating.
Mu Dan Cao is a software engineer mainly focused on cloud service research and development. Currently she works in a provisioning platform and portal project in charge of Tivoli Provisioning Manager workflow provisioning on various virtual platforms. Her interests are virtualization technologies, cloud provisioning, and data analysis.
Song Nie is a technical lead for the cloud platform. He worked in several cloud projects, including Common Service Delivery Platform, Smart Business Desktop Cloud, Open Application Development Environment, and Provisioning Platform and Portal. He is familiar with cloud architecture and technical details, including workflow development, monitoring, virtualization, BSS, OSS, and others.
Li Long Chen is working as an IT architect for IBM Managed Business Process Services solution assets. He is currently serving as the dev/L3 lead for the Self Enablement Portal project. He has been in the design and development for large-scale enterprise solutions for years, and is experienced with service integration and web technologies.
Yang Liu is an IT Architect in IBM China Development Lab. He has been engaged into more than 20 local and worldwide customers projects which cover areas such as enterprise portal, business process platform, content management, etc. Now he is a technical leader in the Software-as-a-Service Center. He is interested in enterprise development, SOA, architectural design, and other cloud-related technologies.




