QMF Management Suite for HTCondor
-------------------------------
The Qpid Management Framework (QMF) is a distributed object management framework
that uses Apache Qpid for its transport. It provides code-generation tools to
render native language binding types and objects for C++, Python, and Ruby from
XML schema definitions. That code is then linked to runtime libraries for
client-agent integration mediated by a Qpid broker.

This contribution is a set of pluggable modules plus a daemon that are used
for:
        * start and stop of daemons
        * job submission and control (submit, set attribute, hold, release,
remove)
        * queries of live and historical job data and output files
        * get/set of of stats, priorities and limits from the negotiator
        * collector stats for job counts (running, edle, etc.)
        * submitters stats
        * slot statistics and properties

Currently, this code base has external dependencies on:
        * Apache Qpid 0.8-4
        * Boost C++ libraries (1.39 or higher)

For more information about QMF, please refer to:
https://cwiki.apache.org/qpid/qpid-management-framework.html

Building
--------
This management contrib is enabled by setting -DWANT_CONTRIB:BOOL=ON for cmake
at the root of the src tree. This will generate the necessary platform-specific
build files (e.g., make, Visual Studio solution, etc.) for the management
contrib.

Building on Windows
-------------------
Due to the general lack of DLL support in the HTCondor core libraries,
the management plugins cannot be dynamically loaded on Windows. The cmake files
are already tuned to account for this so that the plugin logic is
statically linked into their respsective daemons (e.g., condor_master,
condor_startd, etc.). There are no additional different or special cmake flags
required.

Broker Setup
------------
The plugins and job server daemon must be connected to a Qpid broker. In HTCondor
this broker is configured by:
 QMF_BROKER_HOST=<hostname/ip>
 QMF_BROKER_PORT=<broker port - internal default is 5672>

The broker needs to be launched with a specified user registered in its ACL
list - "cumin".

Ensure that /etc/sasl2/qpidd.conf is in place with content like:
 pwcheck_method: auxprop
 auxprop_plugin: sasldb
 sasldb_path: /var/lib/qpidd/qpidd.sasldb
 sql_select: dummy select

Add cumin and guest users (for plugins) using:
 $ sudo saslpasswd2 -f /var/lib/qpidd/qpidd.sasldb -u QPID cumin

Run the broker something like this:
 $ sudo qpidd --load-module /usr/lib/qpid/daemon/acl.so --acl-file <your
condor repo>/src/condor_contrib/mgmt/qmf/test/qpidd.acl --auth=yes

This single-user limitation will change in the near future once more fully
realized agent ACL policy enforcement has been implemented in QMF.

Configuring the Plugins on Platforms with Dynamic Loading
---------------------------------------------------------
The management plugins can be configured to be loaded individually or as a
group in a specified directory.

To load the plugins individually, use:
 MASTER.PLUGINS = $(LIBEXEC)/MgmtMasterPlugin-plugin.so
 COLLECTOR.PLUGINS = $(LIBEXEC)/MgmtCollectorPlugin-plugin.so
 NEGOTIATOR.PLUGINS = $(LIBEXEC)/MgmtNegotiatorPlugin-plugin.so
 SCHEDD.PLUGINS = $(LIBEXEC)/MgmtScheddPlugin-plugin.so
 STARTD.PLUGINS = $(LIBEXEC)/MgmtStartdPlugin-plugin.so

To load as a group in a directory, set:
 PLUGIN_DIR=<directory with plugin shared libs>

Usage
-----
The test directory includes some python scripts that make use of the QMF
interface to interact with the plugins and job server. The general pattern is:

 # create a QMF session
 session = Session();
 # add a broker to the session by its URL
 broker = session.addBroker(url)
 # resolve a specific object based on its class and package name
 schedulers = session.getObjects(_class="scheduler", _package="com.redhat.grid")
 # invoke some method on that object
 result = schedulers[0].SubmitJob(ad)

qpid-tool is a QMF utility that can browse the QMF object space and
reveal schemas, instances, properties and statistics.
