Click to Rate and Give Feedback
MSDN
MSDN Library
System Services
Enterprise Services
Windows Clustering
MSCluster_Resource
MSCluster_Resource Class

The MSCluster_Resource class is a dynamic WMI class that represents a cluster resource.

The following syntax is simplified from Managed Object Format (MOF) code and includes all inherited properties.


[Dynamic, Provider ("MS_CLUSTER_PROVIDER"), UUID ("{C2862F9C-34DE-4b16-9EE3-099D078E9F59}")]
class MSCluster_Resource : MSCluster_LogicalElement
{
  string Caption;
  datetime InstallDate;
  string Status;
  uint32 Flags;
  uint32 Characteristics;
  string Name;
  string Description;
  string DebugPrefix;
  uint32 IsAlivePollInterval;
  uint32 LooksAlivePollInterval;
  uint32 PendingTimeout;
  uint32 MonitorProcessId;
  boolean PersistentState;
  uint32 RestartAction;
  uint32 RestartPeriod;
  uint32 RestartThreshold;
  uint32 RetryPeriodOnFailure;
  boolean SeparateMonitor;
  string Type;
  uint32 State;
  string InternalState;
  uint32 ResourceClass;
  uint32 Subclass;
  MSCluster_Property PrivateProperties;
  string CryptoCheckpoints[];
  string RegistryCheckpoints[];
  boolean QuorumCapable;
  boolean LocalQuorumCapable;
  boolean DeleteRequiresAllNodes;
  boolean CoreResource;
  uint32 DeadlockTimeout;
  string ResourceSpecificStatus;
  uint32 RestartDelay;
};

Methods

The MSCluster_Resource class defines the following methods.

MethodDescription

CreateResource

Creates a resource.

DeleteResource

Deletes a resource.

Windows Server 2003:  

This method has a Static qualifier.

MoveToNewGroup

Moves the resource to a different group.

AddDependency

Creates a dependency relationship between two resources.

RemoveDependency

Removes a dependency relationship between two resources.

SetDependencies

Sets the resource dependency expression.

Windows Server 2003:  

This property is not supported.

GetDependencies

Gets the resource dependency expression.

Windows Server 2003:  

This property is not supported.

BringOnline

Brings a resource online.

TakeOffline

Takes the resource offline.

Rename

Renames the resource.

FailResource

Forces this resource to become unavailable to simulate failure. This method is used by applications to test their failover configurations.

AddRegistryCheckpoint

Adds a registry checkpoint to the resource.

RemoveRegistryCheckpoint

Removes a registry key from the list of keys being checkpointed for the resource.

AddCryptoCheckpoint

Adds an encrypted crypto checkpoint to the resource.

RemoveCryptoCheckpoint

Removes a crypto key from the list of keys being checkpointed for the resource.

RenewAddress

Renews the IPv4 address DHCP lease. Valid only for IP address resources.

Windows Server 2003:  

This method is not supported.

ReleaseAddress

Releases the IPv4 address DHCP lease. Valid only for IP address resources.

Windows Server 2003:  

This method is not supported.

AddPossibleOwner

Adds a possible owner (host) node to the list of possible owners for this resource.

Windows Server 2003:  

This method is not supported.

RemovePossibleOwner

Removes a possible owner node (host) from the list of possible owners for this resource.

Windows Server 2003:  

This method is not supported.

ExecuteResourceControl

Executes a control code on the resource.

Windows Server 2003:  

This method is not supported.

Properties

The MSCluster_Resource class defines the following properties.

Caption
Data type: string
Access type: Read-only

Provides a short textual description of the resource.

Inherited from MSCluster_LogicalElement.

Characteristics
Data type: uint32
Access type: Read/write

Describes the characteristics of the resource. For a list of possible values, see CLUSCTL_RESOURCE_GET_CHARACTERISTICS.

Inherited from MSCluster_LogicalElement.

CoreResource
Data type: boolean
Access type: Read/write

If True, indicates that the resource is essential to the cluster and cannot be deleted.

CryptoCheckpoints
Data type: string array
Access type: Read-only

Provides a list of crypto checkpoints for the resource.

DeadlockTimeout
Data type: uint32
Access type: Read/write

Indicates the length of time to wait, in milliseconds, before declaring a deadlock in any call into a resource.

Windows Server 2003:  

This property is not supported.

DebugPrefix
Data type: string
Access type: Read/write

This property is not supported.

Windows Server 2003:  

Provides access to the resource's DebugPrefix property.

DeleteRequiresAllNodes
Data type: boolean
Access type: Read/write

