/*
 * LinuxHA.mof : CIM MOF file 
 *
 * Author: Jia Ming Pan <jmltc@cn.ibm.com>
 * Copyright (c) 2005 International Business Machines
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *              
 */


//-------------------------------------------------
// HA_Cluster
//-------------------------------------------------

[ Provider("cmpi:HA_ClusterProvider") ]
class HA_Cluster : CIM_Cluster {
        [ Description("The heartbeat version")]
        string HBVersion;

        //********************************************
        // Configuration directives
        // refer to http://wiki.linux-ha.org/ha_2ecf for details
        //*********************************************

        [ Description(
                "The apiauth directive specifies what users and/or groups"
                "are allowed to connect to a specific API group name")
        ]
        string APIAuth [];
        string NiceFailBack;

        [ Description(
                "Determins whether a resource will automatically fail back to"
                "its primary node, or remain on whatever the node is serving."
                "Possible values are: on, off, legacy.")
        ]                        
        string AutoFailBack;

        [ Description ( "The speed for serial communications" ) ]
        string BaudRate;
        
        [ Description(
                "Which interfaces Heartbeat sends UDP broadcast traffic on")
        ]
        string BroadCastPath;


        [ Description(
                "The time Heartbeat will reconnect to the logging daemon if"
                "the connection between Heartbeat and the logging daemon is "
                "broken")
        ]
        string ConnLogdTime = "60s";

        [ Description ( "Making core dump" ) ]
        string CoreDump;

        [ Description(
                "Whether Heartbeat should run the 1.x-style cluster manager "
                "or the 2.x-style cluster manager that supports more than 2 "
                "nodes" )
        ]
        string WithCrm;

        [ Description(
                "How quickly Heartbeat should decide that a ping node in a "
                "cluster is dead")
        ]
        string DeadPing;

        [ Description(
                "How quickly Heartbeat should decide that a node in a "
                "cluster is dead")
        ]
        string DeadTime;
        
        [ Description ( "The Level of debugging" ) ]
        string DebugLevel;

        [ Description ( "The file Heartbeat will write debug messages to" ) ]
        string DebugFile;

        [ Description ( "Declare fiber channel devices as PingNodes to "
                "Heartbeat" ) 
        ]
        string Aping;

        [ Description(
                "How Heartbeat should compute its current generation number "
                "for communications")
        ]
        string GenMethod = "file";

        [ Description(
                "Controls how many nodes a packet can be forwarded through "
                "before it is thrown away in the worst case")
        ]
        string HOPFudge;

        [ Description(
                "The time that it takes to declare a cluster node dead when "
                "Heartbeat is first started")
        ]
        string InitDead;

        [ Description(
                "The interval between heartbeat packets")
        ]
        string KeepAlive;

        [ Description(
                "Which syslog logging facility it should use for logging "
                "its messages")
        ]
        string LogFacility;

        [ Description(
                "Configures a log file. All non-debug messages from "
                "Heartbeat will go into this file" )
        ]
        string LogFile;

        [ Description("Configure a multicast communication path")]
        string MultiCastPath;

        [ Description ( "The format Heartbeat uses in wire, classic or "
                "netstring" ) ]
        string MsgFmt = "classic";


        [ Description("What machines are in the cluster")]
        string Node [];        

        [ Description("Declare PingNodes to Heartbeat")]
        string PingNode [];

        [ Description("Declare PingNodes to Heartbeat")]
        string PingGroup [];

        [ Description(
                "The realtime directive specifies whether or not Heartbeat "
                "should try and take advantage of the operating system's "
                "realtime scheduling features. ")
                ]
        string RealTime;

        [ Description(
                "specify a program to run and monitor while it runs")
        ]
        string Respawn;

        [ Description ("specifies Heartbeat's realtime priority" ) ]
        string RTPriority;

        [ Description ( "configure serial communication path" ) ]
        string SerialPath;

        [ Description ( "onfigure Heartbeat's (release 1), STONITH "
                "configuration" ) ]
        string Stonith;

