ducky.config module

VM configuration management

class ducky.config.MachineConfig(*args, **kwargs)[source]

Bases: ConfigParser.ConfigParser

Contains configuration of the whole VM, and provides methods for parsing, inspection and extending this configuration.

_MachineConfig__count(prefix)
_MachineConfig__count_breakpoints()
_MachineConfig__count_devices()
_MachineConfig__count_mmaps()
_MachineConfig__sections_with_prefix(prefix)
_boolean_states = {'1': True, 'on': True, 'false': False, '0': False, 'off': False, 'yes': True, 'no': False, 'true': True}
add_breakpoint(core, address, active=None, flip=None, ephemeral=None, countdown=None)[source]
add_device(klass, driver, **kwargs)[source]

Add another device to the configuration.

Parameters:
  • klass (string) – class of the device (klass option).
  • driver (string) – device driver - dot-separated path to class (driver option).
  • kwargs – all keyword arguments will be added to the section as device options.
add_mmap(filepath, address, size, offset=None, access=None, shared=None)[source]
add_storage(driver, sid, filepath=None)[source]

Add another storage to the configuration.

Parameters:
  • driver (string) – storage’s driver - dot-separated path to class (driver option).
  • sid (int) – storage’s SID (sid options).
  • filepath (string) – path to backend file, if there’s any (filepath option).
create_getters(section)[source]
dumps()[source]
get(section, option, default=None, **kwargs)[source]

Get value for an option.

Parameters:
  • section (string) – config section.
  • option (string) – option name,
  • default – this value will be returned, if no such option exists.
Return type:

string

Returns:

value of config option.

getbool(section, option, default=None)[source]
getfloat(section, option, default=None)[source]
getint(section, option, default=None)[source]
iter_breakpoints()[source]
iter_devices()[source]
iter_mmaps()[source]
iter_storages()[source]
read(*args, **kwargs)[source]
set(section, option, value, *args, **kwargs)[source]
ducky.config.bool2option(b)[source]

Get config-file-usable string representation of boolean value.

Parameters:b (bool) – value to convert.
Return type:string
Returns:yes if input is True, no otherwise.