If True, the resource cannot be deleted unless all nodes are active. Setting this property to True adds the CLUS_CHAR_DELETE_REQUIRES_ALL_NODES characteristic to the resource.

Description
Data type: string
Access type: Read/write

Provides access to the resource's Description property.

Inherited from MSCluster_LogicalElement.

Flags
Data type: uint32
Access type: Read/write

Describes the flags set for the resource. For a list of possible values, see CLUSCTL_RESOURCE_GET_FLAGS..

Inherited from MSCluster_LogicalElement.

InstallDate
Data type: datetime
Access type: Read-only

Indicates when the resource was installed. A lack of a value does not indicate that the resource is not installed.

Inherited from MSCluster_LogicalElement.

InternalState
Data type: string
Access type: Read-only

The current internal state of the resource.

Windows Server 2003:  

This property is not supported.

IsAlivePollInterval
Data type: uint32
Access type: Read/write
Qualifiers: Units("Milliseconds")

Provides access to the resource's IsAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it is operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the IsAlivePollInterval property for the resource type associated with the resource.

LocalQuorumCapable
Data type: boolean
Access type: Read/write

The resource can be selected as the quorum resource in clusters configured using the -localquorum switch.

LooksAlivePollInterval
Data type: uint32
Access type: Read/write
Qualifiers: Units("Milliseconds")

Provides access to the resource's LooksAlivePollInterval property, which is the recommended interval in milliseconds at which the Cluster Service should poll the resource to determine whether it appears operational. If the property is set to 0xFFFFFFFF, the Cluster Service uses the LooksAlivePollInterval property for the resource type associated with the resource.

MonitorProcessId
Data type: uint32
Access type: Read/write

Provides the process ID of the resource host service that is currently hosting the resource.

Windows Server 2003:  

This property is not supported.

Name
Data type: string
Access type: Read-only
Qualifiers: Key

Provides the name of the resource.

Inherited from MSCluster_LogicalElement.

PendingTimeout
Data type: uint32
Access type: Read/write

Provides access to the resource's PendingTimeout property. If a resource cannot be brought online or taken offline in the number of milliseconds specified by the PendingTimeout property, the resource is forcibly terminated.

Windows Server 2003:  

This property is not supported.

PersistentState
Data type: boolean
Access type: Read/write

Provides access to the resource's PersistentState property, which specifies whether the resource should be brought online or left offline when the Cluster Service is started.

PrivateProperties
Data type: MSCluster_Property
Access type: Read/write

Provides access to the private properties of the resource.

QuorumCapable
Data type: boolean
Access type: Read/write

The resource can be selected as the quorum resource for the cluster.

RegistryCheckpoints
Data type: string array
Access type: Read-only

Provides a list of registry checkpoints for the resource.

ResourceClass
Data type: uint32
Access type: Read/write

Gets or sets the resource class of a resource.

ResourceSpecificStatus
Data type: string
Access type: Read-only

Provides a resource-specific status message that complements the current resource state.

Windows Server 2003:  

This property is not supported.

RestartAction
Data type: uint32
Access type: Read/write

Provides access to the resource's RestartAction property, which is the action to be taken by the Cluster Service if the resource fails. The following are the possible values.

ValueMeaning

0

Do not restart the resource after a failure.

1

Restart the resource after a failure. If the resource exceeds its restart threshold within its restart period, do not attempt to failover the group to another node in the cluster.

2

Restart the resource after a failure. If the resource exceeds its restart threshold within its restart period, attempt to fail over the group to another node in the cluster. This is the default setting.

RestartDelay
Data type: uint32
Access type: Read-only

Indicates the time delay before a failed resource is restarted.

Windows Server 2003:  

This property is not supported.

RestartPeriod
Data type: uint32
Access type: Read/write

Provides access to the resource's RestartPeriod property, which is interval of time, in milliseconds, during which a specified number of restart attempts can be made on a nonresponsive resource.

RestartThreshold
Data type: uint32
Access type: Read/write

Provides access to the resource's RestartThreshold property which is the maximum number of restart attempts that can be made on a resource within an interval defined by the RestartPeriod property before the Cluster Service initiates the action specified by the RestartAction property.

RetryPeriodOnFailure
Data type: uint32
Access type: Read/write

Provides access to the resource's RetryPeriodOnFailure property, which is the interval of time (in milliseconds) that a resource should remain in a failed state before the Cluster service attempts to restart it.

SeparateMonitor
Data type: boolean
Access type: Read/write

Provides access to the resource's SeparateMonitor property, which indicates whether the resource requires its own Resource Monitor.

State
Data type: uint32
Access type: Read-only

