resource_data_input 信息文件

用途

描述如何使用输入文件,将资源属性名称和值等资源类信息传递至资源监视和控制 (RMC) 命令行界面 (CLI)。

描述

当您想要将资源的持久性属性值及其他信息传递至 RMC CLI 时,可以将 -f 标志与大多数 RMC 命令配合使用来指定资源数据输入文件的名称。 输入有关命令行的信息太繁琐或者易于发生打字错误时,这样做很有用。 此文件中的数据用于定义资源或者用于更改资源或资源类的持久性属性值。 必须采用 POSIX 格式的资源数据输入文件未设置位置。 它可以是临时文件,也可以是永久文件,具体情况取决于您的需求。

chrsrcmkrsrcresetrsrcrmrsrcrunactstartrsrcstoprsrc 命令在与 -f 标志一起发出时,会读取此文件。 lsactdeflsrsrclsrsrcdef 命令在与 -i 标志一起发出时,会以此格式生成文件。

在输入文件中使用关键字来指出在相关节中列出的数据类型:
ResourceAction
启动操作时资源操作的资源操作元素名称和值。 runact 命令会读入资源操作元素。 如果 runact -c 读取输入文件,那么将忽略这些元素。
ResourceClassAction
启动类操作时资源类操作的资源类操作元素名称和值。 runact 命令会读入资源操作元素。
PersistentResourceArguments
下列命令的资源命令参数名称和值(这些命令接受此参数名称和值):mkrsrcresetrsrcrmrsrcstartrsrcstoprsrc。 命令参数可选,且由资源类定义。 对这些命令指定 -l 选项以查看资源类的命令参数。
PersistentResourceAttributes
特定资源类(用来定义新资源或更改现有资源的属性值)的一个或多个资源的持久性属性名称和值。 由命令 mkrsrcchrsrc 读入持久性资源属性。 如果由 chrsrc 命令(与 -c 标志一起指定)读取输入文件,那么将忽略这些属性。
PersistentResourceClassAttributes
资源类的持久性属性名称和值(用来更改现有资源类的属性值)。 仅当指定了 -c 标志时, chrsrc 命令才会读取持久资源类属性。
通常,resource_data_input 文件是采用以下格式的纯文本文件。 粗体单词是字面值。 单个冒号 (:) 前面的文本是任意标签,可以是任何字母数字文本。
PersistentResourceAttributes::
# This is a comment
    label:
      AttrName1  = value 
      AttrName2  = value 
      AttrName3  = value 
    another label:
        Name        = name
        NodeNumber  = 1
	⋮
	::

PersistentResourceClassAttributes::
# This is a comment
    label:
      SomeSettableAttrName 		= value
      SomeOtherSettableAttrName 	= value
    ::
⋮

PersistentResourceArguments::
# This is a comment
    label:
      ArgName1  = value 
      ArgName2  = value 
      ArgName3  = value 
    ::
⋮
有关更多详细信息,请参阅示例部分。
有关格式的一些注释如下所示:
  • 关键字 PersistentResourceAttributesPersistentResourceClassAttributesPersistentResourceArguments 后面跟有两个冒号 (::)。
  • 关键字节的顺序在文件中并不重要。 例如,PersistentResourceClassAttributes 可位于 PersistentResourceClass 前面。 它不会影响通过调用 CLI 来读入的数据部分。
  • 单个节标题(在关键字下面)后面跟有一个冒号 (:),例如:c175n05 resource info:
  • 行首的空白字符不重要。 建议使用制表符或空格来增强可读性。
  • 以井号 (#) 作为第一个可打印字符的任何行均为注释。
  • 单独的行上每个条目均使用空白字符(空格或制表符)分隔。
  • 文件中的空白行不重要,但建议使用以增强可读性。
  • 对包括在特定 PersistentResourceAttributes 部分中的资源属性节数没有限制。
  • 对包括在特定 PersistentResourceClassAttributes 部分中的资源类属性节数没有限制。 通常,资源类只有一个实例。 在这种情况下,只需要一个节。
  • 如果只有一个资源属性节包括在特定 PersistentResourceAttributes 部分中,那么可以省略 label: 行。 这也适用于 ResourceAction 部分。
  • 如果只有一个资源类属性节包括在特定 PersistentResourceClassAttributes 部分中,那么可以省略 label: 行。 这也适用于 ResourceClassAction 部分。
  • 包含空格的值必须用引号引起。
  • 双冒号 (::) 表示部分的结束。 如果找不到终止双冒号,那么下一个保留关键字文件结束符会指示部分的结尾。
  • 必须对括在双引号内的字符串中包含的双引号进行转义。 (\")。
    注: 可以将双引号嵌套在单引号内。
    示例:
    • "Name == \"testing\""
    • 'Name == "testing"'

      如果您的字符串是选择字符串,并且您会将其剪切并粘贴至命令行,那么此语法是首选语法。

  • 必须对包含在用单引号括起来的字符串中的单引号进行转义。 (\')。
    注: 可以将单引号嵌套在双引号中。
    以下是一些示例:
    • 'Isn\'t that true'
    • "Isn't that true"

      如果将字符串剪切并粘贴至命令行,那么此语法是首选语法。

  • 用来在 resource_data_input 文件中输入数据的格式可能与命令行上使用的格式不同。 您选择在其中运行命令的 shell 在引号方面具有其自己的规则。 请参阅 shell 的文档以获取这些规则,以确定如何在命令行上输入数据。

实现细节

此信息是针对 Linux®, Solaris 和 Windows 的 AIX® 和 rsct.core-3.1.0.0-0.平台.rpm 软件包的 rsct.core.rmc 文件集的一部分,其中 平台i386帕克ppc64s390x86_64

位置

/opt/rsct/man/resource_data_input.7

示例

  1. 此样本 mkrsrc 命令:
    mkrsrc -f /tmp/my_resource_data_input_file IBM.Example
    使用 IBM.Example 资源类的样本输入文件 /tmp/my_resource_data_input_file。 输入文件的内容类似如下:
    PersistentResourceAttributes::
    # Resource 1 - only set required attributes
    resource 1:
        Name="c175n04"
        NodeList = {1}
    # Resource 2 - setting both required and optional attributes
    # mkrsrc -e2 IBM.Example displays required and optional
    # persistent attributes
    resource 2:
        Name="c175n05"
        NodeList = {1}
        Int32 = -99
        Uint32 = 99
        Int64 = -123456789123456789
        Uint64 = 123456789123456789
        Float32 = -9.89
        Float64 = 123456789.123456789
        String = "testing 123"
        Binary = 0xaabbccddeeff
        RH = "0x0000 0x0000 0x00000000 0x00000000 0x00000000 0x00000000"
        SD = [hello,1,{2,4,6,8}]
        Int32Array = {-4, -3, -2, -1, 0, 1, 2, 3, 4}
        Int64Array = {-4,-3,-2,-1,0,1,2,3,4}
        Uint32Array = {0,1,2,3,4,5,6}
        Uint64Array = {0,1,2,3,4,5,6}
        Float32Array = {-3.3, -2.2, -1.2, 0, 1, 2.2, 3.3}
        Float64Array = {-3.3, -2.2, -1.2, 0, 1, 2.2, 3.3}
        StringArray = {abc,"do re mi", 123}
        BinaryArray = {"0x01", "0x02", "0x0304"}
        RHArray     = {"0x0000 0x0000 0x00000000 0x00000000 0x00000000 0x00000000",
                       "0xaaaa 0xaaaa 0xbbbbbbbb 0xcccccccc 0xdddddddd 0xeeeeeeee"}
        SDArray     = {[hello,1,{0,1,2,3}],[hello2,2,{2,4,6,8}]}
        
  2. 此样本 chrsrc 命令:
    chrsrc -f  /tmp/Example/ch_resources -s 'Name == "c175n05"' IBM.Example
    使用样本输入文件 /tmp/Example/ch_resources 来更改现有 IBM.Example 资源的属性值。 输入文件的内容类似如下:
    PersistentResourceAttributes::
    # Changing resources that match the selection string entered
    # when running chrsrc command.
    	resource 1:
            String            = "this is a string test" 
            Int32Array        = {10,-20,30,-40,50,-60} 
  3. 此样本 rmrsrc 命令:
    rmrsrc -l IBM.Examplebar
    显示可选命令参数:
    rmrsrc IBM.Examplebar ExampleInt32=int32 ExampleUint32=uint32
  4. 此样本 rmrsrc 命令:
    rmrsrc -f /tmp/Examplebar/rm_resources -s 'Name == "c175n05"' IBM.Examplebar 
    使用样本输入 /tmp/Examplebar/rm_resources 文件来指定 rmrsrc 命令的可选命令参数。 输入文件的内容类似如下:
    PersistentResourceArguments:: 
    # Specifying command arguments when running rmrsrc command. 
    resource 1: 
    	ExampleInt32      =   1
            ExampleUint32     =   0