Amidxtaped protocol: Difference between revisions

From wiki.zmanda.com
Jump to navigation Jump to search
(→‎Control Connection: amidxtaped sucks even more when run from inetd)
(→‎Control Connection: CONNECT for inetd mode)
Line 39: Line 39:
  DEVICE=/A/p/hold\:ing/20100205181319/euclid._A_p_etc.1:0
  DEVICE=/A/p/hold\:ing/20100205181319/euclid._A_p_etc.1:0
(note that the <tt>:</tt> in the holding pathname is quoted)
(note that the <tt>:</tt> in the holding pathname is quoted)
If amidxtaped is run directly from inetd, then it needs to set up the data connection at this point.  To do so, it sends a CONNECT line to its stdout
CONNECT 1234\n
Note that there is no <tt>\r</tt> in this particular message.


If amidxtaped has a message for the user, it sends a MESSAGE line on the control connection:
If amidxtaped has a message for the user, it sends a MESSAGE line on the control connection:
Line 50: Line 54:
Finally, if amidxtaped has the ''fe_amrecover_feedme_tape'' feature, then it expects a TAPE response, specifying either the same device as used in the original request, or a new device:
Finally, if amidxtaped has the ''fe_amrecover_feedme_tape'' feature, then it expects a TAPE response, specifying either the same device as used in the original request, or a new device:
  TAPE tape:/dev/nrst0\r\n
  TAPE tape:/dev/nrst0\r\n
indicating that amidxtaped should use the given device.


If amidxtaped wants to indicate the datapath it is using, it can send a DATA-PATH message:
If amidxtaped wants to indicate the datapath it is using, it can send a DATA-PATH message:

Revision as of 01:45, 6 February 2010

This page picks up where Amandad Service Protocol leaves off. Amidxtaped sends exactly one dump in response to a set of parameters on its control stream. To get another dump, start a new amidxtaped.

REQ

An amidxtaped REQ packet looks like:

SERVICE amidxtaped
OPTIONS features=''features'';auth=''auth'';

All of the interesting specification of which data to send comes on the control connection, below.

REP

Amidxtaped sets up two streams in its REP packet:

CONNECT CTL ctlfd DATA datafd

the control connection is bidirectional, while the data connection only carries data from amidxtaped.

Control Connection

Note that when amidxtaped is started directly from inetd, the main socket becomes the control connection after the SECURITY line.

The control connection is a set of specifier lines, followed by an "END" line. All lines are terminated by "\r\n". Are you still asking why? Accept the insanity.

Not all specifiers must be given in any particular request. The available specifiers are:

LABEL=label
not a label, but a Tapelist Specification giving the files to be recovered
FSF=fsf
seek to this file before starting the recovery (ignored)
HEADER
prefix the data with an Amanda header (DISK_BLOCK_BYTES long)
FEATURES=features
reiterates the requester's feature-set (in case amidxtaped was started from inetd). When run from amandad, amidxtaped will immediately respond with the equivalent line giving its own features. When run from inetd, amidxtaped will respond with its features only, with no terminating newline of any sort.
DEVICE=device
tape device (or changer) to restore from
HOST=host
host match expression for this dump
DISK=disk
diskname match expression for this dump
DATESTAMP=datestamp
datestamp for this dump
CONFIG=config
Amanda configuration to use

the list of specifiers is terminated by

END\r\n

or by any line that starts with a digit (.. good, you didn't ask why -- you're learning!). Any non-matchting lines will be ignored. Any lines after the terminating line are also ignored. Amrecover sends an invalid DATA-PATH specifier after END, presumably to illustrate this point.

When the requested dump is on a holding disk, then LABEL is omitted, and DEVICE specifies the holding file in Tapelist Specification format -- that is, with a :0 suffix, e.g.,

DEVICE=/A/p/hold\:ing/20100205181319/euclid._A_p_etc.1:0

(note that the : in the holding pathname is quoted)

If amidxtaped is run directly from inetd, then it needs to set up the data connection at this point. To do so, it sends a CONNECT line to its stdout

CONNECT 1234\n

Note that there is no \r in this particular message.

If amidxtaped has a message for the user, it sends a MESSAGE line on the control connection:

MESSAGE I like green eggs and ham.\r\n

If it needs the user to feed a particular volume, it sends a FEEDME line:

FEEDME DailySet1-013\r\n

Labels longer than 132 bytes are not currently supported. If the volume is not available (the user cancels), amidxtaped expects an ERROR response:

ERROR\r\n

Otherwise, if amidxtaped does not have the fe_amrecover_feedme_tape feature, then it expects an OK response and does not support trying some other device:

OK\r\n

Finally, if amidxtaped has the fe_amrecover_feedme_tape feature, then it expects a TAPE response, specifying either the same device as used in the original request, or a new device:

TAPE tape:/dev/nrst0\r\n

indicating that amidxtaped should use the given device.

If amidxtaped wants to indicate the datapath it is using, it can send a DATA-PATH message:

DATA-PATH AMNADA\r\n

or

DATA-PATH DIRECT-TCP\r\n

note the unusual use of a dash in the latter message. This is currently unsupported by amidxtaped, but amrecover supports it.

Once data is available, it starts flowing on the data connection. Note that, in the case of a split dump, MESSAGE or FEEDME lines may come after a significant quantity of dta has been transferred.