]> git.proxmox.com Git - qemu-server.git/blobdiff - PVE/API2/Qemu.pm
Make agent a property string, add fstrim_cloned_disks
[qemu-server.git] / PVE / API2 / Qemu.pm
index 614f23914c9e22a05b4ee0c6b00de751c9b5e148..464ba7f8d2edc4fa6f778a18e1fd47238cc8deb8 100644 (file)
@@ -365,52 +365,7 @@ __PACKAGE__->register_method({
        type => 'array',
        items => {
            type => "object",
-           properties => {
-               vmid => get_standard_option('pve-vmid'),
-               status => {
-                   description => "Qemu process status.",
-                   type => 'string',
-                   enum => ['stopped', 'running'],
-               },
-               maxmem => {
-                   description => "Maximum memory in bytes.",
-                   type => 'integer',
-                   optional => 1,
-                   renderer => 'bytes',
-               },
-               maxdisk => {
-                   description => "Root disk size in bytes.",
-                   type => 'integer',
-                   optional => 1,
-                   renderer => 'bytes',
-               },
-               name => {
-                   description => "VM name.",
-                   type => 'string',
-                   optional => 1,
-               },
-               qmpstatus => {
-                   description => "Qemu QMP agent status.",
-                   type => 'string',
-                   optional => 1,
-               },
-               pid => {
-                   description => "PID of running qemu process.",
-                   type => 'integer',
-                   optional => 1,
-               },
-               uptime => {
-                   description => "Uptime.",
-                   type => 'integer',
-                   optional => 1,
-                   renderer => 'duration',
-               },
-               cpus => {
-                   description => "Maximum usable CPUs.",
-                   type => 'number',
-                   optional => 1,
-               },
-           },
+           properties => $PVE::QemuServer::vmstatus_return_properties,
        },
        links => [ { rel => 'child', href => "{vmid}" } ],
     },
@@ -427,7 +382,6 @@ __PACKAGE__->register_method({
            next if !$rpcenv->check($authuser, "/vms/$vmid", [ 'VM.Audit' ], 1);
 
            my $data = $vmstatus->{$vmid};
-           $data->{vmid} = int($vmid);
            push @$res, $data;
        }
 
@@ -1908,7 +1862,26 @@ __PACKAGE__->register_method({
            vmid => get_standard_option('pve-vmid'),
        },
     },
-    returns => { type => 'object' },
+    returns => {
+       type => 'object',
+       properties => {
+           %$PVE::QemuServer::vmstatus_return_properties,
+           ha => {
+               description => "HA manager service status.",
+               type => 'object',
+           },
+           spice => {
+               description => "Qemu VGA configuration supports spice.",
+               type => 'boolean',
+               optional => 1,
+           },
+           agent => {
+               description => "Qemu GuestAgent enabled in config.",
+               type => 'boolean',
+               optional => 1,
+           },
+       },
+    },
     code => sub {
        my ($param) = @_;
 
@@ -1921,8 +1894,7 @@ __PACKAGE__->register_method({
        $status->{ha} = PVE::HA::Config::get_service_status("vm:$param->{vmid}");
 
        $status->{spice} = 1 if PVE::QemuServer::vga_conf_has_spice($conf->{vga});
-
-       $status->{agent} = 1 if $conf->{agent};
+       $status->{agent} = 1 if (PVE::QemuServer::parse_guest_agent($conf)->{enabled});
 
        return $status;
     }});