This chapter provides programmers with an introduction to the OpenVault languages for controlling removable media drives, and includes the following sections:
Section 5.1 describes the language in which the MLM server sends directives to a DCP, and responds to requests sent by a DCP.
Section 5.2, tells how a DCP sends configuration and status to the MLM server, and responds to directives from the MLM server.
The following sections describe the abstract drive interface (ADI), including objects, object attributes, naming conventions, and the ADI command repertoire.
ADI is a language that provides an abstraction of removable media drives managed by OpenVault. ADI hides details of the underlying drive and control without compromising the ability of OpenVault as a whole to manage its resources efficiently.
The ADI language manipulates the following objects:
Access method instance | The instantiation of a drive access method--the implementation of a particular set of capabilities that describe a mode of access to the drive; this is equivalent to a UNIX device special file or dev node. | |
Command | ADI commands become objects as far as ADI is concerned. When the MLM server sends an ADI command, it associates a task ID with that command. The sender may refer to that command later by using the same task ID, but only to cancel the command. When a DCP receives a command, it includes the task ID in command responses. | |
Drive | A place where a cartridge may be mounted and its media loaded for read/write access. For a conceptual view, see Figure 5-1. | |
Drive control program (DCP) | Each DCP manages the configuration of drives, and performs drive control tasks associated with mount and unmount requests from OpenVault client applications. The main purposes of a DCP are to expose drive configuration to the MLM server, and to control drives that have an OpenVault accessible control interface. See Chapter 6, “Programming a Drive Control Program (DCP)”, for a tutorial on DCP programming. | |
Partition | A region on the cartridge media that has a physically marked beginning and end, both of which the drive recognizes. |
The most important object managed by a DCP is the drive, which has the following traits:
OpenVault requires a DCP to maintain drive configuration attributes and notify the MLM server when they change. DCPs use the ADI/R config and ready commands to do this. These commands send attributes back to the MLM server, where configuration information is kept in the MLM server persistent store. It is potentially recoverable by the DCP using the ADI/R show command. Here are the required configuration attributes:
DCP ready state (Section B.3 in Appendix B)
Drive capability configuration (Section 6.5.1 in Chapter 6)
Additional drive attributes (Section 6.5.6 in Chapter 6)
![]() | Note: Currently, OpenVault does not support recovery of any attribute or property information stored in the MLM server persistent store by a DCP. However, this will be supported in a future version of OpenVault, and developers will be encouraged to use it. |
ADI expresses DCP attributes using the tuple:
object type, object nameattribute name |
Table 5-1. Mandatory DCP Attributes
Object Type | Object Name | Attribute Name | Command |
---|---|---|---|
DCP | "" | Name | ADI show |
DCP | "" | loglevel | ADI show, ADI attribute set |
These names refer to specific ADI objects:
Attribute naming in ADI is different from that for CAPI and AAPI, in which an attribute is named with TableName.ColumnName; attributes are just columns in a relational table. In ADI and ADI/R, attributes are named with a tuple:
objectType, objectName, attrName |
The MLM server speaks ADI to the DCP, which in turn speaks ADI/R to the MLM server. The ADI language includes the following commands:
activate | Starts and stops the DCP and drive interactions. Once the DCP has established a session with the MLM server with a hello-welcome sequence, it may begin accepting ADI commands from the server. However, until it has successfully been activate enabled by the server, and is in ready state, it should resend ready lost state and fail any ADI commands that require drive access, with an ADI_E_READY error. The DCP should issue one of the ready command variations when it finishes processing the activate request. activate is supported for all drives managed by OpenVault, but is not an implemented operation for drives that lack an OpenVault control interface. Note that activate may require the DCP to have access to a drive data path, in addition to a control path; otherwise, it may be not an implemented operation. | ||
attach | Selects the appropriate logical instance of a drive according to the access mode specified by the MLM server. Attach instantiates this access method as needed, and binds an opaque drive handle to the logical instance (on UNIX systems, this means linking to a device node). The drive handle must be unique on the DCP host, and may be generated by the DCP, or specified by the MLM server. The DCP returns an error if it detects that the drive handle is already in use on the local host. Generally, the MLM server invokes attach as part of drive selection for a CAPI mount, after loading. This command is supported for all drives managed by OpenVault, but is not an implemented operation for drives that lack a data path. In the case of partitioned drives (such as two-sided optical disc units), the drive handle that is created may be dependent on the partition. For example, most disks on UNIX systems have the partition to be accessed encoded in the drive handle (the device node). The loaded media is positioned to the specified partition. Partition names may be defined; see Section 6.5 in Chapter 6, for a list of partition names. Typically, drives have a shared control and data path. In this case, the drive handle that is passed back to the MLM server is ultimately passed back to an OpenVault client application. The application uses the drive handle to establish access to the drive control/data path. The attach command allows the MLM server to change drive access mode multiple times, without changing any names from the client application's perspective. However, the application must reestablish access after each attach for the change to affect the application. The MLM server ensures that drive access mode is consistent with drive capabilities. | ||
attribute | Provides an attribute, a mechanism by which information that is not contained in normal configuration data passed to the MLM server can be accessed. Examples include data that is unique to a drive type, or data that varies over time. Attributes may read/write or read-only. If the attributes represent internal information or settings associated with the drive itself, the DCP sends corresponding requests to the drive, then returns that information. See Section 5.1.4. | ||
cancel | Attempts to stop execution of a command sent to the DCP. The DCP is free to continue the execution of the command if the command has proceeded too far to cancel.
| ||
detach | Removes the logical instance as necessary, and the binding created by an attach command (on UNIX systems, this means unlinking a device node associated with the device). The detach command invalidates the drive handle created by a previous attach command. For drives with a shared control and data path, this disables a client application from establishing access to drive control and data paths through this handle. Generally, the MLM server invokes this command as part of drive deselection for a CAPI unmount, before unloading. This command is supported for all drives managed by OpenVault, but is not an implemented operation for drives that lack a data path. The MLM server and the DCP should try to ensure that applications do not continue to access drive control or data through a drive handle that has been invalidated by detach. Note that detach and attach may have no immediate impact on an application that was already accessing the drive control and data paths. Once the application has established its access, it may proceed to access the drive control and data paths, without being affected by subsequent invocations of attach and detach. A case in point is with random access media and UNIX applications that perform an open (read/write) and close system call sequence in which the drive handle is passed by the application as an argument only to open(). In this case, the effects of the attach or detach command may occur only during the open() call. The detach and attach commands may have no effect on any reads and writes that are made between open and close. | ||
exit | Tells the DCP to store any persistent DCP and drive information to the MLM server, complete or cancel pending ADI commands, complete or abort pending drive operations, do shutdown processing as required, send ready lost and goodbye commands to the MLM server, and exit. | ||
goodbye | Tells the communicating DCP to end this session. | ||
load | Moves the cartridge (if a cartridge is present at the drive mount point) to the media access point, and engages it, making it accessible at the media access point. The drive is then called loaded. Minimally, load verifies that the drive is loaded. This command does not identify which media is engaged. It is invoked by the MLM server as part of a CAPI mount request. Normally, the ALI mount command associated with the CAPI mount loads the drive (the library causes the load to occur), so DCP load needs to verify only that the drive is loaded. This command is supported for all drives managed by OpenVault, but is not an implemented operation for drives that lack an OpenVault control interface. | ||
reset | Tells the DCP to force the drive to reinitialize. This may also cause the drive to execute self-diagnostics. This is a best-effort type of command. If it is possible to reset a drive only by resetting the whole SCSI bus, thereby interrupting other transfers on that bus, the DCP is free to treat this command as not an implemented operation. If reset is a prolonged drive activity, the DCP should send a ready not command to indicate that its drive is temporarily not available, followed by a ready command when the drive becomes available again. | ||
response | Acknowledges and indicates success or failure of an ADI/R command. The optional text portion of the response contains error details or command results. | ||
show | Is the attribute query mechanism. Note that show commands that query information directly from a drive may require that a DCP have access to a data path with the drive, and otherwise may return an error. See Section 5.1.4. | ||
unload | Disengages the media from a loaded drive, returns it to the cartridge as necessary, and returns the cartridge to the drive mount point. The drive is said to be unloaded at this point. This command rewinds media before disengaging, as necessary. It is invoked by the MLM server as part of a CAPI unmount. Minimally, it detects whether the drive is already unloaded. This command is supported for all drives managed by OpenVault, but is not an implemented operation for drives that lack an OpenVault control interface. The ADI/R response is responsible for returning drive usage and error statistics as transmitted on pages 2 through 5 of the SCSI log:
|
There is no barrier command in ADI; OpenVault assumes that ADI commands are executed serially by the DCP and its drive.
The following sections describe the ADI response language (ADI/R), including objects, object attributes, naming conventions, and the ADI/R command repertoire.
ADI/R is primarily the response language for ADI. In addition to giving the matching acknowledgment and final response to an ADI command, ADI/R provides the means for a DCP to send its configuration and status to the MLM server.
The ADI/R language manipulates the following objects:
Currently, ADI/R attributes are not supported by OpenVault, except for attributes stored by the ADI/R config and ready commands in the MLM server persistent store. Currently, OpenVault supports only setting and unsetting of these attributes. See Section 5.1.4.
These names refer to specific ADI/R objects:
The DCP reads ADI commands from the MLM server, and replies to the server in ADI/R. The ADI/R language includes the following commands:
attribute | With an attribute command, the DCP stores persistent state in the OpenVault database. | ||||||||
cancel | Tells the MLM server to prevent execution of a particular command, if possible.
| ||||||||
config | Tells the MLM server what access modes are supported, with the form factors, media formats, and performance characteristics for each. The config command copies configuration information, such as the capabilities of a drive, from the DCP to the MLM server. The MLM server stores a nonauthoritative copy of all such information for all the DCPs it controls. Each DCP must use the config command to update configuration information whenever it changes. The config command is shorthand for sending attributes about a drive to the MLM server. See Section 5.1.4, and Section 6.5 in Chapter 6, for more information. In a full scope, all information associated with the DCP should be deleted and replaced with the information listed by config. By contrast, in a partial scope, only the pieces of information about the DCP that are listed by config should be replaced. Normally, full scope is used only at startup time, or when making major changes to drive configuration. The config command gives the MLM server a list of access modes that the drive offers. Each mode has a name and additional characteristics:
| ||||||||
goodbye | Tells the MLM server to end this session and clean up its end of the session. This protects against the accumulation of idle connections, since the MLM server has no way of detecting that a DCP exited other than the TCP/IP keepalive option. keepalive helps recover from process failures, but a DCP should send a goodbye before exiting to prevent unnecessary continuation of connection resources. | ||||||||
message | Provides a method for the DCP to send a message to the operator or to a log file. It contains a list of uninterpreted character strings. | ||||||||
ready | With a ready command, the DCP informs the MLM server about the current status of its drive connection. Like the config command, the ready command is shorthand for sending drive attributes to the MLM server. These are variations of the ready command:
See Section B.3 in Appendix B, for more detailed information. | ||||||||
response | Acknowledges and indicates success or failure of an ADI command. The optional text portion of the response contains error details or command results. | ||||||||
show | With a show command, the DCP queries persistent state it has stored in the OpenVault database. |
For some ADI commands, the matching ADI/R response command for a successful response contains a text portion, which must have a particular format. This section describes the required format.
The text portion of a successful response to a show command depends on the specified mode for the show, and on the number of attributes to be queried. There are three possible modes:
ADI_show_name | Shows name only. | |
ADI_show_value | Shows value only. | |
ADI_show_namevalue | Show name and value, in that order. |
For each attribute to be queried, the text portion of the response includes name-value information, as dictated by this mode, and is ordered according to the specified attribute list. So, for example, if a show command requested a query of DCP loglevel and vendor attributes, with mode ADIR_show_namevalue, the corresponding text portion of the response would look something like this:
text[ 'loglevel' 'debug' 'vendor' 'EXABYTE' ] |
The text portion of a success response for an ADI attach command includes the value drive-handle. Suppose an attach caused the drive handle /tmp/mlm/handleXXX to be bound to the instantiation of a drive access method. The corresponding text portion of the response would look something like this:
text[ '/tmp/mlm/handleXXX' ] |