Skip to main content
  • Place orders quickly and easily
  • View orders and track your shipping status
  • Enjoy members-only rewards and discounts
  • Create and access a list of your products
  • Manage your Dell EMC sites, products, and product-level contacts using Company Administration.

列挙を超えたWSMANの探索

Summary: Dell TechCenterのDell OSおよびアプリケーション ソリューション - Project Sputnik、Microsoft Windows、Red Hat Linux、SUSE、Ubuntu、その他

This article may have been automatically translated. If you have any feedback regarding its quality, please let us know using the form at the bottom of this page.

Article Content


Symptoms

WSMANはDell iDRAC用に選択された管理APIであり、リモート システム管理を可能な限り包括的かつ簡単にするために広範な取り組みが進行中です。私は最近、プラグインを実装するためのWSMANプロトコルを理解するのに時間を費やしましたが、最初のwsman列挙アクションの後、WSMANプロトコルは少し面倒になります。適切なキープロパティを使用してget/put/create/delete/customアクションを呼び出す方法に関する簡単なドキュメント/例はありません。  この情報の主な情報源は、DMTFのWSMAN仕様とWSMAN-CIMバインディング仕様であり、従うのは苦痛なほど長いです。繰り返しになりますが、この記事の内容のほとんどは、DMTF仕様ドキュメントからのものです。これは、いくつかの例(Linuxの場合)を使用して、その情報を簡単に消化できるようにする試みです。

SFCBとopenwsmanを使い始める方法に関するホワイトペーパーは、すでに https://linux.dell.com/files/whitepapers/WBEM_based_management_in_Linux.pdfが連携しない場合があります。WSMAN/SFCBを初めて使用する場合は、この記事よりもPDFの方が出発点として適しています。上記のホワイトペーパーにあるように、この記事では主にopenwsmanとSFCB CIMOMの実装を扱います。

さて、WSMANサーバーが与えられた場合、wsman APIで管理可能なすべてのコンポーネントを一覧表示する方法はありますか? ほとんどのWSMANサーバーは、バックエンドのCIMOMと通信し、CIMOMの管理機能を公開します。つまり、WSMAN サーバーの管理機能は、バックエンドの CIMOM に登録されている CIM プロバイダーに依存します。CIMOM には、 EnumerateClassNames という名前の組み込み関数が定義されており、この関数を呼び出すと、CIMOM に登録されているすべてのクラスが一覧表示されます。

Cause

WSMAN 仕様には EnumerateClassNames の 1 対 1 のマッピングがないため、このメソッドは WSMAN の他のカスタム関数と同様に呼び出されます。これは実装固有であり、wsmancliの実装に適用されることに注意してください。これは、今後のリリースで異なるか、更新される可能性があります。

Resolution

CIMOMの組み込み EnumerateClassNames 関数は、wsmancliを使用して次のように呼び出すことができます。
wsman invoke -a EnumerateClassNames --hostname=test_host --port=5985 --username=abc --password=password http://schemas.openwsman.org/wbem/wscim/1/instrinsic  --namespace=root/cimv2
   
 <s:Body>

    <n1:EnumerateClassNames>

      <n1:name>root/cimv2:CIM_Service</n1:name>

      <n1:name>root/cimv2:Syslog_RecordInLog</n1:name>

      <n1:name>root/cimv2:Linux_SambaValidUsersForShare</n1:name>

       <n1:name>root/cimv2:Linux_BaseBoard</n1:name>

      <n1:name>root/cimv2:Linux_SambaForceUserForShare</n1:name>

      <n1:name>root/cimv2:Linux_Processor</n1:name>

      <n1:name>root/cimv2:CIM_RecordForLog</n1:name>

      <n1:name>root/cimv2:Linux_SambaShareForService</n1:name>

      <n1:name>root/cimv2:Linux_SambaServiceConfigurationForService</n1:name>

      <n1:name>root/cimv2:Linux_SambaHostsForService</n1:name>

      <n1:name>root/cimv2:Linux_SambaForceUserForGlobal</n1:name>

      <n1:name>root/cimv2:CIM_OSProcess</n1:name>

      <n1:name>root/cimv2:CIM_RunningOS</n1:name>...................
 
