virttest.remote_commander package¶
Submodules¶
virttest.remote_commander.messenger module¶
Created on Dec 6, 2013
| author: | jzupka |
|---|
-
class
virttest.remote_commander.messenger.DataWrapper[source]¶ Bases:
objectBasic implementation of IOWrapper for stdio.
-
class
virttest.remote_commander.messenger.DataWrapperBase64[source]¶ Bases:
virttest.remote_commander.messenger.DataWrapperBasic implementation of IOWrapper for stdio.
-
class
virttest.remote_commander.messenger.IOWrapper(obj)[source]¶ Bases:
objectClass encaptulates io opearation to be more consist in different implementations. (stdio, sockets, etc..)
-
fileno()[source]¶ Function should return file descriptor number. If object should be used for standard io operation.
Returns: File number.
-
read(max_len, timeout=None)[source]¶ Read function should be reinmplemented as blocking reading from data source when timeout is None and nonblocking for timeout is not None. Implementation example StdIWrapper.
Params max_len: Max len of readed data. Parameters: timeout (float) – Timeout of reading operation. Returns: Readed data.
-
-
class
virttest.remote_commander.messenger.Messenger(stdin, stdout)[source]¶ Bases:
objectClass could be used for communication between two python process connected by communication canal wrapped by IOWrapper class. Pickling is used for communication and thus it is possible to communicate every picleable object.
-
format_msg(data)[source]¶ Format message where first 10 char is length of message and rest is piclked message.
-
-
exception
virttest.remote_commander.messenger.MessengerError(msg)[source]¶ Bases:
exceptions.Exception
-
class
virttest.remote_commander.messenger.StdIOWrapper(obj)[source]¶ Bases:
virttest.remote_commander.messenger.IOWrapper,virttest.remote_commander.messenger.DataWrapperBasic implementation of IOWrapper for stdio.
-
class
virttest.remote_commander.messenger.StdIOWrapperIn(obj)[source]¶ Bases:
virttest.remote_commander.messenger.StdIOWrapperBasic implementation of IOWrapper for stdin
-
class
virttest.remote_commander.messenger.StdIOWrapperInBase64(obj)[source]¶ Bases:
virttest.remote_commander.messenger.StdIOWrapperIn,virttest.remote_commander.messenger.DataWrapperBase64Basic implementation of IOWrapper for stdin
-
class
virttest.remote_commander.messenger.StdIOWrapperOut(obj)[source]¶ Bases:
virttest.remote_commander.messenger.StdIOWrapperBasic implementation of IOWrapper for stdout
-
class
virttest.remote_commander.messenger.StdIOWrapperOutBase64(obj)[source]¶ Bases:
virttest.remote_commander.messenger.StdIOWrapperOut,virttest.remote_commander.messenger.DataWrapperBase64Basic implementation of IOWrapper for stdout
virttest.remote_commander.remote_interface module¶
Created on Dec 11, 2013
| author: | jzupka |
|---|
-
class
virttest.remote_commander.remote_interface.BaseCmd(func_cmd, *args, **kargs)[source]¶ Bases:
virttest.remote_commander.remote_interface.CmdMessageClass used for moveing information about commands between master and slave.
-
args¶
-
cmd_hash¶
-
func¶
-
kargs¶
-
nh_stderr¶
-
nh_stdin¶
-
nh_stdout¶
-
results¶
-
single_cmd_id= 0¶
-
-
class
virttest.remote_commander.remote_interface.CmdMessage(cmd_id)[source]¶ Bases:
objectBase cmd message class
-
cmd_id¶
-
-
exception
virttest.remote_commander.remote_interface.CmdTraceBack(msg)[source]¶ Bases:
exceptions.ExceptionRepresent back-trace used for error tracing on remote side.
-
exception
virttest.remote_commander.remote_interface.CommanderError(msg)[source]¶ Bases:
virttest.remote_commander.remote_interface.MessengerErrorRepresent error in Commnader
-
exception
virttest.remote_commander.remote_interface.MessengerError(msg)[source]¶ Bases:
exceptions.ExceptionRepresented error in messanger.
-
class
virttest.remote_commander.remote_interface.StdErr(msg, cmd_id=None)[source]¶ Bases:
virttest.remote_commander.remote_interface.StdStreamRepresent message from stderr string data from remote client
-
class
virttest.remote_commander.remote_interface.StdOut(msg, cmd_id=None)[source]¶ Bases:
virttest.remote_commander.remote_interface.StdStreamRepresent message from stdout string data from remote client
-
class
virttest.remote_commander.remote_interface.StdStream(msg, cmd_id=None)[source]¶ Bases:
virttest.remote_commander.remote_interface.CmdMessageRepresent message string data from remote client
-
msg¶
-
virttest.remote_commander.remote_master module¶
Created on Dec 6, 2013
| author: | jzupka |
|---|
-
class
virttest.remote_commander.remote_master.CmdEncapsulation(master, obj_name, name)[source]¶ Bases:
objectClass parse command name cmd.nohup.shell -> [“nohup”, “shell”]
-
class
virttest.remote_commander.remote_master.CmdMaster(commander, name, *args, **kargs)[source]¶ Bases:
objectRepresentation of BaseCmd on master side.
-
basecmd¶ Property basecmd getter
-
set_commander(commander)[source]¶ For nohup commands it allows connect cmd to new created commander.
-
setbasecmd(value)[source]¶ Property basecmd setter _resuls_cnt identify if value was change from last reading.
-
setstderr(value)[source]¶ Property stderr setter _stderr_cnt identify if value was change from last reading.
-
setstdout(value)[source]¶ Property stdout setter _stdout_cnt identify if value was change from last reading.
-
stderr¶ Property stderr getter
-
stdout¶ Property stdout getter
-
-
exception
virttest.remote_commander.remote_master.CmdTimeout(msg)[source]¶ Bases:
virttest.remote_commander.remote_interface.MessengerErrorRaised when waiting for cmd exceeds time define by timeout.
-
class
virttest.remote_commander.remote_master.Commander[source]¶ Bases:
objectCommander representation for transfer over network.
-
class
virttest.remote_commander.remote_master.CommanderMaster(stdin, stdout, debug=False)[source]¶ Bases:
virttest.remote_commander.messenger.MessengerClass commander master is responsible for communication with commander slave. It invoke commands to slave part and receive messages from them. For communication is used only stdin and stdout which are streams from slave part.
virttest.remote_commander.remote_runner module¶
Created on Dec 6, 2013
| author: | jzupka |
|---|
-
class
virttest.remote_commander.remote_runner.CmdFinish(parent=False)[source]¶ Bases:
objectClass used for communication with child process. This class
-
pid¶
-
-
class
virttest.remote_commander.remote_runner.CmdSlave(baseCmd)[source]¶ Bases:
objectRepresentation of BaseCmd on slave side.
-
class
virttest.remote_commander.remote_runner.CommanderSlave(stdin, stdout, o_stdout, o_stderr)[source]¶ Bases:
virttest.remote_commander.messenger.MessengerClass commander slace is responsible for communication with commander master. It invoke commands to slave part and receive messages from them. For communication is used only stdin and stdout which are streams from slave part.
-
class
virttest.remote_commander.remote_runner.CommanderSlaveCmds(stdin, stdout, o_stdout, o_stderr)[source]¶ Bases:
virttest.remote_commander.remote_runner.CommanderSlaveClass extends CommanderSlave and adds to them special commands like shell process, interactive python, send_msg to cmd.
-
add_function(f_code)[source]¶ Adds function to client code.
Parameters: f_code (str.) – Code of function.
-
copy_file(name, path, content)[source]¶ Really naive implementation of copping files. Should be used only for short files.
-
register_cmd(basecmd, basecmd_cmd_id)[source]¶ Second side of set_commander cmd from master. It register existing cmd to CommandSlave dict.
Parameters:
-
-
virttest.remote_commander.remote_runner.close_unused_fds(fds)[source]¶ Close all file descriptors which are not necessary anymore.
Parameters: fds (list []) – file descriptors
-
virttest.remote_commander.remote_runner.create_process_cmd()[source]¶ Create child process without clean process data thanks that it is possible call function and classes from child process.
-
virttest.remote_commander.remote_runner.daemonize(pipe_root_path='/tmp')[source]¶ Init daemon.
Parameters: pipe_root_path – path to directory for pipe. Returns: [True if child, stdin_path, stdou_path, stderr_path]
-
virttest.remote_commander.remote_runner.gen_tmp_dir(root_path)[source]¶ Try to create tmp dir with special name.
-
virttest.remote_commander.remote_runner.remote_agent(in_stream_cls, out_stream_cls)[source]¶ Connect file descriptors to right pipe and start slave command loop. When something happend it raise exception which could be caught by cmd master.
Params in_stream_cls: Class encapsulated input stream. Params out_stream_cls: Class encapsulated output stream.