        [ Description ( "onfigure Heartbeat's (release 1), STONITH "
                "configuration" ) ]
        string StonithHost;

        [ Description(
                "configures Heartbeat to communicate over a UDP "
                "unicast communications link")
        ]
        string UniCastPath;

        [ Description("specifies port for UDP communication")]
        string UDPPort;

        [ Description(
                "the directive to determine whether heartbeats use logging "
                "daemon or not" )
        ]
        string UseLogd;
        
        [ Description(
                "how quickly Heartbeat should issue a \"late heartbeat\" "
                "warning" )
        ]
        string WarnTime;

        [ Description("configure watchdog device")]
        string WatchdogTimer;

        string NormalPoll;
        string CoreRootDir;
        string LogBadPack;

        /* Authentication config */
        [ Description("Authentication method"),
                ValueMap { "0", "1", "2" }, 
                Values { "sha1", "md5", "crc" } ]
        uint32 AuthMethod;
        string AuthKey; 

        /* CRM config */
        string TransitionIdleTimeout;
        string SymmetricCluster;
        string StonithEnabled;
        string NoQuorumPolicy;
        string DefaultResourceStickiness;

        string HaveQuorum;

        /* methods */
	/* RequestStateChange */
};

//----------------------------------------
// HA_SoftwareIdentity
//----------------------------------------

[ Provider("cmpi:HA_SoftwareIdentityProvider") ]
class HA_SoftwareIdentity : CIM_SoftwareIdentity {
        [ Override ("InstanceID") ]
        string InstanceID;

        [ Override ("MajorVersion") ]
        uint16 MajorVersion;

        [ Override ("MinorVersion") ]
        uint16 MinorVersion;

        [ Override ("RevisionNumber") ]
        uint16 RevisionNumber;

        [ Override ("BuildNumber") ]
        uint16 BuildNumber;

        [ Override ("VersionString") ]
        string VersionString;
};


//--------------------------------------------------
//  Association: HA_InstallSoftwareIdentity
//--------------------------------------------------

[ Association,
        Provider ( "cmpi:HA_InstalledSoftwareIdentityProvider" ) ] 
class HA_InstalledSoftwareIdentity : CIM_InstalledSoftwareIdentity {
        [ Key, Override ( "System" ) ]
        HA_Cluster REF System;

        [ Key, Override ( "InstalledSoftware" ) ]
        HA_SoftwareIdentity REF InstalledSoftware;

};

/*===========================================================================*/

//----------------------------------------
//  ClusterNode
//----------------------------------------

[ Provider ( "cmpi:HA_ClusterNodeProvider" ) ]
class HA_ClusterNode : CIM_ComputerSystem {
        [ Override ( "Name" ), Description ("Node's uname") ]
        string Name;

        string OnLine;
	string Unclean;

        string Status;
        string IsDC;

	string Standby;
	string Unclean;
	string Shutdown;
	string ExpectedUp;
	string NodePing;
};


//-------------------------------------------------------------------
// HA_ClusterAbstractResource, Primitive Resource or ReousrceGroup
//-------------------------------------------------------------------
/* this class inherit from CIM_Service originally */
[ Description ( "Cluster resource class") 
	/* ,Provider("cmpi:HA_ResourceProvider") */
]
class HA_ClusterResource {
        [ Key, Description("Group id, resource name, etc.") ]       
        string Id;

        [ Key, Description("ClassName that created the instance.") ]
        string CreationClassName;

        [ Key, Description("Always LinuxHACluster.") ]
        string SystemName = "LinuxHACluster";

        [ Key, Description("Always HA_Cluster") ]
        string SystemCreationClassName = "HA_Cluster"; 

        [ Description ("Status of the resource") ]
	string ResourceStatus;  /* running or not running */
        /* DTD1.0/Annotated */
        
	string Description;
        string IsManaged = "true";              /* true|false */
        string OnStopFail;                      /* ignore|stonith|block */
        string RestartType = "ignore";          /* ignore|restart */
        string MultipleActive = "stop_start";   /* stop_start|stop_only|block */
        string ResourceStickiness = "0";        /* 0|INFINITY|-INFINITY */
        string StartPreRep;                     /* nothing|quorum|fencing */

