mkrel

Name

mkrel - Makes a managed relationship between resources.

Synopsis

mkrel [-h] -f data_input_file [-T] [-V]

mkrel [-h] [-p relationship] [-o condition] -S Source_class[:Resource_name[:Node]] [-s "Source_selection_string"] -G Target_class[:Resource_name[:Node][,Target_class[:Resource_name [:Node][,...]]]] [-g "Target_selection_string"] [-T] [-V] [Managed_Relation]

Description

The mkrel command makes a relationship between resources. The relationship is between a source resource and one or more target resources. The source resource must be a managed resource, which is either a member of a resource group or a resource group. The target resource does not have to be in a resource group.

Managed relationships and their attribute flags can be specified on the command line as the syntax indicates or from a file when used with the -f option. The value must be the same data type that is defined for this resource attribute. Use the lsrsrcdef command to verify the data type and attribute field for each attribute.

Although optional, specify a name for the managed relationship.

Options

-o condition
Specifies an If condition to be used when a Location relationship (Collocated, AntiCollocated, Affinity, or AntiAffinity) or a StartAfter (for the IfPossible condition only) is defined. The value can be a numeric value or a word (not case-sensitive):
0x0000 or NoCondition
Specifies unconditional location relationship.
0x0001 or IfOnline
Specifies that the target resource is online.
0x0002 or IfOffline
Specifies that the target resource is offline, failed offline, or unknown.
0x0003 or IfNotOnline
Specifies that the target resource is not online.
0x0004 or IfNotOffline
Specifies that the target resource is not offline or failed offline.
0x0005 or IfPossible
Used with the StartAfter relationship. Specifies that the target resource group can be bypassed if it cannot be bound, in which case it ends up in Sacrificed state and the StartAfter relationship is ignored.
-f data-input_file
Specifies the name of the file that contains managed-relationship attribute information.
-g Target_selection_string
Specifies the target selection string, which is applied to all resources of the resource class that is specified by the -G option to determine the targets of the relationship.

If the -g option is used to specify a target selection string, Resource_name and Node must not be specified for the -G option.

-G Target_class[:Resource_name[:Node]]

Specifies the target resources of the relationship. A target resource is identified by the resource class (Target_class) of the resource, the resource name (Resource_name), and, optionally, the node (Node) at which the resource is located.

Resource names cannot contain the Dollar symbol ($). Target_class, Resource_name, and Node must be separated by colons. Multiple target resources can be specified and are separated by commas. The colons are required, but omitting Target_class or Resource_name causes the previously specified class or name to be used when multiple target resources are specified.

If the -g option is used to specify a target selection string, Resource_name and Node must not be specified for the -G option.

-h
Writes the command's usage statement to standard output.
-p relationship
Specifies the managed relationship to apply. The value can be a numeric value or a word (not case-sensitive):
0x0001 or Collocated
Specifies that the source and the target resources are on the same node.
0x0002 or AntiCollocated
Specifies that the source and the target resources are on different nodes.
0x0003 or Affinity
Specifies that the source resource and its specified affinity resource are on the same node if possible.
0x0004 or AntiAffinity
Specifies that the source resource and its specified affinity resource areon different nodes if possible.
0x0005 or IsStartable
Specifies that the source and its target resources are startable.
0x0006 or StartAfter
Specifies that the source is to be started after the target resources.
0x0007 or DependsOn
Specifies that the target resources must be online before the source resource is started and includes an implicit collocation between the source and target resources.
0x0008 or DependsOnAny
Specifies that the target must be online before the source resource is started. It is identical to the DependsOn relationship except that it does not provide the collocated constraint for the start sequence. Therefore the source and target resources can not be started on the same node.
0x0009 or StopAfter
Specifies that the source resource can not be stopped until after the target resource is offline.
0x000A or ForcedDownBy
Specifies that the source resource must be forced offline if the target resource goes offline unexpectedly or the target resource itself is forced offline.
-s Source_selection_string

Specifies the source selection string, which is applied to all resources of the resource class that is specified by the -S option to determine the source of the relationship. The result of the selection must contain only one resource.

