How do I call invokeMethod with an instance reference?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I call invokeMethod with an instance reference?

Johnny Hwang

Hello all,

 

I come from a CIM/SMI-S background, so I’m not too familiar with how you construct an instance reference parameter to be passed into invokeMethod. I’m trying to do something similar to this command here:

 

./wsman -h server -u Administrator -p 'password' --debug=6 --auth=basic invoke 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_VirtualSystemManagementService?CreationClassName="Msvm_VirtualSystemManagementService",Name="vmms",SystemCreationClassName="Msvm_ComputerSystem",SystemName="HYPERV01"' -a DestroySystem -k 'AffectedSystem=Msvm_PlannedComputerSystem.CreationClassName="Msvm_PlannedComputerSystem",Name="F420222E-DFEF-49E9-9388-07F504017528"'

 

Where AffectedSystem takes a CIM_ComputerSystem REF. How would I construct that for both the wsman binary and for the java bindings?

 

Thank you,

Johnny Hwang

 


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I call invokeMethod with an instance reference?

Klaus Kaempf
* Johnny Hwang <[hidden email]> [Apr 16. 2014 02:42]:
> Hello all,
>
> I come from a CIM/SMI-S background, so I'm not too familiar with how you construct an instance reference parameter to be passed into invokeMethod. I'm trying to do something similar to this command here:
>
> ./wsman -h server -u Administrator -p 'password' --debug=6 --auth=basic invoke 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_VirtualSystemManagementService?CreationClassName="Msvm_VirtualSystemManagementService",Name="vmms",SystemCreationClassName="Msvm_ComputerSystem",SystemName="HYPERV01"' -a DestroySystem -k 'AffectedSystem=Msvm_PlannedComputerSystem.CreationClassName="Msvm_PlannedComputerSystem",Name="F420222E-DFEF-49E9-9388-07F504017528"'
>
> Where AffectedSystem takes a CIM_ComputerSystem REF. How would I construct that for both the wsman binary and for the java bindings?

A CIM reference is called 'endpoint reference' in WS-Management. This
is exposed as 'EndPointReference' in the bindings.

You can can the EndPointReference constructor with an URI
representation of the instance.
See https://github.com/Openwsman/openwsman/blob/master/bindings/ruby/tests/epr.rb#L60
for an example.


Hth,

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I call invokeMethod with an instance reference?

Johnny Hwang
Hello Klaus,

Thank you. So CIM references are called endpoint reference (EPR) in WS-Management. What about CIM embedded instances?

Johnny Hwang

-----Original Message-----
From: Klaus Kaempf [mailto:[hidden email]]
Sent: Wednesday, April 23, 2014 6:15 AM
To: Johnny Hwang
Cc: [hidden email]
Subject: Re: [Openwsman-devel] How do I call invokeMethod with an instance reference?

* Johnny Hwang <[hidden email]> [Apr 16. 2014 02:42]:
> Hello all,
>
> I come from a CIM/SMI-S background, so I'm not too familiar with how you construct an instance reference parameter to be passed into invokeMethod. I'm trying to do something similar to this command here:
>
> ./wsman -h server -u Administrator -p 'password' --debug=6 --auth=basic invoke 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_VirtualSystemManagementService?CreationClassName="Msvm_VirtualSystemManagementService",Name="vmms",SystemCreationClassName="Msvm_ComputerSystem",SystemName="HYPERV01"' -a DestroySystem -k 'AffectedSystem=Msvm_PlannedComputerSystem.CreationClassName="Msvm_PlannedComputerSystem",Name="F420222E-DFEF-49E9-9388-07F504017528"'
>
> Where AffectedSystem takes a CIM_ComputerSystem REF. How would I construct that for both the wsman binary and for the java bindings?

A CIM reference is called 'endpoint reference' in WS-Management. This is exposed as 'EndPointReference' in the bindings.

You can can the EndPointReference constructor with an URI representation of the instance.
See https://github.com/Openwsman/openwsman/blob/master/bindings/ruby/tests/epr.rb#L60
for an example.


Hth,

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Maxfeldstraße 5, 90409 Nürnberg, Germany
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I call invokeMethod with an instance reference?

Klaus Kaempf
* Johnny Hwang <[hidden email]> [May 20. 2014 22:36]:
> Hello Klaus,
>
> Thank you. So CIM references are called endpoint reference (EPR) in WS-Management. What about CIM embedded instances?