	string Caption;

	string Enabled = "false";

	/*
	uint32 AddOperation(
		[IN, Description("Resource to be added") ]
		HA_Operation REF Operation);
	*/
};

//----------------------------------------
//  HA_PrimitiveResource
//----------------------------------------

[ Description ( "LinuxHA cluster resource class" ),
        Provider("cmpi:HA_PrimitiveResourceProvider") 
]
class HA_PrimitiveResource : HA_ClusterResource {
        string ResourceClass = "ocf";
        string Type;
        string Provider = "heartbeat";
        string HostingNode;
	/*
	string InstanceAttributes [];
	*/
};

//------------------------------------------------
// HA_ResourceGroup
//------------------------------------------------

[ Provider("cmpi:HA_ResourceGroupProvider") ]
class HA_ResourceGroup : HA_ClusterResource {
	uint32 AddPrimitiveResource(
		[IN, Description("Resource to be added") ]
		HA_PrimitiveResource REF Resource);
};

//----------------------------------------
//  HA_ResrouceClone
//----------------------------------------
[ Provider("cmpi:HA_ResourceCloneProvider") ] 
class HA_ResourceClone : HA_ClusterResource {
        string Notify;
        string Ordered;
        string Interleave;
	string CloneMax;
	string CloneNodeMax;
	uint32 AddResource(
		[IN, Description("Resource to be added") ]
		HA_Resource REF Resource);
};

//------------------------------------------------
// HA_ResourceMasterSlave
//------------------------------------------------
[ Provider("cmpi:HA_MasterSlaveResourceProvider") ] 
class HA_MasterSlaveResource : HA_ClusterResource {
	string CloneMax;
	string CloneNodeMax;
      	string MaxMasters;
      	string MaxNodeMasters;
	uint32 AddResource(
		[IN, Description("Resource to be added") ]
		HA_Resource REF Resource);
};

//----------------------------------------
//  HA_InstanceAttributes
//----------------------------------------
[ Provider("cmpi:HA_InstanceAttributesProvider") ]
class HA_InstanceAttributes {
	[ Key ]
	string Id;

	[ Key ]
	string ResourceId;
	string Name;
	string Value;
	string Caption;
};
//----------------------------------------
// Association, HA_AttributesOfResource
//----------------------------------------
[ Association, Aggregation, Provider ("cmpi:HA_AttributesOfResourceProvider") ]
class HA_AttributesOfResource {
        [ Key, Aggregate, Description("Resource") ]
        HA_PrimitiveResource REF Resource;

        [ Key, Description("InstanceAttributes") ]
        HA_InstanceAttributes REF InstanceAttributes;
};
//----------------------------------------
//  HA_Operation
//----------------------------------------
[ Provider("cmpi:HA_OperationProvider") ]
class HA_Operation {
        [ Key, Description ("This operation's Id.") ]
        String Id;
       	
	[ Key, Description ("The resource that this operation belongs to") ]
	String ResourceId;
 
        [ Description ("The name of the operation") ]
        string Name = "start|stop|monitor";    /* start|stop|monitor */

        string Description;

        [ Description ("Operation interval, only applies to monitor") ]
        string Interval = "10s";

        [ Description ("The maximum period of time before considering "
                       "the action failed") ]
        string Timeout;

        [ Description ("What conditions need to be met before this action "
                       "can be run") ]
        string PreReq;  /* nothing|quorum|fencing */
        
        [ Description ("The action to take if this action fails") ]
        string OnFail;  /* nothing|block|stop|fence */

	string Enabled = "true";
        string Caption;
};

//----------------------------------------
// Association, HA_OperationOnResource
//----------------------------------------
[ Association, Aggregation, Provider ("cmpi:HA_OperationOnProvider") ]
class HA_OperationOnResource {
        [ Key, Description("Resource") ]
        HA_PrimitiveResource REF Resource;

