Package lib :: Package cuckoo :: Package common :: Module abstracts :: Class LibVirtMachinery
[hide private]
[frames] | no frames]

Class LibVirtMachinery

source code

object --+    
         |    
 Machinery --+
             |
            LibVirtMachinery
Known Subclasses:

Libvirt based machine manager.

If you want to write a custom module for a virtualization software supported by libvirt you have just to inherit this machine manager and change the connection string.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_connect(self)
Connects to libvirt subsystem.
source code
 
_disconnect(self, conn)
Disconnects to libvirt subsystem.
source code
 
_fetch_machines(self)
Fetch machines handlers.
source code
 
_get_snapshot(self, label)
Get current snapshot for virtual machine
source code
 
_initialize_check(self)
Runs all checks when a machine manager is initialized.
source code
 
_list(self)
List available virtual machines.
source code
 
_lookup(self, label)
Search for a virtual machine.
source code
 
_status(self, label)
Gets current status of a vm.
source code
 
_version_check(self)
Check if libvirt release supports snapshots.
source code
 
dump_memory(self, label, path)
Takes a memory dump.
source code
 
initialize(self, module)
Initialize machine manager module.
source code
 
shutdown(self)
Override shutdown to free libvirt handlers - they print errors.
source code
 
start(self, label)
Starts a virtual machine.
source code
 
stop(self, label)
Stops a virtual machine.
source code

Inherited from Machinery: acquire, availables, machines, release, running, set_options, set_status

Inherited from Machinery (private): _initialize, _wait_status

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  ABORTED = 'abort'
  ERROR = 'machete'
  PAUSED = 'paused'
  POWEROFF = 'poweroff'
  RUNNING = 'running'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

_connect(self)

source code 

Connects to libvirt subsystem.

Raises:

_disconnect(self, conn)

source code 

Disconnects to libvirt subsystem.

Raises:

_fetch_machines(self)

source code 

Fetch machines handlers.

Returns:
dict with machine label as key and handle as value.

_get_snapshot(self, label)

source code 

Get current snapshot for virtual machine

Parameters:
  • label - virtual machine name @return None or current snapshot
Raises:
  • CuckooMachineError - if cannot find current snapshot or when there are too many snapshots available

_initialize_check(self)

source code 

Runs all checks when a machine manager is initialized.

Raises:
Overrides: Machinery._initialize_check

_list(self)

source code 

List available virtual machines.

Raises:
Overrides: Machinery._list

_lookup(self, label)

source code 

Search for a virtual machine.

Parameters:
  • conn - libvirt connection handle.
  • label - virtual machine name.
Raises:

_status(self, label)

source code 

Gets current status of a vm.

Parameters:
  • label - virtual machine name.
Returns:
status string.

_version_check(self)

source code 

Check if libvirt release supports snapshots.

Returns:
True or false.

dump_memory(self, label, path)

source code 

Takes a memory dump.

Parameters:
  • path - path to where to store the memory dump.
Overrides: Machinery.dump_memory

initialize(self, module)

source code 

Initialize machine manager module. Override default to set proper connection string.

Parameters:
  • module - machine manager module
Overrides: Machinery.initialize

shutdown(self)

source code 

Override shutdown to free libvirt handlers - they print errors.

Raises:
Overrides: Machinery.shutdown

start(self, label)

source code 

Starts a virtual machine.

Parameters:
  • label - virtual machine name.
Raises:
Overrides: Machinery.start

stop(self, label)

source code 

Stops a virtual machine. Kill them all.

Parameters:
  • label - virtual machine name.
Raises:
Overrides: Machinery.stop