出力は上記のようになり、名前空間 root/cimv2 では、Linux_Processor が登録されているクラスの 1 つであることがわかります。新しいクラスが root/cimv2 名前空間に登録されたときに継承される CIM クラスが多数あり、上記のコマンドではそれらすべてのクラス名も一覧表示されます。原則として、接頭辞が CIM_ のすべてのクラスを無視できます。接頭辞 Linux_ 付いたクラスはすべて、Linuxシステムにインストールされているプロバイダーによって登録されるクラスです。DellのiDRACを使用している場合、ほとんどの場合、接頭辞 DCIM_ 付いたクラスに関心があります。

すべてのクラス名のリストができたので、 getClass 組み込み関数を使用して、 次のようにLinux_Processor クラスの定義を抽出できます。
wsman invoke -a GetClass --hostname=test_host --port=5985 --username=abc --password=password http://schemas.openwsman.org/wbem/wscim/1/intrinsic/Linux_Processor  --namespace=root/cimv2
 
 上記のコマンドは、 Linux_Processor で定義されているすべてのプロパティをローカルに一覧表示します。つまり、他の CIM_* クラスから継承されたプロパティは、現在の実装ではリストされません。通常、クラスの定義から、クラスでどのメソッドが定義されているか、それらのメソッドに渡す必要があるパラメータ、クラスのどのプロパティがキープロパティであるかなどを把握できます。ただし、上記のコマンドはローカルプロパティのみを返すため、クラス内のキープロパティを識別できません。繰り返しますが、これは現在wsmancliの実装上の制限事項です。

そのため、GetClass 関数は適切な出発点ですが、その出力は、get/put/create/custom アクションを呼び出せるように、クラスのどのプロパティをキー プロパティとして使用できるかを判断するのに十分ではありません。では、これを実現するために他にどのような手法を使用できますか? そこで役立つのがEPRです。


EPR (End Point Reference) は、ResourceURI と Selector Set の 2 つの情報を持つインスタンスへのポインターです。ResourceURI にはインスタンスの作成元のクラス名があり、セレクタ セットにはインスタンスを一意に識別できるプロパティが一覧表示されます。特定のクラスのEPRは、次のようなコマンドで列挙できます。
wsman enumerate -M epr  http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor -h test_host-P 5985 -u abc -p password -O out

 <?xml version="1.0" encoding="UTF-8"?>

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">

  <s:Header>

    <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>

    <wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/PullResponse</wsa:Action>

    <wsa:RelatesTo>uuid:ca52c9e9-cd47-1d47-8003-a52924d9bed4</wsa:RelatesTo>

    <wsa:MessageID>uuid:ca622bb3-cd47-1d47-8097-a52924d9bed4</wsa:MessageID>

  </s:Header>

  <s:Body>

    <wsen:PullResponse>

      <wsen:EnumerationContext>ca4fdd21-cd47-1d47-8095-a52924d9bed4</wsen:EnumerationContext>

      <wsen:Items>

        <wsa:EndpointReference>

          <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>

          <wsa:ReferenceParameters>

            <wsman:ResourceURI>http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor</wsman:ResourceURI>

            <wsman:SelectorSet>

              <wsman:Selector Name="__cimnamespace">root/cimv2</wsman:Selector>

              <wsman:Selector Name="SystemCreationClassName">Linux_ComputerSystem</wsman:Selector>

              <wsman:Selector Name="SystemName">localhost.localdomain</wsman:Selector>

              <wsman:Selector Name="CreationClassName">Linux_Processor</wsman:Selector>

              <wsman:Selector Name="DeviceID">0</wsman:Selector>

            </wsman:SelectorSet>

          </wsa:ReferenceParameters>

        </wsa:EndpointReference>

      </wsen:Items>

    </wsen:PullResponse>

  </s:Body>

</s:Envelope>
 ターゲット システムのすべてのプロセッサーのうち、上記の出力は1つのプロセッサーのみです。出力では、resourceURI は http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor として一覧表示され、SelectorSet には __cimnamespace、SystemCreationClassName、SystemName、CreationClassName、および DeviceID の値が一覧表示されます。つまり、Linux_Processor クラスのすべてのプロパティ (継承およびローカルに定義) で、これらのプロパティを使用してインスタンスを一意に識別できます。

 したがって、次のようなコマンドから有効な応答が期待できます。
