From: Sameer Z. <sa...@ya...> - 2015-04-02 01:44:47
|
Hello, I'm trying to create a CIM_IndicationSubscription instance on a remote host using wbemcli, using a valid Filter and Handler instances. The command fails with error "CIM_ERR_INVALID_PARAMETER". Looking at the XML output of ei for CIM_IndicationSubscription, I see the Filter and Handler references have LOCALINSTANCEPATH: <INSTANCENAME CLASSNAME="CIM_IndicationSubscription"> <KEYBINDING NAME="Filter"> <VALUE.REFERENCE> <LOCALINSTANCEPATH> <<<--- <LOCALNAMESPACEPATH> <NAMESPACE NAME="root" /> <NAMESPACE NAME="cimv2" /> </LOCALNAMESPACEPATH> <INSTANCENAME CLASSNAME="CIM_IndicationFilter"> Looking at the XML output of ci, I see wbemcli is sending references using INSTANCEPATH not LOCALINSTANCEPATH, which I suspect is the issue (not sure though): <INSTANCENAME CLASSNAME="CIM_IndicationSubscription"> <KEYBINDING NAME="Filter"> <VALUE.REFERENCE> <INSTANCEPATH> <<<--- <NAMESPACEPATH> <HOST>10.18.10.92</HOST> <<<--- <LOCALNAMESPACEPATH> <NAMESPACE NAME="root"></NAMESPACE> <NAMESPACE NAME="cimv2"></NAMESPACE> </LOCALNAMESPACEPATH> </NAMESPACEPATH> <INSTANCENAME CLASSNAME="CIM_IndicationFilter"> Is there a way to change wbemcli ci behavior to use LOCALINSTANCEPATH instead of the full INSTANCEPATH with HOST portion? Many thanks for your assistance. Regards,Sameer |
From: Dave H. <hel...@li...> - 2015-04-10 00:02:13
|
Hi Sameer, It's hard to know exactly why you got the CIM_ERR_INVALID_PARAMETER w/o seeing the wbemcli command line and the full XML request/response. In a quick check, wbemcli did use LOCALINSTANCEPATH at the point you indicated, in my query, so I'm guessing your issue is bad syntax of some sort on the wbemcli cmdline. It is possible to create a subscription with wbemcli but the syntax is a bit tricky, especially for Subscription class. I've given some examples below based on the SFCB TestIndicationProvider. The process is general and should work for any Filter, Handler and Subscription. But I make some abbreviations to the object path (COP) that may not work everywhere, and I have only tested this on SFCB. But if the abbreviations don't work for your queries, a more complete COP syntax should. I should say: I've found it sufficiently difficult to build the required queries that I don't think this is a great way to create a subscription, as tempting as it is to do everything with wbemcli. The command lines get unwieldy very fast when more than just a few properties need to be set, and it's really hard to deal with quotes and other special characters. I try to avoid ugly escaping of quotes and use single quotes instead. But there may be cases where escaping of quotes is unavoidable, and there are probably cases that just can't be handled easily on the command line. Instead I recommend using one of the available sample programs like Jsr48IndicationTester in the SBLIM Java Client, or indication_tester.py from the libvirt-cim "cimtest" suite, or just sending raw XML using wbemcat. But for wbemcli I follow a process like this: First, it's helpful to have some existing Filter, Handler and Subscription as a starting point. SFCB TestIndicationProvider has following sample XML (in the SFCB src repository) to create a subscription: wbemcat test/TestProviders/tests/IndTest1CreateFilter.xml wbemcat test/TestProviders/tests/IndTest2CreateHandler.xml wbemcat test/TestProviders/tests/IndTest3CreateSubscription.xml To build the command lines you will use for your own gi, di, ci, use the output from ei and ein operations on the existing subscription as a template. You'll use ein output to build gi & di queries since those require only object paths. You'll use ei output to build ci queries since those require full instances. (You should have an instance of CIM_IndicationHandler or CIM_ListenerDestination, not both. But because CIM_IndicationHandler is a child of CIM_ListenerDestination, the latter query will return either): $ wbemcli ein http://localhost/root/interop:CIM_IndicationFilter $ wbemcli ein http://localhost/root/interop:CIM_IndicationHandler $ wbemcli ein http://localhost/root/interop:CIM_ListenerDestination $ wbemcli ein http://localhost/root/interop:CIM_IndicationSubscription $ wbemcli ei http://localhost/root/interop:CIM_IndicationFilter $ wbemcli ei http://localhost/root/interop:CIM_IndicationHandler $ wbemcli ei http://localhost/root/interop:CIM_ListenerDestination $ wbemcli ei http://localhost/root/interop:CIM_IndicationSubscription For brevity I won't include the output of these here. But if you look at the following gi query it should be clear that I copied the ein output almost verbatim, to create these URLs. While your instances are present these gi queries should work: $ wbemcli gi 'http://localhost/root/interop:CIM_IndicationFilter.creationclassname="CIM_IndicationFilter",name="Test_Indication_Filter_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain"' $ wbemcli gi 'http://localhost/root/interop:CIM_IndicationHandlerCIMXML.creationclassname="CIM_IndicationHandlerCIMXML",name="Test_Indication_Handler_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain"' $ wbemcli gi 'http://localhost/root/interop:CIM_IndicationSubscription.filter=root/interop:cim_indicationfilter.creationclassname="CIM_IndicationFilter",name="Test_Indication_Filter_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain",handler=root/interop:cim_indicationhandlercimxml.creationclassname="CIM_IndicationHandlerCIMXML",name="Test_Indication_Handler_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain"' Now the di. The syntax is identical to the gi but the operations must be executed in reverse order: $ wbemcli di 'http://localhost/root/interop:CIM_IndicationSubscription.filter=root/interop:cim_indicationfilter.creationclassname="CIM_IndicationFilter",name="Test_Indication_Filter_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain",handler=root/interop:cim_indicationhandlercimxml.creationclassname="CIM_IndicationHandlerCIMXML",name="Test_Indication_Handler_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain"' $ wbemcli di 'http://localhost/root/interop:CIM_IndicationHandlerCIMXML.creationclassname="CIM_IndicationHandlerCIMXML",name="Test_Indication_Handler_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain"' $ wbemcli di 'http://localhost/root/interop:CIM_IndicationFilter.creationclassname="CIM_IndicationFilter",name="Test_Indication_Filter_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain"' Note the single quotes around the COP portion of the query. Depending on the contents of the COP you may be able to get away without them. If those operations are successful you will have deleted the Filter, Handler and Subscription created by the XML files. Now the ci. Here's where it gets tricky, especially for the Subscription. Now I'm using the ouput of the ie queries, since we need a full instances. I construct the queries as follows. These should create a subscription just like that created by the XML: $ wbemcli ci http://localhost/root/interop:CIM_IndicationFilter.SystemCreationClassName=,SystemName=,CreationClassName=,Name= 'QueryLanguage="WQL",Query="SELECT * FROM Test_Indication",IndividualSubscriptionSupported=TRUE,SourceNamespaces="root/interop",SourceNamespace="root/interop",Name="Test_Indication_Filter_",CreationClassName="CIM_IndicationFilter",SystemName="localhost.localdomain",SystemCreationClassName="CIM_ComputerSystem"' $ wbemcli ci http://localhost/root/interop:CIM_IndicationHandlerCIMXML.SystemCreationClassName=,SystemName=,CreationClassName=,Name= 'Protocol=2,PersistenceType=3,Name="Test_Indication_Handler_",CreationClassName="CIM_IndicationHandlerCIMXML",SystemName="localhost.localdomain",SystemCreationClassName="CIM_ComputerSystem",Destination="file:///tmp/SFCB_Listener.txt"' $ wbemcli ci http://localhost/root/interop:CIM_IndicationSubscription.Filter=,Handler= 'Filter=localhost/root/interop:CIM_IndicationFilter.creationclassname="CIM_IndicationFilter",name="Test_Indication_Filter_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain",Handler=localhost/root/interop:CIM_IndicationHandlerCIMXML.creationclassname="CIM_IndicationHandlerCIMXML",name="Test_Indication_Handler_",systemcreationclassname="CIM_ComputerSystem",systemname="localhost.localdomain"' Note the single quotes around the property list portion of the query. Depending on the contents of the property list you may be able to get away without them. To trigger an indication: $ wbemcli cm http://localhost/root/interop:Test_Indication SendTestIndication Some notes: - The Subscription is an association class with just the two properties, Filter & Handler, both are keys. - The ci requires both a COP and a property list, and the property list must include all the properties being set, including the keys, making these redundant with the COP. While you can set the keys in either part, for the Subscription I found it nearly impossible to set the Filter & Handler references properly in the COP portion. And since it's not possible to set *all* the properties in the COP portion, in the case of the Filter and Handler, since they have non-key properties, it just seemed cleaner to do it that way for all the queries. So, I found a abbreviated syntax for the COP containing just the property names was sufficient, and I set all the property values (including the keys) in the property list. Good luck! Dave H. On 04/01/2015 09:44 PM, Sameer Zeidat wrote: > Hello, > > I'm trying to create a CIM_IndicationSubscription instance on a remote > host using wbemcli, using a valid Filter and Handler instances. The > command fails with error "CIM_ERR_INVALID_PARAMETER". > > Looking at the XML output of ei for CIM_IndicationSubscription, I see > the Filter and Handler references have LOCALINSTANCEPATH: > > <INSTANCENAME CLASSNAME="CIM_IndicationSubscription"> > <KEYBINDING NAME="Filter"> > <VALUE.REFERENCE> > <LOCALINSTANCEPATH> <<<--- > <LOCALNAMESPACEPATH> > <NAMESPACE NAME="root" /> > <NAMESPACE NAME="cimv2" /> > </LOCALNAMESPACEPATH> > <INSTANCENAME CLASSNAME="CIM_IndicationFilter"> > > Looking at the XML output of ci, I see wbemcli is sending references > using INSTANCEPATH not LOCALINSTANCEPATH, which I suspect is the issue > (not sure though): > > <INSTANCENAME CLASSNAME="CIM_IndicationSubscription"> > <KEYBINDING NAME="Filter"> > <VALUE.REFERENCE> > <INSTANCEPATH> <<<--- > <NAMESPACEPATH> > <HOST>10.18.10.92</HOST> <<<--- > <LOCALNAMESPACEPATH> > <NAMESPACE NAME="root"></NAMESPACE> > <NAMESPACE NAME="cimv2"></NAMESPACE> > </LOCALNAMESPACEPATH> > </NAMESPACEPATH> > <INSTANCENAME CLASSNAME="CIM_IndicationFilter"> > > Is there a way to change wbemcli ci behavior to use LOCALINSTANCEPATH > instead of the full INSTANCEPATH with HOST portion? > > Many thanks for your assistance. > > Regards, > Sameer > > > > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming The Go Parallel Website, sponsored > by Intel and developed in partnership with Slashdot Media, is your hub for all > things parallel software development, from weekly thought leadership blogs to > news, videos, case studies, tutorials and more. Take a look and join the > conversation now. http://goparallel.sourceforge.net/ > > > _______________________________________________ > Sblim-devel mailing list > Sbl...@li... > https://lists.sourceforge.net/lists/listinfo/sblim-devel |
From: Sameer Z. <sa...@ya...> - 2015-04-14 06:49:59
|
Hi Dave, Thanks very much for the detailed response. Appreciate it. I will look into using the sample programs you mentioned. I have used curl with xml, at the time, to workaround the issue. I wanted to test the syntax you provided below, nevertheless. So I tried it today, and I have to say it's cleaner (and shorter) to omit the key values from the object name and specify them in the properties list only. It worked fine when creating filters and handlers. However, I'm still having an issue, though looks to be a new one now, when creating subscriptions. Below is the command I used and the server response, with XML dump. I can see that with the new syntax wbemcli is correctly using LOCALINSTANCEPATH, but it appears it is now sending the wrong type of CIM request! wbemcli ci -dx -noverify 'http://user:password@10.1.1.1:5989/root/cimv2:CIM_IndicationSubscription.Filter=,Handler=' 'Filter=root/cimv2:CIM_IndicationFilter.CreationClassName="CIM_IndicationFilter",SystemCreationClassName="CIM_ComputerSystem",SystemName="mysystem",Name="TEST",Handler=root/cimv2:CIM_IndicationHandlerCIMXML.CreationClassName="CIM_IndicationHandlerCIMXML",SystemCreationClassName="CIM_ComputerSystem",SystemName="mysystem",Name="TEST"'To server: <?xml version="1.0" encoding="utf-8" ?> <CIM CIMVERSION="2.0" DTDVERSION="2.0"> <MESSAGE ID="4711" PROTOCOLVERSION="1.0"><SIMPLEREQ><IMETHODCALL NAME="GetClass"> <LOCALNAMESPACEPATH> <NAMESPACE NAME="root"/> <NAMESPACE NAME="cimv2"/> </LOCALNAMESPACEPATH> <IPARAMVALUE NAME="ClassName"><CLASSNAME NAME="CIM_IndicationSubscription"/></IPARAMVALUE> <IPARAMVALUE NAME="LocalOnly"><VALUE>FALSE</VALUE></IPARAMVALUE> <IPARAMVALUE NAME="IncludeQualifiers"><VALUE>TRUE</VALUE></IPARAMVALUE> <IPARAMVALUE NAME="IncludeClassOrigin"><VALUE>TRUE</VALUE></IPARAMVALUE> </IMETHODCALL></SIMPLEREQ> </MESSAGE></CIM>* * wbemcli: Http Exception: Server returned nothing (no headers, no data) * Regards,Sameer |
From: Dave H. <hel...@li...> - 2015-04-14 17:52:41
|
No, that's normal. wbemcli often does a GetClass as a precursor to other queries. It uses the output to form other queries: checking for qualifiers, validating parameter types and such. And to just make sure the class exist, if nothing else. cimcli does the same sort of thing. And the XML of the gc looks good, so I'm not sure why it's failing. Must be some problem server-side. What happens if you just: $ wbemcli gc http://localhost/root/interop:CIM_IndicationSubscription One thing I noticed: you are looking for your classes in root/cimv2 where normally these classes are registered in root/interop. I think it *can* be done this way (as long as the classes are indeed registered in the other namespace), although I've never tried it. If that were the only problem you'd just get "not found" for the gc, not the error you're seeing. But maybe the namespace has something to do with it. Dave On 04/14/2015 02:49 AM, Sameer Zeidat wrote: > Hi Dave, > > Thanks very much for the detailed response. Appreciate it. > > I will look into using the sample programs you mentioned. I have used > curl with xml, at the time, to workaround the issue. > > I wanted to test the syntax you provided below, nevertheless. So I > tried it today, and I have to say it's cleaner (and shorter) to omit > the key values from the object name and specify them in the properties > list only. It worked fine when creating filters and handlers. > > However, I'm still having an issue, though looks to be a new one now, > when creating subscriptions. Below is the command I used and the > server response, with XML dump. I can see that with the new syntax > wbemcli is correctly using LOCALINSTANCEPATH, but it appears it is now > sending the wrong type of CIM request! > > wbemcli ci -dx -noverify > 'http://user:password@10.1.1.1:5989/root/cimv2:CIM_IndicationSubscription.Filter=,Handler=' > 'Filter=root/cimv2:CIM_IndicationFilter.CreationClassName="CIM_IndicationFilter",SystemCreationClassName="CIM_ComputerSystem",SystemName="mysystem",Name="TEST",Handler=root/cimv2:CIM_IndicationHandlerCIMXML.CreationClassName="CIM_IndicationHandlerCIMXML",SystemCreationClassName="CIM_ComputerSystem",SystemName="mysystem",Name="TEST"' > To server: <?xml version="1.0" encoding="utf-8" ?> > <CIM CIMVERSION="2.0" DTDVERSION="2.0"> > <MESSAGE ID="4711" PROTOCOLVERSION="1.0"><SIMPLEREQ><IMETHODCALL > NAME="GetClass"> > <LOCALNAMESPACEPATH> > <NAMESPACE NAME="root"/> > <NAMESPACE NAME="cimv2"/> > </LOCALNAMESPACEPATH> > <IPARAMVALUE NAME="ClassName"><CLASSNAME > NAME="CIM_IndicationSubscription"/></IPARAMVALUE> > <IPARAMVALUE NAME="LocalOnly"><VALUE>FALSE</VALUE></IPARAMVALUE> > <IPARAMVALUE NAME="IncludeQualifiers"><VALUE>TRUE</VALUE></IPARAMVALUE> > <IPARAMVALUE NAME="IncludeClassOrigin"><VALUE>TRUE</VALUE></IPARAMVALUE> > </IMETHODCALL></SIMPLEREQ> > </MESSAGE></CIM> > * > * wbemcli: Http Exception: Server returned nothing (no headers, no data) > * > > Regards, > Sameer > |
From: Sameer Z. <sa...@ya...> - 2015-04-15 12:26:10
|
Thanks. I'll look into the namespace possibility. Regards, Sameer -----Original Message----- From: "Dave Heller" <hel...@li...> Sent: 15/04/2015 3:53 AM To: "sbl...@li..." <sbl...@li...> Subject: Re: [Sblim-devel] wbemcli issue creating instance references No, that's normal. wbemcli often does a GetClass as a precursor to other queries. It uses the output to form other queries: checking for qualifiers, validating parameter types and such. And to just make sure the class exist, if nothing else. cimcli does the same sort of thing. And the XML of the gc looks good, so I'm not sure why it's failing. Must be some problem server-side. What happens if you just: $ wbemcli gc http://localhost/root/interop:CIM_IndicationSubscription One thing I noticed: you are looking for your classes in root/cimv2 where normally these classes are registered in root/interop. I think it *can* be done this way (as long as the classes are indeed registered in the other namespace), although I've never tried it. If that were the only problem you'd just get "not found" for the gc, not the error you're seeing. But maybe the namespace has something to do with it. Dave On 04/14/2015 02:49 AM, Sameer Zeidat wrote: Hi Dave, Thanks very much for the detailed response. Appreciate it. I will look into using the sample programs you mentioned. I have used curl with xml, at the time, to workaround the issue. I wanted to test the syntax you provided below, nevertheless. So I tried it today, and I have to say it's cleaner (and shorter) to omit the key values from the object name and specify them in the properties list only. It worked fine when creating filters and handlers. However, I'm still having an issue, though looks to be a new one now, when creating subscriptions. Below is the command I used and the server response, with XML dump. I can see that with the new syntax wbemcli is correctly using LOCALINSTANCEPATH, but it appears it is now sending the wrong type of CIM request! wbemcli ci -dx -noverify 'http://user:password@10.1.1.1:5989/root/cimv2:CIM_IndicationSubscription.Filter=,Handler=' 'Filter=root/cimv2:CIM_IndicationFilter.CreationClassName="CIM_IndicationFilter",SystemCreationClassName="CIM_ComputerSystem",SystemName="mysystem",Name="TEST",Handler=root/cimv2:CIM_IndicationHandlerCIMXML.CreationClassName="CIM_IndicationHandlerCIMXML",SystemCreationClassName="CIM_ComputerSystem",SystemName="mysystem",Name="TEST"' To server: <?xml version="1.0" encoding="utf-8" ?> <CIM CIMVERSION="2.0" DTDVERSION="2.0"> <MESSAGE ID="4711" PROTOCOLVERSION="1.0"><SIMPLEREQ><IMETHODCALL NAME="GetClass"> <LOCALNAMESPACEPATH> <NAMESPACE NAME="root"/> <NAMESPACE NAME="cimv2"/> </LOCALNAMESPACEPATH> <IPARAMVALUE NAME="ClassName"><CLASSNAME NAME="CIM_IndicationSubscription"/></IPARAMVALUE> <IPARAMVALUE NAME="LocalOnly"><VALUE>FALSE</VALUE></IPARAMVALUE> <IPARAMVALUE NAME="IncludeQualifiers"><VALUE>TRUE</VALUE></IPARAMVALUE> <IPARAMVALUE NAME="IncludeClassOrigin"><VALUE>TRUE</VALUE></IPARAMVALUE> </IMETHODCALL></SIMPLEREQ> </MESSAGE></CIM> * * wbemcli: Http Exception: Server returned nothing (no headers, no data) * Regards, Sameer |