This section describes the protocol that must be implemented by the plug-in code to interact with the SSM.
The protocol is ASCII and line-based with the <CR (\n)> character used as the line separator for portability between platforms and programming languages. Note that on Windows, CR='\r''\n' and on Unix (including Linux), CR='\n'.
The protocol implements synchronous communication with the SSM where the SSM initiates the request and the plug-in replies with a response. As a result, the response from any plug-in operation can be success or failure. To distinguish between success or failure, the very first number in any response line is either an error code (non-zero value) or 0 (successful response). An error code is followed by the accompanying error message, such as:
During the initial sequence, the SSM spawns the plug-in process and waits for the first initialization response. The plug-in process, starts up and after finishing its initialization (parameter for the initialization can be passed as command line arguments), replies to standard output on success:
"Status version <error>" , status = 0 for success or non-zero for failure.
where the first number is success code 0 followed by the current protocol version supported by this plug-in (current version 1.0.0.0)
The SSM specifies request commands identified by one character (so protocol can be potentially extended up to 256 commands) followed by command arguments separated by a space character (' '). Currently the SSM provides only one command specified by character 'L' ("Location") followed by a space-separated list of attribute names.
The plug-in process responds to the "Location" command with multiple response lines, one per attribute and in the same attributes order. Each successful response line starts with the success code 0 followed by (separated by space) the cost value and then one or more locations until the <CR>-character.
"Status Cost1 Location1 Cost 2 Location2…CostN LocationN CR"
The following example assumes the values for four attributes are available:
"0 2.0 host2 0.0 host3" for attr2
"0 3.123 host4 7 host5 10000 host6 0 host7" for attr3
The following example assumes the value for attr3 is not available to the plugin:
"0 2.0 host2 0.0 host3" for attr2
"1 Do not have the value" for attr3; this value will be cached and returned in subsequent calls.
The plug-in should be ready at any time to get EOF character or error from standard input (e,g, "broken pipe"), which means a shutdown request from the SSM. In this case, the plug-in process must do appropriate cleanup and exit by itself, as the SSM will never kill the plug-in process.
This section provides sample code for the data-aware scheduling plug-in process. Use the sample code as a template and add the necessary logic to retrieve the host location and transfer cost data from the metadata repositories.