wsman get  http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor?SystemCreationClassName="Linux_ComputerSystem",SystemName="localhost.localdomain",CreationClassName="Linux_Processor",DeviceID="3",__cimnamespace="root/cimv2" -h test_host -P 5985 -u abc -p password -O get
 上記の要求で他のプロパティが使用されている場合、バックエンドのCIMOMはインスタンスを一意に識別できません。同様に、インスタンスを実行する必要があるカスタム・メソッドがいくつかある場合は、クラスのEPRを使用して、メソッドを呼び出すキー・プロパティーを識別できます。

関連付けの EPR を列挙することもできます。クラス名が与えられると、それが標準のクラス名なのか、アソシエーションクラスなのかを判断できません。アソシエーションのインスタンスには 2 つのインスタンスへのポインターがあるため、アソシエーションの EPR には、アソシエーションが参照しているインスタンス/オブジェクトの EPR が含まれます。次に、同じ例を示します。
wsman enumerate -M epr  http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_CSProcessor -h test_host -P 5985 -u abc -p password -O out

 <?xml version="1.0" encoding="UTF-8"?>

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">

  <s:Header>

    <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>

    <wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/PullResponse</wsa:Action>

    <wsa:RelatesTo>uuid:2efbfcad-cd4b-1d4b-8003-a52924d9bed4</wsa:RelatesTo>

    <wsa:MessageID>uuid:2efc1c6f-cd4b-1d4b-80b3-a52924d9bed4</wsa:MessageID>

  </s:Header>

  <s:Body>

    <wsen:PullResponse>

      <wsen:EnumerationContext>2ef7f6f5-cd4b-1d4b-80b1-a52924d9bed4</wsen:EnumerationContext>

      <wsen:Items>

        <wsa:EndpointReference>

          <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>

          <wsa:ReferenceParameters>

            <wsman:ResourceURI>http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_CSProcessor</wsman:ResourceURI>

            <wsman:SelectorSet>

              <wsman:Selector Name="__cimnamespace">root/cimv2</wsman:Selector>

              <wsman:Selector Name="GroupComponent">

                <wsa:EndpointReference>

                  <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>

                  <wsa:ReferenceParameters>

                    <wsman:ResourceURI>http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_ComputerSystem</wsman:ResourceURI>

                    <wsman:SelectorSet>

                      <wsman:Selector Name="CreationClassName">Linux_ComputerSystem</wsman:Selector>

                      <wsman:Selector Name="Name">localhost.localdomain</wsman:Selector>

                      <wsman:Selector Name="__cimnamespace">root/cimv2</wsman:Selector>

                    </wsman:SelectorSet>

                  </wsa:ReferenceParameters>

                </wsa:EndpointReference>

              </wsman:Selector>

              <wsman:Selector Name="PartComponent">

                <wsa:EndpointReference>

                  <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>

                  <wsa:ReferenceParameters>

                    <wsman:ResourceURI>http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_Processor</wsman:ResourceURI>

                    <wsman:SelectorSet>

                      <wsman:Selector Name="SystemCreationClassName">Linux_ComputerSystem</wsman:Selector>

                      <wsman:Selector Name="SystemName">localhost.localdomain</wsman:Selector>

                      <wsman:Selector Name="CreationClassName">Linux_Processor</wsman:Selector>

                      <wsman:Selector Name="DeviceID">0</wsman:Selector>

                      <wsman:Selector Name="__cimnamespace">root/cimv2</wsman:Selector>

                    </wsman:SelectorSet>

                  </wsa:ReferenceParameters>

                </wsa:EndpointReference>

              </wsman:Selector>

            </wsman:SelectorSet>

          </wsa:ReferenceParameters>

        </wsa:EndpointReference>

      </wsen:Items>

    </wsen:PullResponse>

  </s:Body>

</s:Envelope>
Linux_CSProcessor は、 Linux_ComputerSystem クラスと Linux_Processor クラスの間の関連付けであり、プロセッサがコンピュータ システムに格納されているという関係を確立し、GroupComponent セクションと PartComponent セクションです。

EPRと、EPRを使用して個々のインスタンスにアクセスする方法を理解するのに時間を費やす必要がありましたが、他の人に役立つかもしれないと思いました。以下にコメント/提案を残してください。

免責事項:

上記の記事は情報提供のみを目的としています。内容は、言及された技術/用語の私の解釈によるものです。この情報は現状有姿で提供されており、誤字脱字や不正確な技術情報が含まれている可能性があります。

Article Properties


Affected Product

Ubuntu Server LTS

Last Published Date

11 Jun 2024

Version

4

Article Type

Solution