Connection to the QEMU Monitor using the QEMU Monitor Protocol (QMP).
Method | __enter__ |
Undocumented |
Method | __exit__ |
Undocumented |
Method | __init__ |
Undocumented |
Method |
|
Check if disk hotplug is possible |
Method |
|
Check if NIC hotplug is possible |
Method | connect |
Connects to the QMP monitor. |
Method |
|
Continue the previously paused guest |
Method | execute |
Undocumented |
Method |
|
Retrieve CPU/thread information uses the query-cpus-fast which does not interrupt the guest |
Method |
|
Get the first available PCI slot of a running instance. |
Method |
|
Retrieve the current migration status |
Method |
|
Return the QMP/qemu version field |
Method |
|
Check if a specific device exists or not on a running instance. |
Method |
|
Check if QEMU uses dynamic auto-read-only for block devices |
Method |
|
Hot-add a disk |
Method |
|
Hot-add a NIC |
Method |
|
Hot-del a Disk |
Method |
|
Hot-del a NIC |
Method |
|
Undocumented |
Method |
|
Notify the guest about a disk change. |
Method |
|
Undocumented |
Method |
|
Configure live migration capabilities |
Method |
|
Configute live migration parameters |
Method |
|
Set Spice password of an instance |
Method |
|
Set VNC password of an instance |
Method |
|
Start migration of an instance |
Method |
|
Start postcopy-ram migration |
Method |
|
Pause the running guest |
Constant | ACTUAL |
Undocumented |
Instance Variable | package |
Undocumented |
Instance Variable | supported |
Undocumented |
Instance Variable | version |
Undocumented |
Method | _ |
Wrapper around add-fd qmp command |
Method | _filter |
Filter non valid keys of the device's hvinfo (if any). |
Method | _ |
Get the block devices of a running instance. |
Method | _ |
Wrapper around the getfd qmp command |
Method | _ |
Get the devices of the first PCI bus of a running instance. |
Method | _ |
Update the list of supported commands. |
Method | _ |
Check if a specific device ID exists among block devices. |
Method | _ |
Check if a specific device ID exists on the PCI bus. |
Method | _ |
Wrapper around remove-fd qmp command |
Constant | _ACTUAL |
Undocumented |
Constant | _CAPABILITIES |
Undocumented |
Constant | _DEVICE |
Undocumented |
Constant | _FIRST |
Undocumented |
Constant | _MESSAGE |
Undocumented |
Constant | _PACKAGE |
Undocumented |
Constant | _QEMU |
Undocumented |
Constant | _QMP |
Undocumented |
Constant | _QUERY |
Undocumented |
Constant | _RETURN |
Undocumented |
Constant | _VERSION |
Undocumented |
Instance Variable | _buffer |
Undocumented |
Inherited from QemuMonitorSocket
:
Method | get |
Undocumented |
Method | recv |
Undocumented |
Method | send |
Undocumented |
Method | wait |
Waits for one of the specified events and returns it. If the timeout is reached, returns None. |
Method | _read |
Undocumented |
Constant | _ARGUMENTS |
Undocumented |
Constant | _ERROR |
Undocumented |
Constant | _ERROR |
Undocumented |
Constant | _ERROR |
Undocumented |
Constant | _EVENT |
Undocumented |
Constant | _EXECUTE |
Undocumented |
Constant | _SEND |
Undocumented |
Inherited from UnixFileSocketConnection
(via QemuMonitorSocket
):
Method | close |
Undocumented |
Method | is |
Undocumented |
Method | recv |
Undocumented |
Method | reset |
Reset the timeout to self.timeout |
Method | send |
Undocumented |
Instance Variable | sock |
Undocumented |
Instance Variable | socket |
Undocumented |
Instance Variable | timeout |
Undocumented |
Instance Variable | _connected |
Undocumented |
Check if disk hotplug is possible
Hotplug is *not* supported in case the add-fd and blockdev-add qmp commands are not supported
Check if NIC hotplug is possible
Hotplug is *not* supported in case the getfd and netdev_add qmp commands are not supported
Connects to the QMP monitor.
Connects to the UNIX socket and makes sure that we can actually send and receive data to the kvm instance via QMP.
Raises | |
errors.HypervisorError | when there are communication errors |
errors.ProgrammerError | when there are data serialization errors |
Return the QMP/qemu version field
Accessing the version attribute directly might result in an error since the socket might not be yet connected. This getter method uses the @_ensure_connection decorator to work around this problem.
Check if a specific device exists or not on a running instance.
It first checks the PCI devices and then the block devices.
Check if QEMU uses dynamic auto-read-only for block devices
Use QMP schema introspection (QEMU 2.5+) to check for the dynamic-auto-read-only feature.
def HotAddDisk(self, disk, access_mode, cache_writeback, direct, blockdevice): ¶
Hot-add a disk
def HotAddNic(self, nic, devid, tapfds=None, vhostfds=None, features=None, is_chrooted=False): ¶
Hot-add a NIC
First pass the tapfds, then netdev_add and then device_add
Wrapper around add-fd qmp command
Send fd to a running process via SCM_RIGHTS and then add-fd qmp command to add it to an fdset so that it can be used later by disk hotplugging.
Parameters | |
fd:int | The file descriptor to pass |
Returns | |
The fdset ID that the fd has been added to | |
Raises | |
errors.HypervisorError | If add-fd fails for some reason |
Get the block devices of a running instance.
The query-block QMP command returns a list of dictionaries including information for each virtual disk. For example:
[{"device": "disk-049f140d", "inserted": {"file": ..., "image": ...}}]
Returns | |
list of dicts | Info about the virtual disks of the instance. |
Wrapper around the getfd qmp command
Send an fd to a running process via SCM_RIGHTS and then use the getfd qmp command to name it properly so that it can be used later by NIC hotplugging.
Parameters | |
fd:int | The file descriptor to pass |
fdname | Undocumented |
Raises | |
errors.HypervisorError | If getfd fails for some reason |
Wrapper around remove-fd qmp command
Remove the file descriptor previously passed. After qemu has dup'd the fd (e.g. during disk hotplug), it can be safely removed.