nfstest.host (3) - Linux Manuals
nfstest.host: Host module
NAME
nfstest.host - Host moduleDESCRIPTION
Provides a set of tools for running commands on the local host or a remote host, including a mechanism for running commands in the background. It provides methods for mounting and unmounting from an NFS server and a mechanism to simulate a network partition via the use of 'iptables'. Currently, there is no mechanism to restore the iptables rules to their original state.
CLASSES
class Host(baseobj.BaseObj)
Host object Host() -> New Host object Usage: from nfstest.host import Host # Create host object for local host x = Host() # Create host object for remote host y = Host(host='192.168.0.11') # Run command to the local host x.run_cmd("ls -l") # Send command to the remote host and run it as root y.run_cmd("ls -l", sudo=True) # Run command in the background x.run_cmd("tcpdump", sudo=True, wait=False) .... .... # Stop command running in the background x.stop_cmd() # Mount volume using default options x.mount() # Unmount volume x.umount() Methods defined here: --------------------- __del__(self) Destructor Gracefully unmount volume and reset network. __init__(self, **kwargs) Constructor Initialize object's private data.
- host:
- Hostname or IP address [default: localhost]
- user:
- User to log in to host [default: '']
- server:
- NFS server name or IP address [default: None]
- nfsversion:
- NFS version [default: 4.1]
- proto:
- NFS protocol name [default: 'tcp']
- port:
- NFS server port [default: 2049]
- sec:
- Security flavor [default: 'sys']
- export:
- Exported file system to mount [default: '/']
- mtpoint:
- Mount point [default: '/mnt/t']
- datadir:
- Data directory where files are created [default: '']
- mtopts:
- Mount options [default: 'hard,rsize=4096,wsize=4096']
- interface:
- Network device interface [default: 'eth0']
- nomount:
- Debug option so the server is not actually mounted [default: False]
- iptables:
- Iptables command [default: '/usr/sbin/iptables']
- sudo:
- Sudo command [default: '/usr/bin/sudo']
- server:
- NFS server name or IP address [default: self.server]
- nfsversion:
- NFS version [default: self.nfsversion]
- proto:
- NFS protocol name [default: self.proto]
- port:
- NFS server port [default: self.port]
- sec:
- Security flavor [default: self.sec]
- export:
- Exported file system to mount [default: self.export]
- mtpoint:
- Mount point [default: self.mtpoint]
- datadir:
- Data directory where files are created [default: self.datadir]
- mtopts:
- Mount options [default: self.mtopts]
- Return the mount point.
- version:
- NFS version, default is the object attribute nfsversion
- version:
- NFS version, default is the object attribute nfsversion
- cmd:
- Command to execute
- sudo:
- Run command using sudo if option is True
- dlevel:
- Debug level for displaying the command to the user
- msg:
- Prefix this message to the debug message to be displayed
- wait:
- Wait for command to complete before returning
- Return the standard output of the command and the return code or exit status is stored in the object attribute 'self.returncode'.
- process:
- The object for the process of the command to terminate, or terminate all commands started by run_cmd() if this option is not given
- dlevel:
- Debug level for displaying the command to the user, default is the level given by run_cmd()
- msg:
- Prefix this message to the debug message to be displayed
- Return the exit status of the last command
- process:
- The object for the process of the command to wait for, or wait for all commands started by run_cmd() if this option is not given
- terminate:
- If True, send a signal to terminate the command or commands and then wait for all commands to finish
- dlevel:
- Debug level for displaying the command to the user, default is the level given by run_cmd()
- msg:
- Prefix this message to the debug message to be displayed
- Return the exit status of the last command
BUGS
No known bugs.AUTHOR
Jorge Mora (mora [at] netapp.com)