Sample Resource Manager Namespace

The following IIS scenario illustrates how to use the Resource Manager module of Microsoft® Provisioning Framework to create, assign, allocate, and manage resources for a hypothetical Web hosting company.

Overview

The company has multiple IIS Web servers, each with multiple disks and corresponding IP addresses. The company offers two subscription plans:

The resource types are Server, Disk, and IPAddress. The consumer type is WebSite. The resource groups are PremiumIPAddresses and OrdinaryIPAddresses.

When an instance of resource type IPAddress is added to the Resource Manager database, it is mapped to one of the resource groups using the mapping IPType. Ordinary IP addresses map to the group OrdinaryIPAddresses; premium IP addresses map to the group PremiumIPAddresses.

The IIS namespace is implemented in the Program Files\Microsoft Provisioning\Resource Manager\Samples\IISExampleNS.xml file of the installed MPF. This namespace contains custom procedures that perform XSL transformations and concatenate calls to the Resource Manager providers BlockModelRMO and CoreRMO. The following procedures appear on this page in the order in which you would typically run them.

To run most of the procedures, you must supply your own sample data in the format described in the procedure's input XML. For procedures that return data, the output XML schema is also listed.

Initialize

The Initialize procedure registers type and group data in the Resource Manager database.

Initialize does not have input parameters; all required data is already hardcoded into the procedure's <procedureData/> node. 

The lower-level procedure calls are:

Procedure Namespace Description
Add Resource Type CoreRMO Adds resource types "Server", "Disk", and "IPAddress".
Add Resource Type Data BlockModelRMO Adds block-model allocation data for the resource types.
Add Resource Group CoreRMO Adds resource groups "PremiumIPAddresses" and "OrdinaryIPAddresses".
Add Consumer Type CoreRMO Adds consumer type "WebSite".

Add Server

The Add Server procedure registers the IIS Web servers in the Resource Manager database.

Add Server has the following XML input schema:

<serverData>1..1
  <serverName>1..1</serverName>
  <serverDescription>1..1</serverDescription>
  <diskData>0..unbounded
	<diskName>1..1</diskName>
	<diskDescription>0..1</diskDescription>   
	<maxCapacity>1..1</maxCapacity>
	<warningPercentage>1..1</warningPercentage>
	<fillPercentage>1..1</fillPercentage>
  </diskData>
  <IPData>0..unbounded
	<IPName>1..1</IPName>
	<IPDescription>0..1</IPDescription>
	<isPremiumIP>0..1</isPremiumIP>
  </IPData>
</serverData>

The lower-level procedure calls are:

Procedure Namespace Description
Add Resource Instance CoreRMO Creates a resource instance for the server.
Add Disk To Server IISExampleNS Registers individual disks to a specific server.
Add IP Address to Server IISExampleNS Registers the IP address for the disk to a specific server.
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Add Disk To Server

The Add Server procedure calls the Add Disk To Server procedure. This procedure adds disks to a server, assigns the disks and server to candidate sets, creates a mapping relationship between the disks and the server, and adds resource capacity data for the disks.

Add Disk To Server has the following XML input schema:

<serverName>1..1</serverName>
<diskData>1..1
  <diskName>1..1</diskName>
  <diskDescription>0..1</diskDescription>   
  <maxCapacity>1..1</maxCapacity>
  <warningPercentage>1..1</warningPercentage>
  <fillPercentage>1..1</fillPercentage>  
</diskData> 

The lower-level procedure calls are:

Procedure Namespace Description
Add Resource Instance CoreRMO Creates a new resource instance for the disk. It sets the instance type to "Disk" and adds the disk to candidate set "diskSet".
Add Resource To Candidates CoreRMO Adds the server to candidate set "serverSet".
Construct Mapping CoreRMO Maps the server and the disk with the relationship "owns".
Add Resource Capacity Data BlockModelRMO Defines the disk's actual maximum capacity, the warning percentage for raising operator notifications, and the maximum fill percentage that can be allocated. The unit for the disk resource type was defined earlier as megabyte (MB) in the Add Resource Type Data procedure called by Initialize.
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Add IP Address To Server

The Add Server procedure calls the Add IP Address to Server procedure to assign disk IP addresses to a server.

Add Server has the following XML input schema. Set <isPremiumIP/> to "0" for an ordinary address or "1" for a premium address.

<serverName>1..1</serverName>
<IPData>1..1
  <IPName>1..1</IPName>
  <IPDescription>0..1</IPDescription>   
  <isPremiumIP>1..1</isPremiumIP>
</IPData>

The lower-level procedure calls are:

Procedure Namespace Description
Add Resource Instance CoreRMO Adds a resource instance for the IP address and adds the IP address to candidate set "IPSet".
Add Resource To Candidates CoreRMO Add the server to candidate set "serverSet".
Construct Mapping CoreRMO Maps the server and the IP address with the relationship "ownsIP".
Add Resource Capacity Data BlockModelRMO Adds capacity data for the IP address. 

If <isPremiumIP/> is 1, <actualMax/> becomes 1; for a premium plan, only one premium Web site can be associated with this IP address. If <isPremiumIP/> is 0, <actualMax/> becomes 1000; for an ordinary plan, up to 1,000 Web sites can map to the IP address.