If the -s option is used to specify a source selection string, Resource_name and Node must not be specified for the -S option.

-S Source_class[:Resource_name[:Node]]

Specifies the source resource of the relationship. A source resource is identified by the resource class (Source_class) of the resource, the resource name (Resource_name), and, optionally, the node (Node) at which the resource is located.

Resource names cannot contain the Dollar symbol ($). Source_class, Resource_name, and Node must be separated by colons.

If the -s option is used to specify a source selection string, Resource_name and Node must not be specified for the -S option.

-T
Writes the command's trace messages to standard error. For your software-service organization's use only.
-V
Writes the command's verbose messages to standard output.

Parameters

Managed_Relation
Optional name of the managed relationship. The name of a managed relationship cannot contain the Dollar symbol ($).

If there are several managed relationships with the same source resource, specify a name for the managed relationship. Otherwise, the relationships are consolidated into a single managed relationship after a policy save and activate action with the sampolicy command.

Exit Status

0
The command ran successfully.
1
Error occurred with RMC.
2
Error occurred with CLI script.
3
Incorrect flag on command line.
4
Incorrect parameter on command line.
5
Error occurred with RMC that was based on faulty command line input.
6
Resource specified was not found.
7
Resource exists.

Security

This command requires root authority, or a user ID with appropriate permissions. For more information, see Setting up non-root user Ids for the command line interface.

Examples

  1. To create a new relationship by using the data input file, proceed as follows:
    1. To generate a template to aid in the defining of these relationships in a file, enter:
      lsrsrcdef -i IBM.ManagedRelationship > /tmp/Rel.rdef
    2. Edit the file /tmp/Rel.rdef with your preferred text editor: Enter values for all of the attributes, substituting an appropriate value for the type or leaving it blank if you want the default value.
    3. Run the mkrel command with the file as follows:
      mkrel -f /tmp/Rel.rdef

    Sample Data Input file for mkrel:

    You can enter values for all of the attributes and change the value shown in the sample, or remove the line with the attribute if you want the default value.

    PersistentResourceAttributes::
    resource 1: 
    Name = "Rel1" 
    Source = "IBM.ResourceGroup:G2" 
    Target = "IBM.ResourceGroup:G1"
    Relationship = StartAfter
    resource 2: 
    Name = "Rel2" 
    Source = IBM.Application:A2 
    Target = "{IBM.NetworkInterface:eth0:saopt02}" 
    Conditional = IfNotOffline
    Relationship = collocated
  2. To make a relationship that is named myrel for a resource tester that belongs to resource class IBM.Application with target resources from resource class IBM.Application, whose ResourceType is set to one, enter:
    mkrel -p collocated -S IBM.Application:tester -G IBM.Application -g "ResourceType==1" myrel
  3. To make an Affinity relationship that is called test for a resource tester belonging to resource class IBM.Application with target resource tester1 belonging to resource class IBM.Application and target resources Jfoo belonging to resource class IBM.Application, enter:
    mkrel -p affinity -S IBM.Application:tester -G IBM.Application:tester1,Jfoo test
  4. To define a Collocated relationship that is named myrel for a source resource narten of class IBM.Application to target resources tr0 and en0 of class IBM.ServiceIP, enter:
    mkrel -p 1 -S IBM.Application:narten -G IBM.ServiceIP:tr0,:en0 myrel
  5. To define a Collocated relationship that is named myrel for a source resource from a selection string that is applied to the class IBM.Application with target resources tr0 and en0 of class IBM.ServiceIP, enter:
    mkrel -p collocated -S IBM.Application -s 'Name=="narten"' -G IBM.ServiceIP:tr0,:en0 myrel

Files

/usr/sbin/rsct/bin/mkrel
Location of the mkrel command.
data_input_file
See the examples, and see the man page for Resource_Data_Input file.

See Also

The addrgmbr, chequ, chrel, chrg, chrgmbr, lsrg, mkequ, mkrg, rmequ, rmrel, rmrg, rmrgmbr commands.

The rmccli general information file.

The Resource_Data_Input file.