The current state of the resource. The following are the possible values. For a list of possible state values, see GetClusterResourceState.

ValueMeaning

StateUnknown
-1

The operation was not successful.

Inherited
0

TBD

Initializing
1

The resource is performing initialization.

Online
2

The resource is operational and functioning normally.

Offline
3

The resource is not operational. This value will be returned if the resource reported a state of ClusterResourceOffline (3) or ClusterResourceCannotComeOnlineOnThisNode (127).

Failed
4

The resource has failed. This value will be returned if the resource reported a state of ClusterResourceFailed (4) or ClusterResourceCannotComeOnlineOnAnyNode (126).

Pending
128

The resource is coming online or going offline.

Online Pending
129

The resource is coming online.

Offline Pending
130

The resource is going offline.

Status
Data type: string
Access type: Read-only

Indicates the current status of the resource.

Inherited from MSCluster_LogicalElement.

Subclass
Data type: uint32
Access type: Read/write

Provides the list of references to nodes that can be the owner of this resource.

Type
Data type: string
Access type: Read/write

Provides access to the resource's Type property, which is the name for the resource's type.

Remarks

The MSCluster_Resource class is derived from the MSCluster_LogicalElement class.

Requirements

ServerRequires Windows Server 2008 Enterprise, Windows Server 2008 Datacenter, Windows Server 2003, Enterprise Edition, or Windows Server 2003, Datacenter Edition.
MOF

Declared in ClusWmi.mof.

Namespace

Defined in \\.\Root\MSCluster.


Send comments about this topic to Microsoft

Build date: 9/19/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Get the IP Addresses for the cluster group      jader3rd ... Thomas Lee   |   Edit   |  

  

public const String ADDRESS = @"Address";

private List<IPAddress> GetClusterGroupIPsPrivate()
{
List<IPAddress> result = new List<IPAddress>();

System.Management.ManagementScope scope = new System.Management.ManagementScope(@"root\MSCluster");
scope.Connect();

// Can't do a WMI query for the cluster group because it requires a invoking a method to determine which group is the cluster group
using (ManagementClass resourceGroups = new ManagementClass(scope, new ManagementPath(@"MSCluster_ResourceGroup"), null))
{
resourceGroups.Get();
String name = String.Empty;

// Iterate over every resource group
foreach (ManagementObject group in resourceGroups.GetInstances())
{
// Find the one that's the cluster group
if (1 == Convert.ToInt32(group.InvokeMethod("GetGroupType", new object[0])))
{
String clusterGroupName = group["Name"].ToString();
SelectQuery clusterGroupResourceRelationshipQuery = new SelectQuery("MSCluster_ResourceGroupToResource", String.Format("GroupComponent='MSCluster_ResourceGroup.Name=\"{0}\"'", clusterGroupName));
ManagementObjectSearcher clusterGroupRelationshipResourceSearcher = new ManagementObjectSearcher(scope, clusterGroupResourceRelationshipQuery);
ManagementObjectCollection clusterGroupRelationshipResources = clusterGroupRelationshipResourceSearcher.Get();

// Get the resources for the cluster group
foreach (ManagementObject cluResRel in clusterGroupRelationshipResources)
{
String resourceName = cluResRel["PartComponent"].ToString().Split('=')[1].Trim(' ', '"');
SelectQuery clusterGroupResourceQuery = new SelectQuery("MSCluster_Resource", String.Format("Name='{0}'", resourceName));
ManagementObjectSearcher clusterGroupResourceSearcher = new ManagementObjectSearcher(scope, clusterGroupResourceQuery);
ManagementObjectCollection clusterGroupResources = clusterGroupResourceSearcher.Get();

// Get the IP address resources
foreach (ManagementObject resource in clusterGroupResources)
{
if ("IP Address".Equals(resource["Type"]))
{
using (ManagementBaseObject privProps = (ManagementBaseObject)resource["PrivateProperties"])
{
String addressResource = privProps.Properties[ADDRESS].Value.ToString();
IPAddress address = IPAddress.Parse(addressResource);
if (!IPAddress.Any.Equals(address))
{
result.Add(address);
}
}
}
else if ("IPv6 Address".Equals(resource["Type"]))
{
using (ManagementBaseObject privProps = (ManagementBaseObject)resource["PrivateProperties"])
{
String addressResource = privProps.Properties[ADDRESS].Value.ToString();
IPAddress address = IPAddress.Parse(addressResource);
if (!IPAddress.IPv6Any.Equals(address))
{
result.Add(address);
}
}
}
}
}

break;
}
}
}

return result;
}

Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker