On Tue, May 17, 2011 at 4:54 PM, Steven Dake sdake@redhat.com wrote:
On 05/13/2011 12:52 AM, Andrew Beekhof wrote:
This is the schema patch I'm thinking about applying. Basically I'm evolving my idea of a basic (Resources) and advanced (Services) API.
Actually I had this reversed.
The basic one is as simple as possible - just call and response for a well limited set of known actions on system services.
If you want recurring operations (and therefor a user_data field), sequence numbers, OCF support, the ability to call random actions, etc
- then you should be using the more advanced Services API.
Comments?
I like this idea quite a bit - allows us to theoretically only include the resources API in assemblies rather then all of the APIs for those cost conscience of space/memory. Because of the costs of VM memory and storage, minimizing memory/disk usage at the highest scaled component (the assembly) in a cloud environment is helpful.
None of this follows from the changes I proposed. Both classes exist within a single agent/daemon and including one vs. both is a difference of about one hundred lines of C++.
Regards -steve
diff --git a/GNUmakefile b/GNUmakefile index 7b27df5..b6921ec 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -39,7 +39,7 @@ DOT:=$(shell which dot 2>/dev/null) linux.build: @echo "=::=::=::= Setting up for Linux =::=::=::= " mkdir -p $@
- cd $@ && eval "`rpm --eval "%{cmake}" | grep -v -e "^%"`"
-DCMAKE_BUILD_TYPE=RelWithDebInfo ..
- cd $@ && eval "`rpm --eval "%{cmake}" | grep -v -e "^%"`"
-DWITH-DBUS=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo .. @$(MAKE) --no-print-dir -C $@
windows.build: diff --git a/src/service/schema.xml b/src/service/schema.xml index feefb91..dd9f209 100644 --- a/src/service/schema.xml +++ b/src/service/schema.xml @@ -3,27 +3,31 @@ <eventArguments>
<!-- Common -->
- <arg name="timestamp" type="absTime" />
- <arg name="sequence" type="uint32" />
- <arg name="timestamp" type="absTime" />
- <arg name="sequence_id" type="uint32" />
- <arg name="name" type="sstr" />
- <arg name="action" type="sstr" />
- <arg name="interval" type="uint32" />
- <arg name="rc" type="uint32" />
- <arg name="name" type="sstr" />
- <arg name="action" type="sstr" />
- <arg name="interval" type="uint32"/>
- <arg name="rc" type="uint32" />
- <arg name="rsc_type" type="sstr" />
- <arg name="rsc_class" type="sstr" />
- <arg name="rsc_provider" type="sstr" />
- <!-- Specific to Resources API -->
- <arg name="class" type="sstr" />
- <arg name="provider" type="sstr" />
- <arg name="type" type="sstr" />
- <arg name="expected_rc" type="uint32" />
- <arg name="user_data" type="sstr" />
</eventArguments>
<!-- Services API -->
- <!--
- Services API
- Simple API for accessing system services
- For more advanced functionality, use the Resources API with class=LSB
- -->
<!-- Is sequence needed? How to tie to the async method call seq? -->
<!-- Is timestamp needed? Possibly available for all events already -->
- <event name="service_op" args="name,action,interval,rc,sequence,timestamp" />
- <event name="resource_op" args="name,action,interval,rc,sequence,timestamp,rsc_type,rsc_class,rsc_provider"
/>
- <event name="service_op" args="timestamp,sequence_id,name,action,interval,rc"
/>
- <event name="resource_op" args="timestamp,sequence_id,name,action,interval,rc,type,class,provider,expected_rc,user_data"
/>
<class name="Services"> <property name="uuid" type="sstr" access="RO" desc="Host UUID" /> @@ -41,28 +45,22 @@ <arg name="name" dir="I" type="sstr" /> </method> <method name="start" desc="Start a system service">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="name" dir="I" type="sstr" />
<arg name="timeout" dir="I" type="uint32" /> <arg name="rc" dir="O" type="uint32" /> </method> <method name="stop" desc="Stop a system service">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="name" dir="I" type="sstr" />
<arg name="timeout" dir="I" type="uint32" /> <arg name="rc" dir="O" type="uint32" /> </method> <method name="status" desc="Check the health of a system service">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="interval" dir="IO" type="uint32" />
- <arg name="name" dir="I" type="sstr" />
<arg name="timeout" dir="I" type="uint32" /> <arg name="rc" dir="O" type="uint32" /> </method>
- <method name="cancel" desc="Cancel a pending or running
action on a system service">
- <arg name="name" dir="I" type="sstr" />
- <arg name="action" dir="I" type="sstr" />
- <arg name="interval" dir="I" type="uint32" />
- </method>
<method name="fail" desc="Raise a failure event for a system service">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="name" dir="I" type="sstr" />
</method> <method name="describe" desc="Obtain XML description of a system service"> <arg name="name" dir="I" type="sstr" /> @@ -70,20 +68,33 @@ </method> </class>
- <!--
- Resources API
- Fully featured API for controlling and monitoring services
- conforming a standardized specification.
- Currently supported standards: LSB, OCF
- On Windows, 'LSB' is an alias for system services
- -->
<class name="Resources"> <property name="uuid" type="sstr" access="RO" desc="Host UUID" />
- <property name="hostname" type="sstr" access="RO"
desc="Hostname" index="y"/>
- <property name="hostname" type="sstr" access="RO"
desc="Hostname" index="y"/>
<method name="list_classes" desc="List known resource classes (OCF, LSB, Upstart, etc)"> <arg name="classes" dir="O" type="list" /> </method>
- <method name="list_ocf_providers" desc="List known OCF providers
(if supported)">
- <method name="list_providers" desc="List known providers (if
supported) for a given class">
- <arg name="class" dir="I" type="sstr" />
<arg name="providers" dir="O" type="list" /> </method>
- <method name="list" desc="List known resource types for a
given provider">
- <method name="list" desc="List known resource types for a
given class and provider">
- <arg name="class" dir="I" type="sstr" />
<arg name="provider" dir="I" type="sstr" /> <arg name="types" dir="O" type="list" /> </method>
<!-- Something we can add later if necessary method name="list_variants" desc="List known implementations of a given resource type"> <arg name="type" dir="I" type="sstr" /> @@ -97,66 +108,41 @@ <arg name="type" dir="I" type="sstr" /> <arg name="xml" dir="O" type="sstr" /> </method>
- <method name="start" desc="Start a resource">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="class" dir="IO" type="sstr" />
- <arg name="provider" dir="IO" type="sstr" />
- <arg name="type" dir="IO" type="sstr" />
- <arg name="parameters" dir="I" type="map" />
- <arg name="timeout" dir="I" type="uint32" />
- <arg name="rc" dir="O" type="uint32" />
- </method>
- <method name="stop" desc="Stop a resource">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="class" dir="IO" type="sstr" />
- <arg name="provider" dir="IO" type="sstr" />
- <arg name="type" dir="IO" type="sstr" />
- <arg name="parameters" dir="I" type="map" />
- <arg name="timeout" dir="I" type="uint32" />
- <arg name="rc" dir="O" type="uint32" />
- </method>
- <method name="monitor" desc="Check the health of a resource">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="class" dir="IO" type="sstr" />
- <arg name="provider" dir="IO" type="sstr" />
- <arg name="type" dir="IO" type="sstr" />
- <arg name="interval" dir="IO" type="uint32" />
- <arg name="parameters" dir="I" type="map" />
- <arg name="timeout" dir="I" type="uint32" />
- <arg name="rc" dir="O" type="uint32" />
- </method>
<method name="invoke" desc="Perform a custom action on a resource">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="class" dir="IO" type="sstr" />
- <arg name="provider" dir="IO" type="sstr" />
- <arg name="type" dir="IO" type="sstr" />
- <arg name="action" dir="IO" type="sstr" />
- <arg name="interval" dir="IO" type="uint32" />
- <arg name="name" dir="I" type="sstr" />
- <arg name="class" dir="I" type="sstr" />
- <arg name="provider" dir="I" type="sstr" />
- <arg name="type" dir="I" type="sstr" />
- <arg name="action" dir="I" type="sstr" />
- <arg name="interval" dir="I" type="uint32" />
<arg name="parameters" dir="I" type="map" /> <arg name="timeout" dir="I" type="uint32" />
- <arg name="expected_rc" dir="I" type="uint32" />
<arg name="rc" dir="O" type="uint32" />
- <arg name="sequence_id" dir="O" type="uint32" />
- <arg name="user_data" dir="IO" type="sstr" />
</method> <method name="cancel" desc="Cancel a pending or running action on a resource">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="class" dir="IO" type="sstr" />
- <arg name="provider" dir="IO" type="sstr" />
- <arg name="type" dir="IO" type="sstr" />
- <arg name="action" dir="IO" type="sstr" />
- <arg name="interval" dir="IO" type="uint32" />
- <arg name="name" dir="I" type="sstr" />
- <arg name="class" dir="I" type="sstr" />
- <arg name="provider" dir="I" type="sstr" />
- <arg name="type" dir="I" type="sstr" />
- <arg name="action" dir="I" type="sstr" />
- <arg name="interval" dir="I" type="uint32" />
<arg name="timeout" dir="I" type="uint32" /> </method> <method name="fail" desc="Indicate a resource has failed">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="class" dir="IO" type="sstr" />
- <arg name="provider" dir="IO" type="sstr" />
- <arg name="type" dir="IO" type="sstr" />
- <arg name="name" dir="I" type="sstr" />
- <arg name="class" dir="I" type="sstr" />
- <arg name="provider" dir="I" type="sstr" />
- <arg name="type" dir="I" type="sstr" />
</method> <!-- Something we can add later if necessary method name="last" desc="Retrieve the last action for a resource">
- <arg name="name" dir="IO" type="sstr" />
- <arg name="class" dir="IO" type="sstr" />
- <arg name="provider" dir="IO" type="sstr" />
- <arg name="type" dir="IO" type="sstr" />
- <arg name="name" dir="I" type="sstr" />
- <arg name="class" dir="I" type="sstr" />
- <arg name="provider" dir="I" type="sstr" />
- <arg name="type" dir="I" type="sstr" />
<arg name="action" dir="O" type="sstr" /> <arg name="parameters" dir="O" type="map" /> <arg name="interval" dir="O" type="uint32" /> _______________________________________________ Matahari mailing list Matahari@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/matahari