ducky.machine module¶
ducky.machine.Machine is the virtual machine. Each instance
represents self-contained virtual machine, with all its devices, memory, CPUs
and other necessary properties.
-
class
ducky.machine.IRQRouterTask(machine)[source]¶ Bases:
ducky.interfaces.IReactorTaskThis task is responsible for distributing triggered IRQs between CPU cores. When IRQ is triggered, IRQ source (i.e. device that requires attention) is appended to this tasks queue (
ducky.machine.IRQRouterTask.qeueu). As long as this queue is not empty, this task pops IRQ sources, selects free CPU core, and by calling itsducky.cpu.CPUCore.irq()method core takes reponsibility for executing interrupt routine.Parameters: machine (ducky.machine.Machine) – machine this task belongs to.
-
class
ducky.machine.Machine(logger=None, stdin=None, stdout=None, stderr=None)[source]¶ Bases:
ducky.interfaces.ISnapshotable,ducky.interfaces.IMachineWorkerVirtual machine itself.
-
capture_state(suspend=False)[source]¶ Capture current state of the VM, and store it in it’s last_state attribute.
Parameters: suspend (bool) – if True, suspend VM before taking snapshot.
-
core(cid)[source]¶ Find CPU core by its string id.
Parameters: cid (string) – id of searched CPU core, in the form #<cpuid>:#<coreid>. Return type: ducky.cpu.CPUCoreReturns: found core Raises: ducky.errors.InvalidResourceError – when no such core exists.
-
cores¶ Get list of all cores in the machine.
Return type: list Returns: list of ducky.cpu.CPUCoreinstances
-
exit_code¶
-
get_device_by_name(name, klass=None)[source]¶ Get device by its name and class.
Parameters: - name (string) – name of the device.
- klass (string) – if set, search only devices with this class.
Return type: Returns: found device
Raises: ducky.errors.InvalidResourceError – when no such device exists
-
get_storage_by_id(sid)[source]¶ Get storage by its id.
Parameters: sid (int) – id of storage caller is looking for. Return type: ducky.devices.DeviceReturns: found device. Raises: ducky.errors.InvalidResourceError – when no such storage exists.
-
-
class
ducky.machine.MachineState[source]¶ Bases:
ducky.snapshot.SnapshotNode