Script import_export
[hide private]
[frames] | no frames]

Script import_export

Import/export daemon.

Classes [hide private]
  StatusFile
Status file manager.
  ChildProcess
Functions [hide private]
 
SetupLogging()
Configures the logging module.
 
ProcessChildIO(child, socat_stderr_read_fd, dd_stderr_read_fd, dd_pid_read_fd, exp_size_read_fd, status_file, child_logger, signal_notify, signal_handler, mode)
Handles the child processes' output.
 
ParseOptions()
Parses the options passed to the program.
tuple of (bool, int)
_RunWithTimeout(cmd, timeout, silent=False)
Runs a command, killing it if a timeout was reached.
 
VerifyOptions()
Performs various runtime checks to make sure the options are valid.
 
main()
Main function.
Variables [hide private]
  MAX_RECENT_OUTPUT_LINES = 20
How many lines to keep in the status file
  MIN_UPDATE_INTERVAL = 5.0
Don't update status file more than once every 5 seconds (unless forced)
  DEFAULT_CONNECT_TIMEOUT = 60
How long to wait for a connection to be established
  DD_STATISTICS_INTERVAL = 5.0
Get dd(1) statistics every few seconds
  DD_THROUGHPUT_INTERVAL = 60.0
Seconds for throughput calculation
  DD_THROUGHPUT_SAMPLES = int(math.ceil(float(DD_THROUGHPUT_INTE...
Number of samples for throughput calculation
  options = None
hash(x)
  PROGRAM_NOT_FOUND_RCODE = 127
  CHECK_SWITCH = "-h"

Imports: errno, logging, optparse, os, select, signal, subprocess, sys, time, math, constants, cli, utils, errors, serializer, objects, impexpd, netutils


Function Details [hide private]

ParseOptions()

 

Parses the options passed to the program.

Returns:
Arguments to program

_RunWithTimeout(cmd, timeout, silent=False)

 

Runs a command, killing it if a timeout was reached.

Uses the alarm signal, not thread-safe. Waits regardless of whether the command exited early.

Parameters:
  • timeout (number) - Timeout, in seconds
  • silent (Boolean) - Whether command output should be suppressed
Returns: tuple of (bool, int)
Whether the command timed out, and the return code

Variables Details [hide private]

DD_THROUGHPUT_SAMPLES

Number of samples for throughput calculation

Value:
int(math.ceil(float(DD_THROUGHPUT_INTERVAL)/ DD_STATISTICS_INTERVAL))