[pve-devel] [PATCH qemu-server] Add guest-command as enumeration.

Wolfgang Link w.link at proxmox.com
Wed Nov 30 15:34:52 CET 2016


This makes it easier to execute the agent command and restrict to the allowed.
---
 PVE/API2/Qemu.pm | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 500e2df..5c47de7 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2840,6 +2840,22 @@ __PACKAGE__->register_method({
 	return $res;
     }});
 
+my $guest_command = [
+	'guest-ping',
+	'guest-get-time',
+	'guest-info',
+	'guest-fsfreeze-status',
+	'guest-fsfreeze-freeze',
+	'guest-fsfreeze-thaw',
+	'guest-fstrim',
+	'guest-network-get-interfaces',
+	'guest-get-vcpus',
+	'guest-get-fsinfo',
+	'guest-get-memory-blocks',
+	'guest-get-memory-block-info'
+];
+
+
 __PACKAGE__->register_method({
     name => 'agent',
     path => '{vmid}/agent',
@@ -2858,6 +2874,7 @@ __PACKAGE__->register_method({
 	    command => {
 		type => 'string',
 		description => "The QGA command.",
+		enum => $guest_command
 	    }
 	},
     },
-- 
2.1.4





More information about the pve-devel mailing list