]> git.proxmox.com Git - qemu-server.git/commit - PVE/QemuServer/Memory.pm
refactor: create QemuServer::Monitor for high-level QMP access
authorStefan Reiter <s.reiter@proxmox.com>
Tue, 19 Nov 2019 11:23:47 +0000 (12:23 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 20 Nov 2019 15:29:23 +0000 (16:29 +0100)
commit0a13e08ec2549d9f05377b53635c1f973b2afac2
treed83d288322fe304015257353bd858103c17e0e10
parentbabf613a08108bd6509104a8ff92691e6192f174
refactor: create QemuServer::Monitor for high-level QMP access

QMP and monitor helpers are moved from QemuServer.pm.

By using only vm_running_locally instead of check_running, a cyclic
dependency to QemuConfig is avoided. This also means that the $nocheck
parameter serves no more purpose, and has thus been removed along with
vm_mon_cmd_nocheck.

Care has been taken to avoid errors resulting from this, and
occasionally a manual check for a VM's existance inserted on the
callsite.

Methods have been renamed to avoid redundant naming:
* vm_qmp_command -> qmp_cmd
* vm_mon_cmd -> mon_cmd
* vm_human_monitor_command -> hmp_cmd

mon_cmd is exported since it has many users. This patch also changes all
non-package users of vm_qmp_command to use the mon_cmd helper. Includes
mocking for tests.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
12 files changed:
PVE/API2/Qemu.pm
PVE/API2/Qemu/Agent.pm
PVE/CLI/qm.pm
PVE/QemuConfig.pm
PVE/QemuMigrate.pm
PVE/QemuServer.pm
PVE/QemuServer/Agent.pm
PVE/QemuServer/Makefile
PVE/QemuServer/Memory.pm
PVE/QemuServer/Monitor.pm [new file with mode: 0644]
PVE/VZDump/QemuServer.pm
test/snapshot-test.pm