]> git.proxmox.com Git - qemu-server.git/blob - PVE/QemuServer/QMPHelpers.pm
schema: fix description of migrate_downtime parameter
[qemu-server.git] / PVE / QemuServer / QMPHelpers.pm
1 package PVE::QemuServer::QMPHelpers;
2
3 use warnings;
4 use strict;
5
6 use PVE::QemuServer::Monitor qw(mon_cmd);
7
8 use base 'Exporter';
9
10 our @EXPORT_OK = qw(
11 qemu_deviceadd
12 qemu_devicedel
13 qemu_objectadd
14 qemu_objectdel
15 );
16
17 sub qemu_deviceadd {
18 my ($vmid, $devicefull) = @_;
19
20 $devicefull = "driver=".$devicefull;
21 my %options = split(/[=,]/, $devicefull);
22
23 mon_cmd($vmid, "device_add" , %options);
24 }
25
26 sub qemu_devicedel {
27 my ($vmid, $deviceid) = @_;
28
29 my $ret = mon_cmd($vmid, "device_del", id => $deviceid);
30 }
31
32 sub qemu_objectadd {
33 my ($vmid, $objectid, $qomtype) = @_;
34
35 mon_cmd($vmid, "object-add", id => $objectid, "qom-type" => $qomtype);
36
37 return 1;
38 }
39
40 sub qemu_objectdel {
41 my ($vmid, $objectid) = @_;
42
43 mon_cmd($vmid, "object-del", id => $objectid);
44
45 return 1;
46 }
47
48 1;