CIM EmbeddedInstance and EmbeddedObject encodings are explained in
DSP0230
(http://dmtf.org/sites/default/files/standards/documents/DSP0230_1.0.0.pdf)

Embedded instances are represented as XML using the respective class
URI as an xml namespace qualifier. See line 901 of DSP0230 for an
example.

Hth,

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I call invokeMethod with an instance reference?

Johnny Hwang
Hello Klaus,

I've found an example XML, albeit in the OUTPUT, but assuming input and output are interchangeable, this should be the XML format. I'll file the bug request.

INPUT:

/wsman -h hyperv01.east.ads.dev.tintri.com -u some-user -p 'some-password' --debug=6 --auth=basic invoke 'http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_ImageManagementService?CreationClassName="Msvm_ImageManagementService",Name="vhdsvc",SystemCreationClassName="Msvm_ComputerSystem",SystemName="HYPERV01"' -a GetVirtualHardDiskSettingData -k 'Path=D:\tiny_vm_02_disk_1_clone1.vhdx'

OUTPUT:

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:x="http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" xml:lang="en-US">
  <s:Header>
    <a:Action>http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_ImageManagementService/GetVirtualHardDiskSettingDataResponse</a:Action>
    <a:MessageID>uuid:BC013839-CD3D-44E0-A3AF-4636206EF6A7</a:MessageID>
    <a:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:To>
    <a:RelatesTo>uuid:683922d4-172d-172d-8002-482553671e00</a:RelatesTo>
  </s:Header>
  <s:Body>
    <p:GetVirtualHardDiskSettingData_OUTPUT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/Msvm_ImageManagementService" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common">
      <p:SettingData>&lt;INSTANCE CLASSNAME="Msvm_VirtualHardDiskSettingData"&gt;&lt;PROPERTY NAME="BlockSize" TYPE="uint32"&gt;&lt;VALUE&gt;2097152&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="Caption" TYPE="string"&gt;&lt;VALUE&gt;Virtual Hard Disk Setting Data&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="Description" TYPE="string"&gt;&lt;VALUE&gt;Setting Data for a Virtual Hard Disk.&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="ElementName" TYPE="string"&gt;&lt;VALUE&gt;tiny_vm_02_disk_1_clone1.vhdx&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="Format" TYPE="uint16"&gt;&lt;VALUE&gt;3&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="InstanceID" TYPE="string"&gt;&lt;VALUE&gt;62E2654B-56F3-4E18-8140-666238AEA0BD&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="LogicalSectorSize" TYPE="uint32"&gt;&lt;VALUE&gt;512&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="MaxInternalSize" TYPE="uint64"&gt;&lt;VALUE&gt;1073741824&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="ParentPath" TYPE="string"&gt;&lt;VALUE&gt;D:\tiny_vm_02_disk_1_source.vhdx&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="Path" TYPE="string"&gt;&lt;VALUE&gt;D:\tiny_vm_02_disk_1_clone1.vhdx&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="PhysicalSectorSize" TYPE="uint32"&gt;&lt;VALUE&gt;4096&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="Type" TYPE="uint16"&gt;&lt;VALUE&gt;4&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;PROPERTY NAME="VirtualDiskId" TYPE="string"&gt;&lt;VALUE&gt;2B21D365-CD69-4977-8CC3-E484C9AB9E05&lt;/VALUE&gt;&lt;/PROPERTY&gt;&lt;/INSTANCE&gt;</p:SettingData>
      <p:Job xsi:nil="true"/>
      <p:ReturnValue>0</p:ReturnValue>
    </p:GetVirtualHardDiskSettingData_OUTPUT>
  </s:Body>
</s:Envelope>

Johnny Hwang

-----Original Message-----
From: Klaus Kaempf [mailto:[hidden email]]
Sent: Tuesday, May 20, 2014 11:03 PM
To: Johnny Hwang
Cc: [hidden email]; Snehal Paradkar
Subject: Re: [Openwsman-devel] How do I call invokeMethod with an instance reference?

* Johnny Hwang <[hidden email]> [May 20. 2014 22:36]:
> Hello Klaus,
>
> Thank you. So CIM references are called endpoint reference (EPR) in WS-Management. What about CIM embedded instances?

CIM EmbeddedInstance and EmbeddedObject encodings are explained in
DSP0230
(http://dmtf.org/sites/default/files/standards/documents/DSP0230_1.0.0.pdf)

Embedded instances are represented as XML using the respective class URI as an xml namespace qualifier. See line 901 of DSP0230 for an example.

Hth,

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) Maxfeldstraße 5, 90409 Nürnberg, Germany
------------------------------------------------------------------------------
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I call invokeMethod with an instance reference?

Klaus Kaempf
* Johnny Hwang <[hidden email]> [May 29. 2015 02:21]:
> Hello Klaus,
>
> I've found an example XML, albeit in the OUTPUT, but assuming input and output are interchangeable, this should be the XML format. I'll file the bug request.

Johnny,

the output is correct, I believe.

According to the documentation
(https://msdn.microsoft.com/en-us/library/hh850064(v=vs.85).aspx),
GetVirtualHardDiskSettingData returns "an embedded instance of the
Msvm_VirtualHardDiskSettingData class"

Embedding XML into XML is always done via escaping. If you replace
'&lt;' with '<' and '&gt;' with '>', the output value becomes valid
XML:

<?xml version="1.0"?>
<INSTANCE CLASSNAME="Msvm_VirtualHardDiskSettingData">
  <PROPERTY NAME="BlockSize" TYPE="uint32">
    <VALUE>2097152</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Caption" TYPE="string">
    <VALUE>Virtual Hard Disk Setting Data</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Description" TYPE="string">
    <VALUE>Setting Data for a Virtual Hard Disk.</VALUE>
  </PROPERTY>
  <PROPERTY NAME="ElementName" TYPE="string">
    <VALUE>tiny_vm_02_disk_1_clone1.vhdx</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Format" TYPE="uint16">
    <VALUE>3</VALUE>
  </PROPERTY>
  <PROPERTY NAME="InstanceID" TYPE="string">
    <VALUE>62E2654B-56F3-4E18-8140-666238AEA0BD</VALUE>
  </PROPERTY>
  <PROPERTY NAME="LogicalSectorSize" TYPE="uint32">
    <VALUE>512</VALUE>
  </PROPERTY>
  <PROPERTY NAME="MaxInternalSize" TYPE="uint64">
    <VALUE>1073741824</VALUE>
  </PROPERTY>
  <PROPERTY NAME="ParentPath" TYPE="string">
    <VALUE>D:\tiny_vm_02_disk_1_source.vhdx</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Path" TYPE="string">
    <VALUE>D:\tiny_vm_02_disk_1_clone1.vhdx</VALUE>
  </PROPERTY>
  <PROPERTY NAME="PhysicalSectorSize" TYPE="uint32">
    <VALUE>4096</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Type" TYPE="uint16">
    <VALUE>4</VALUE>
  </PROPERTY>
  <PROPERTY NAME="VirtualDiskId" TYPE="string">
    <VALUE>2B21D365-CD69-4977-8CC3-E484C9AB9E05</VALUE>
  </PROPERTY>
</INSTANCE>


Hth,

Klaus
--
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: How do I call invokeMethod with an instance reference?

Johnny Hwang
Yea, I found that just by passing in the Cim-Xml embedded instance format as a parameter, that worked, and let the wsman code do the escaping for me.

 Thanks,
 Johnny Hwang

Sent from my HTC

----- Reply message -----
From: "Klaus Kaempf" <[hidden email]>
To: "Johnny Hwang" <[hidden email]>
Cc: "[hidden email]" <[hidden email]>, "Snehal Paradkar" <[hidden email]>
Subject: [Openwsman-devel] How do I call invokeMethod with an instance reference?
Date: Mon, Jun 8, 2015 2:15 AM

* Johnny Hwang <[hidden email]> [May 29. 2015 02:21]:
> Hello Klaus,
>
> I've found an example XML, albeit in the OUTPUT, but assuming input and output are interchangeable, this should be the XML format. I'll file the bug request.

Johnny,

the output is correct, I believe.

According to the documentation
(https://msdn.microsoft.com/en-us/library/hh850064(v=vs.85).aspx),
GetVirtualHardDiskSettingData returns "an embedded instance of the
Msvm_VirtualHardDiskSettingData class"

Embedding XML into XML is always done via escaping. If you replace
'&lt;' with '<' and '&gt;' with '>', the output value becomes valid
XML:

<?xml version="1.0"?>
<INSTANCE CLASSNAME="Msvm_VirtualHardDiskSettingData">
  <PROPERTY NAME="BlockSize" TYPE="uint32">
    <VALUE>2097152</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Caption" TYPE="string">
    <VALUE>Virtual Hard Disk Setting Data</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Description" TYPE="string">
    <VALUE>Setting Data for a Virtual Hard Disk.</VALUE>
  </PROPERTY>
  <PROPERTY NAME="ElementName" TYPE="string">
    <VALUE>tiny_vm_02_disk_1_clone1.vhdx</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Format" TYPE="uint16">
    <VALUE>3</VALUE>
  </PROPERTY>
  <PROPERTY NAME="InstanceID" TYPE="string">
    <VALUE>62E2654B-56F3-4E18-8140-666238AEA0BD</VALUE>
  </PROPERTY>
  <PROPERTY NAME="LogicalSectorSize" TYPE="uint32">
    <VALUE>512</VALUE>
  </PROPERTY>
  <PROPERTY NAME="MaxInternalSize" TYPE="uint64">
    <VALUE>1073741824</VALUE>
  </PROPERTY>
  <PROPERTY NAME="ParentPath" TYPE="string">
    <VALUE>D:\tiny_vm_02_disk_1_source.vhdx</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Path" TYPE="string">
    <VALUE>D:\tiny_vm_02_disk_1_clone1.vhdx</VALUE>
  </PROPERTY>
  <PROPERTY NAME="PhysicalSectorSize" TYPE="uint32">
    <VALUE>4096</VALUE>
  </PROPERTY>
  <PROPERTY NAME="Type" TYPE="uint16">
    <VALUE>4</VALUE>
  </PROPERTY>
  <PROPERTY NAME="VirtualDiskId" TYPE="string">
    <VALUE>2B21D365-CD69-4977-8CC3-E484C9AB9E05</VALUE>
  </PROPERTY>
</INSTANCE>


Hth,

Klaus
--
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------

_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel