lib.cuckoo.common.abstracts.LibVirtMachinery

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

# Class LibVirtMachinery

source code

    object --+
             |
     Machinery --+
                 |
                LibVirtMachinery

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
initialize(self, module) Initialize machine manager module. | source code
_initialize_check(self) Runs all checks when a machine manager is initialized. | source code
start(self, label, task) Starts a virtual machine. | source code
stop(self, label) Stops a virtual machine. | source code
shutdown(self) Override shutdown to free libvirt handlers - they print errors. | source code
dump_memory(self, label, path) Takes a memory dump. | source code
_status(self, label) Gets current status of a vm. | 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
_lookup(self, label) Search for a virtual machine. | source code
_list(self) List available virtual machines. | source code
_version_check(self) Check if libvirt release supports snapshots. | source code
_get_snapshot(self, label) Get current snapshot for virtual machine | source code
Inherited from `Machinery`: `acquire`, `availables`, `machines`, `pcap_path`, `release`, `running`, `set_options`, `set_status` Inherited from `Machinery` (private): `_get_resultserver_port`, `_initialize`, `_wait_status` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables | [hide private]
| RUNNING = `"running"`
| PAUSED = `"paused"`
| POWEROFF = `"poweroff"`
| ERROR = `"machete"`
| ABORTED = `"abort"`
Inherited from `Machinery`: `LABEL`

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)

### initialize(self, module) | source code
Initialize machine manager module. Override default to set proper connection string. Parameters: `module` - machine manager module Overrides: Machinery.initialize

### _initialize_check(self) | source code
Runs all checks when a machine manager is initialized. Raises: `CuckooMachineError` - if libvirt version is not supported. Overrides: Machinery._initialize_check

### start(self, label, task) | source code
Starts a virtual machine. Parameters: `label` - virtual machine name. `task` - task object. Raises: `CuckooMachineError` - if unable to start virtual machine. Overrides: Machinery.start

### stop(self, label) | source code
Stops a virtual machine. Kill them all. Parameters: `label` - virtual machine name. Raises: `CuckooMachineError` - if unable to stop virtual machine. Overrides: Machinery.stop

### shutdown(self) | source code
Override shutdown to free libvirt handlers - they print errors. Raises: `CuckooMachineError` - if unable to stop machine. Overrides: Machinery.shutdown

### 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

### _status(self, label) | source code
Gets current status of a vm. Parameters: `label` - virtual machine name. Returns: status string.

### _connect(self) | source code
Connects to libvirt subsystem. Raises: `CuckooMachineError` - when unable to connect to libvirt.

### _disconnect(self, conn) | source code
Disconnects to libvirt subsystem. Raises: `CuckooMachineError` - if cannot disconnect from libvirt.

### _fetch_machines(self) | source code
Fetch machines handlers. Returns: dict with machine label as key and handle as value.

### _lookup(self, label) | source code
Search for a virtual machine. Parameters: `conn` - libvirt connection handle. `label` - virtual machine name. Raises: `CuckooMachineError` - if virtual machine is not found.

### _list(self) | source code
List available virtual machines. Raises: `CuckooMachineError` - if unable to list virtual machines. Overrides: Machinery._list

### _version_check(self) | source code
Check if libvirt release supports snapshots. Returns: True or false.

### _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