Driver-Taper protocol

From wiki.zmanda.com
Revision as of 12:19, 17 October 2006 by Martineau (talk | contribs)
Jump to navigation Jump to search

Communication method

driver talks via two pipes connected to taper's stdin and stdout. The commands and responses are plain text.

Command sequence during backup operation

  • driver initialises taper with: START-TAPER <timestamp> to which taper replies with: TAPE-OK or, for fatal errors, with: TAPE-ERROR [<message>]
  • driver will ask the taper to start a new tape with the NEW-TAPE command.
  • driver can ask taper to copy a file from the holding disk to tape (FILE-WRITE) or directly from a dumper (PORT-WRITE) or exit at the end of the run (QUIT).
  • taper responds to the PORT-WRITE command with: PORT <port> which driver should then hand on to dumper in a PORT-DUMP command.
  • If the copy to tape finishes correctly taper replies with DONE.
  • If something goes wrong with the tape, taper can ask to continue on a new tape SPLIT-NEEDNEXT (for splited dump only) or it can abort that dump with PARTIAL or FAILED reply
  • After any dump that finished in PARTIAL or FAILED with a TAPE-ERROR, the driver must send a NEW-TAPE before issuing another *-WRITE command.

Other commands

  • If driver says something that taper doesn't recognise it responds with: BAD-COMMAND <message>
  • taper responds to the QUIT command with: QUITING

Protocol command reference

Taper command reply

Reply Description
TAPE-OK taper is setup correctly
TAPE-ERROR Error in setup of the driver
PORT Reply sent in response to PORT-WRITE command
DONE Full dump is on the media
PARTIAL Dump was partially written to the media.
FAILED Nothing was written to the media
SPLIT-CONTINUE A complete part is written to tape
SPLIT-NEEDNEXT Ask driver if it should continue on a new tape
NEW-TAPE Will continue on a new found tape
NO-NEW-TAPE Will not continue on a new tape


DONE/PARTIAL and FAILED reply also contains an INPUT-* an TAPE-* message to denote any error:

Reply Description
INPUT-GOOD There was no error with the input.
INPUT-ERROR There was error with the input.
Reply Description
TAPE-GOOD This tape can be use to write another dump.
TAPE-ERROR Nothing more can fit on that tape.

A result for a successful dump should be: DONE INPUT-GOOD TAPE-GOOD

Driver/Taper Requests/Replies

Driver request Taper reply Description
initail setup
START-TAPER --->
<--- TAPE-OK normal taper setup (a tape is available, nothing is written on it)
<--- TAPE-ERROR failed taper setup (no tape are available or something else is broken)
ask for new tape
NEW-TAPE ---> driver tell the taper to use a new tape
<--- GOT-NEW-TAPE taper found one
<--- NO-NEW-TAPE no tape are available
file-write setup
FILE-WRITE --->
Will get one part-result for each part written and one global result
port-write setup
PORT-WRITE --->
<--- PORT
Will continue with one part-result for each part written and one global result
global-result
<--- DONE INPUT-GOOD TAPE-GOOD normal protocol for a success
<--- PARTIAL INPUT-* TAPE-* protocol for error in data phase (something written to tape)
<--- FAILED INPUT-* TAPE-* protocol for error in setup (before something is written to tape)
part-result
<--- PARTDONE successfully part written to tape
<--- SPLIT-NEEDNEXT We get a tape error, ask the driver if we can use a new tape (driver will send a NEW-TAPE or NO-NEW-TAPE command)
no new tape
NO-NEW-TAPE ---> driver doesn't want the taper to use a new tape (continue with global-result)
quit
QUIT --->
<--- QUITING

Command/reply arguments

Protocol data

data description
<timestamp> Time as "yymmdd" of "yymmddhhmmss"
<handle> Request ID
<filename> Name of file on the holding disk where backup will be written to
<port> Taper port to send the backup data to
<host> Hostname of the client
<disk> Disk on the client being backed up
<level> Dump level being used for backup
splitsize size of each part on tape
split_diskbuffer file use to buffer a complete part
<message> Error or Status message

driver command

  • START-TAPER timestamp
  • PORT-WRITE handle hostname diskname level datestamp splitsize split_diskbuffer
  • FILE-WRITE handle filename hostname diskname level datestamp splitsize
  • DONE handle (result from dumper send to taper)
  • FAILED handle (result from dumper send to taper)
  • NEW-TAPE
  • NO-NEW-TAPE
  • QUIT

taper reply

  • TAPER-OK
  • TAPER-ERROR "error-message"
  • PARTIAL handle INPUT-* TAPE-* "[sec %f kb %d kps %f]" "input-error-message" "tape-error-message"
  • DONE handle INPUT-GOOD TAPE-GOOD "[sec %f kb %d kps %f]" "" ""
  • FAILED handle INPUT-* TAPE-* "input-error-message" "tape-error-message"
  • NEW-TAPE label
  • NO-NEW-TAPE
  • PARTDONE handle label fileno "[sec %f kb %d kps %f]"
  • SPLIT-NEEDNEXT handle size
  • QUITTING
  • BAD-COMMAND "error message"


LOG

  • One PART or PARTPARTIAL log line for all part written to tape. It tell the location and status of each part.
    • PART taper label fileno hostname diskname timestamp part-number level [sec %f kb %d kps %f]
    • PARTPARTIAL taper label fileno hostname diskname timestamp part-number level [sec %f kb %d kps %f] "error message"
  • One DONE/PARTIAL/FAILED for each dump. It tell the status of the complete dump.
    • DONE taper hostname diskname timestamp level [sec %f kb %d kps %f]
    • PARTIAL taper hostname diskname timestamp level [sec %f kb %d kps %f] "error message"
    • FAILED taper hostname diskname timestamp level "error message"