        [ Key, Description("Operation") ]
        HA_Operation REF Operation;
};

//------------------------------------------------
// HA_ResourceConstraint, Abstract
//------------------------------------------------
class HA_ResourceConstraint {
        [ Key, Description (" Id ") ]
        string Id;
        
        [ Key ]
        string CreationClassName;

        [ Key ]
        string SystemName;
        
        [ Key ]
        string SystemCreationClassName;

        string Caption;
};


//------------------------------------------------
// HA_OrderConstraint
//------------------------------------------------
/* rsc_order constraint */
[ Provider ("cmpi:HA_OrderConstraintProvider" ) ]
class HA_OrderConstraint : 
                HA_ResourceConstraint {
        string From;
        string OrderType;
        string To;
};


//------------------------------------------------
// HA_ColocationConstraint
//------------------------------------------------
/* rsc_colocation constraint */
[ Provider ("cmpi:HA_ColocationConstraintProvider" ) ]
class HA_ColocationConstraint :
                HA_ResourceConstraint {
        string From;
        string To;
        string Score;
};


//------------------------------------------------
// HA_LocationConstraint
//------------------------------------------------
/* rsc_location constraint */
[ Provider ("cmpi:HA_LocationConstraintProvider" ) ]
class HA_LocationConstraint:
                HA_ResourceConstraint {
        string Resource;
        string Score;
}; 

[ Provider ("cmpi:HA_LocationConstraintRuleProvider" ) ]
class HA_LocationConstraintRule {
	[ Key ]
	string Id;
	[ Key ]
	string ConstraintId;

	string Attribute;
	string Operation;
	string Value;
	string Caption;
};

[ Association, Aggregation,
	Provider ("cmpi:HA_RuleOfLocationConstraintProvider" ) ]
class HA_RuleOfLocationConstraint {
	[Key]
	HA_LocationConstraint REF Constraint;
	[Key]
	HA_LocationConstraintRule REF Rule;
};

//-----------------------------------------------
// Association, HA_SubResource
//-----------------------------------------------

[ Association, Aggregation,
        Provider ( "cmpi:HA_SubResourceProvider" ) ]
class HA_SubResource {
        [ Key,  Aggregate, Description ( "Resource Group/Clone/Master" ) ]
        HA_ClusterResource REF Antecedent;

        [ Key,  Description ( "SubResource or SubResourceGroup" ) ]
        HA_ClusterResource REF Dependent;
};


//-----------------------------------------
//  Association, HA_ParticipatingNode
//-----------------------------------------

[ Association, 
        Provider("cmpi:HA_ParticipatingNodeProvider") ]
class HA_ParticipatingNode : CIM_ParticipatingCS{
        [ Override ("Dependent"),
                Description ("The LinuxHA Cluster.")
        ]
        HA_Cluster REF Dependent;

        [ Override ("Antecedent"),
                Description ("The LinuxHA Node.")
        ]
        HA_ClusterNode REF Antecedent;

};


//-------------------------------------------
// Assocition, HA_HostedResource
//-------------------------------------------

[ Association,
        Provider("cmpi:HA_HostedResourceProvider") ]
class HA_HostedResource {
        [ Key,
                Description ("The cluster node that host the resource.")
        ]
        HA_ClusterNode REF Antecedent;

        [ Key,
                Description ("The cluster resource.")
        ]
        HA_PrimitiveResource REF Dependent;
};



//-------------------------------------------
// Indication, HA_Indication
//-------------------------------------------

[ Indication,
        Provider ("cmpi:HA_IndicationProvider") ]
class HA_Indication : CIM_ProcessIndication {
        uint16 Type;
        string Message;
        datetime Time;
};


[ Provider ("cmpi:HA_ClusteringServiceProvider") ]
class HA_ClusteringService {
	[ Key ]
	string Id;
	string Caption;
	uint32 AddResource(
		[IN, Description ("The resource to be added.")]
		HA_ClusterResource REF Resource);
};

//-----------------------------------------
// End of File
//-----------------------------------------

