Table of Contents

Class: Machine pyVC/Machine.py

This object defines a Real machine

Base Classes   
object
Methods   
__init__
__repr__
__str__
_do_tests
_get_hostname
_get_networks
_get_platform
_get_pyvc_interfaces
_get_qemu_version
_get_sudo
_get_used_interfaces
_get_version
_handle_error
add_interface
add_network
check_errors
check_platform
kill
popen
refresh
remove_interface
tap
term
term_connect
term_serve
term_socket
wait
  __init__ 
__init__ (
        self,
        hostname=None,
        check=True,
        fix=False,
        )

  __repr__ 
__repr__ ( self )

  __str__ 
__str__ ( self )

  _do_tests 
_do_tests ( self )

Performs a series of checks on a real machine

  _get_hostname 
_get_hostname ( self )

Returns self.__hostname

  _get_networks 
_get_networks ( self )

Returns self.__networks

  _get_platform 
_get_platform ( self )

Returns self.__platform

  _get_pyvc_interfaces 
_get_pyvc_interfaces ( self )

Returns self.__pyvc_interfaces__

  _get_qemu_version 
_get_qemu_version ( self )

Returns the version of qemu installed at config['qemu']['qemu_executable']

  _get_sudo 
_get_sudo ( self )

Returns self.__sudo

  _get_used_interfaces 
_get_used_interfaces ( self )

Returns self.__used_interfaces__

  _get_version 
_get_version ( self )

Returns self.__version

  _handle_error 
_handle_error ( self,  error )

Exceptions   
MachineError, ( 'ERROR: /dev/net/tun not found. \n \ Run "cd /dev; sh MAKEDEV tun" as root.', 'notundev', self.hostname )
MachineError, ( 'ERROR: /dev/net/tun not writable. \n \ Run "chmod 666 /dev/net/tun" as root.', 'notun', self.hostname )
MachineError, ( 'ERROR: dhcpd not found. \n \ Please install dhcpd as root or modify the path in pyVC.ini', 'no_dhcpd_executable', self.hostname )
MachineError, ( 'ERROR: ifconfig not found. \n \ Please install ifconfig as root or modify the path in pyVC.ini' 'no_ifconfig_executable', self.hostname )
MachineError, ( 'ERROR: iptables not found. \n \ Please install iptables as root or modify the path in pyVC.ini', 'no_iptables_executable', self.hostname )
MachineError, ( 'ERROR: module tun not found. \n \ Run "modprobe tun" as root.', 'notunmod', self.hostname )
MachineError, ( 'ERROR: qemu libs not found. \n \ Please install qemu libs as root or modify the path in pyVC.ini', 'no_qemu_lib_path', self.hostname )
MachineError, ( 'ERROR: qemu not found. \n \ Please install qemu as root or modify the path in pyVC.ini', 'no_qemu_executable', self.hostname )
MachineError, ( 'ERROR: sudo not configured correctly. \n \ Make sure sudo can operate commands as root without asking for a password', 'nosudo', self.hostname )
MachineError, ( 'ERROR: vde_switch not found. \n \ Please vde_switch dhcpd as root or modify the path in pyVC.ini', 'no_vde_switch_executable', self.hostname )
MachineError, ( 'ERROR: vdeq not found. \n \ Please install vdeq as root or modify the path in pyVC.ini', 'no_vdeq_executable', self.hostname )
  add_interface 
add_interface ( self,  newif )

Adds an interface string to self.__pyvc_interfaces

  add_network 
add_network ( self,  newnet )

Adds a network object to self.__networks__

Exceptions   
TypeError, 'Got %s for first argument to add_network,\ expected subclass of %s' %( type( newnet ), Network )
  check_errors 
check_errors ( self,  errors )

See if any error conditions in errors exist on a machine

  check_platform 
check_platform ( self,  platforms )

See if any error conditions in errors exist on a machine

Exceptions   
MachineError, ( 'ERROR: platform %s not supported for this object' %( self.platform ), 'platform', self.hostname )
  kill 
kill (
        self,
        pid,
        signal,
        )

Kills a command on the machine

Exceptions   
ValueError, "ERROR: No process corresponding to pid %d on %s" %( pid, self.hostname )
  popen 
popen ( self,  command )

Executes a command on the machine

  refresh 
refresh ( self )

Update the error conditions on a machine

  remove_interface 
remove_interface ( self,  oldif )

Removes an interface from self.__used_interfaces__

  tap 
tap ( self )

Returns an interface string from the available interfaces

Exceptions   
MachineError, ( 'ERROR: out of tap interfaces. \n', 'noipfw', self.__hostname )
  term 
term ( self,  command )

Executes a command inside a terminal on the machine

  term_connect 
term_connect ( self,  pid )

Opens a connection for a term

Exceptions   
ValueError, "ERROR: No process corresponding to pid %d on %s" %( pid, self.hostname )
  term_serve 
term_serve ( self,  pid )

Enter connection serving loop for a term

Exceptions   
ValueError, "ERROR: No process corresponding to pid %d on %s" %( pid, self.hostname )
  term_socket 
term_socket ( self,  pid )

Opens a connection socket for a term

Exceptions   
ValueError, "ERROR: No process corresponding to pid %d on %s" %( pid, self.hostname )
  wait 
wait ( self,  pid )

Waits for a process to finish on the machine

Exceptions   
ValueError, "ERROR: No process corresponding to pid %d on %s" %( pid, self.hostname )

Table of Contents

This document was automatically generated on Thu Jan 18 11:28:09 2007 by HappyDoc version 2.1