Add Resource Group To Candidates CoreRMO Determines the appropriate resource group and assigns it to the candidate set "groupSet". If <isPremiumIP/> is 1, the resource group is "PremiumIPAddresses"; otherwise, it is "OrdinaryIPAddresses".
Construct Mapping CoreRMO Maps the two candidate sets IPSet and groupSet as relationship "IPType".
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Allocate Website

The Allocate Website procedure is called when a user signs up for a service plan.

Allocate Website requires data in the following format. For a premium site, set <isPremiumSite/> to "1". 

<webSiteData>1..1
  <siteName>1..1</siteName>
  <siteDescription>0..1</siteDescription>   
  <requiredSpace>1..1</requiredSpace>   
  <isPremiumSite>1..1</isPremiumSite>
</webSiteData>

The lower-level procedure calls are:

Procedure Namespace Description
Add Website IISExampleNS Adds the Web site as a consumer instance of type WebSite by calling Add Consumer Instance (CoreRMO).
Add Consumer To Candidates CoreRMO Adds the Web site to candidate set "conSet".
Find Resources CoreRMO Finds all disks and add them to candidate set "resSet".
Rank By Capacity BlockModelRMO Ranks the disks based on the amount of free space. The <rankUsing/> parameter for this procedure is hardcoded to "actualFree" so that the disks with largest amount of free space are ranked highest.
Allocate BlockModelRMO Allocates the Web site to one of the disks in the ranked candidate set "resSet".
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.
Query Website For Servers IISExampleNS Finds the server that owns the disk to which the Web site is allocated.
Find Resources CoreRMO Selects only those IP addresses that belong to the server and adds them to candidate set "IPSet".
Add Resource Group To Candidates CoreRMO Assigns each IP address to the OrdinaryIPAddresses or PremiumIPAddresses group (as determined by the value for <isPremiumSite/> and adds it to candidate set "groupSet".
Keep Candidates By Mapping CoreRMO Selects IP addresses in candidate set "IPSet" that are mapped to the resource group in candidate set "groupSet".
Rank By Capacity BlockModelRMO Ranks IP addresses in order of highest actual free capacity (<RankUsing/> = "actualFree") and assigns them to candidate set "IPSet".
Add Consumer To Candidates CoreRMO Adds the Web site to candidate set "siteSet".
Allocate BlockModelRMO Allocates the Web site to the IP address.
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Add Website

Add Website is an internal procedure called by the Allocate Website procedure.

Add Website has the following XML input schema:

<webSiteData>1..1
  <siteName>1..1</siteName>
  <siteDescription>0..1</siteDescription>   
</webSiteData>

The only procedure call is to Add Consumer Instance.

Procedure Namespace Description
Add Consumer Instance CoreRMO Adds a consumer instance of type WebSite.

DeAllocate Website

The DeAllocate Website procedure is called to remove the disk space and IP address allocations when a user stops hosting a Web site. 

DeAllocate Website has the following XML input schema:

<webSiteData>1..1
  <siteName>1..1</siteName>
</webSiteData>

The lower-level procedure calls are:

Procedure Namespace Description
Add Consumer To Candidates CoreRMO Adds the Web site to candidate set "siteSet".
Find Resources CoreRMO Finds all disks and adds them to candidate set "diskSet".
Delete Allocation BlockModelRMO Deletes the Web site's disk space allocation.
Find Resources CoreRMO Adds all IP addresses to candidate set "IPSet".
Delete Allocation BlockModelRMO Deletes the Web site's IP address allocation.
Delete Consumer Instance CoreRMO Deletes the Web site's consumer instance.
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Delete Server

The Delete Server procedure is called when an IIS server is being removed from service at the hosting company.

Delete Server has the following XML input schema:

<serverData>1..1
  <serverName>1..1</serverName>
</serverData>

The lower-level procedure calls are:

Procedure Namespace Description
Add Resource To Candidates CoreRMO Adds the server to candidate set "serverSet".
Find Resources CoreRMO Finds all disks and adds them to candidate set "diskSet".
Keep Candidates By Mapping CoreRMO Selects disks owned by the server.
Delete Mapping CoreRMO Deletes all mappings between the server and its disks.
Delete Resource Instance CoreRMO Deletes all disk resource instances in the candidate set "diskSet".
Find Resources CoreRMO Finds all IP addresses and adds them to candidate set "IPSet".
Keep Candidates By Mapping CoreRMO Keeps IP addresses owned by the server (<relationship/> = "ownsIP").
Delete Mapping CoreRMO Deletes the mapping between the server and all its IP addresses.
Add Resource Group To Candidates CoreRMO Adds the resource group "PremiumIPAddresses" to candidate set "groupSet".
Add Resource Group To Candidates CoreRMO Adds the resource group "OrdinaryIPAddresses" to candidate set "groupSet".
Delete Mapping CoreRMO Deletes all mappings between the IP addresses and the two resource groups.
Delete Resource Instance CoreRMO Deletes the IP addresses.
Delete Resource Instance CoreRMO Deletes the server.
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Query Server For Disks

The Query Server For Disks procedure returns the names of disks that belong to a server.

Query Server For Disks has the following XML input schema:

<serverData>1..1
  <serverName>1..1</serverName>
</serverData>

The procedure's output schema is:

<Disks>1..1
  <diskName>0..unbounded</diskName>
</Disks>

The lower-level procedure calls are:

Procedure Namespace Description
Find Resources CoreRMO Finds all disks that belong to the server and adds them to candidate set "diskSet".
List Candidates CoreRMO Returns the list of disks in "diskSet".
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Query Server For IP Addresses

The Query Server for IP Addresses procedure returns the list of IP addresses that belong to a server.

Query Server for IP Addresses has the following XML input schema:

<serverData>1..1
  <serverName>1..1</serverName>
</serverData>

The procedure's output schema is:

<IPAddresses>1..1
  <IPName>0..unbounded</IPName>
</IPAddresses>

The lower-level procedure calls are:

Procedure Namespace Description
Find Resources CoreRMO Finds all IP addresses for the server and adds them to candidate set "IPSet".
List Candidates CoreRMO Returns the list of IP addresses in "IPSet".
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Query Server For Websites

The Query Server For Websites procedure returns the list of all Web sites allocated to a server.

Query Server For Websites has the following XML input schema:

<serverData>1..1
  <serverName>1..1</serverName>
</serverData>

The procedure's output schema is:

<WebSites>1..1
  <siteName>0..unbounded</siteName>
</WebSites>

The lower-level procedure calls are:

Procedure Namespace Description
Find Resources CoreRMO Finds all disks for the server and adds them to candidate set "diskSet".
Find Consumers CoreRMO Adds all Web sites to candidate set "siteSet".
Keep Candidates By Mapping CoreRMO Keeps all Web sites from "siteSet" that are allocated to disks in "diskSet".
List Candidates CoreRMO Returns the list of Web sites in "siteSet".
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Query Website For Servers

The Query Website For Servers procedure returns the server to which a Web site is allocated.

Query Website For Servers has the following XML input schema:

<webSiteData>1..1
  <siteName>1..1</siteName>
</webSiteData>

The procedure's output schema is:

<Servers>1..1
 <serverName>1..1</serverName>
</Servers>

The lower-level procedure calls are:

Procedure Namespace Description
Add Consumer To Candidates CoreRMO Adds the Web site to candidate set "siteSet".
Find Resources CoreRMO Finds all disks and adds them to candidate set "diskSet".
Keep Candidates By Mapping CoreRMO Keeps the disk that hosts the Web site.
Find Resources CoreRMO Adds all servers to candidate set "serverSet".
Keep Candidates By Mapping CoreRMO Keeps the server that owns the disk (<relationship/> = "owns").
List Candidates CoreRMO Returns the name of the server.
Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Remove Disk From Server

The Remove Disk From Server procedure is called when a disk is removed from a server.

Remove Disk From Server has the following XML input schema:

<serverName>1..1</serverName>
<diskData>1..1
  <diskName>1..1</diskName>
</diskData>

The lower-level procedure calls are:

Procedure Namespace Description
Add Resource To Candidates CoreRMO Adds the disk to candidate set "diskSet".
Add Resource To Candidates CoreRMO Adds the server to candidate set "serverSet".
Delete Mapping CoreRMO Deletes the "owns" mapping between "serverSet" and "diskSet".
Delete Resource Instance CoreRMO Deletes the disk resource instance. 

Note  If any Web sites are still allocated to the disk, this procedure will fail. It is the user's responsibility to de-allocate all Web sites from the disk before attempting to remove the disk resource instance.

Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

Remove IP Address From Server

The Remove IP Address From Server procedure is called whenever an IP address is no longer associated with a server.

Remove IP Address From Server has the following XML input schema:

<serverName>1..1</serverName>
<IPData>1..1
  <IPName>1..1</IPName>
</IPData>

The lower-level procedure calls are:

Procedure Namespace Description
Add Resource To Candidates CoreRMO Adds the IP address to candidate set "IPSet".
Add Resource To Candidates CoreRMO Adds the server to candidate set "serverSet".
Delete Mapping CoreRMO Deletes the "ownsIP" mapping between "serverSet" and "IPSet".
Add Resource Group To Candidates CoreRMO Adds the resource group "OrdinaryIPAddresses" to candidate set "groupSet".
Add Resource Group To Candidates CoreRMO Adds the resource group "PremiumIPAddresses" to candidate set "groupSet".
Delete Mapping CoreRMO Deletes the "IPType" mapping between the "IPSet" and "groupSet" candidate sets.
Delete Resource Instance CoreRMO Deletes the IP address resource instance.

Note  If any Web sites are still allocated to the IP address, this procedure will fail. It is the user's responsibility to de-allocate all Web sites from the IP address before attempting to remove the IP address resource instance.

Flush Candidates CoreRMO Clears candidates from the candidate set so that subsequent procedure calls do not operate on leftover data.

See Also

Resource Manager Procedure Matrix


Up Top of Page

© 1999-2002 Microsoft Corporation. All rights reserved.