[pve-devel] [PATCH qemu-server 5/5] add ability to suspend a vm to disk from the api

Dominik Csapak d.csapak at proxmox.com
Mon Mar 11 15:45:54 CET 2019


this enables the use of the suspend to disk code

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Qemu.pm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 49aaa48..6466a23 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -2349,6 +2349,12 @@ __PACKAGE__->register_method({
 	    vmid => get_standard_option('pve-vmid',
 					{ completion => \&PVE::QemuServer::complete_vmid_running }),
 	    skiplock => get_standard_option('skiplock'),
+	    todisk => {
+		type => 'boolean',
+		default => 0,
+		optional => 1,
+		description => 'If set, saves the VM state to disk and closes the VM.',
+	    },
 	},
     },
     returns => {
@@ -2365,6 +2371,8 @@ __PACKAGE__->register_method({
 
 	my $vmid = extract_param($param, 'vmid');
 
+	my $todisk = extract_param($param, 'todisk') // 0;
+
 	my $skiplock = extract_param($param, 'skiplock');
 	raise_param_exc({ skiplock => "Only root may use this option." })
 	    if $skiplock && $authuser ne 'root at pam';
@@ -2376,7 +2384,7 @@ __PACKAGE__->register_method({
 
 	    syslog('info', "suspend VM $vmid: $upid\n");
 
-	    PVE::QemuServer::vm_suspend($vmid, $skiplock);
+	    PVE::QemuServer::vm_suspend($vmid, $skiplock, $todisk);
 
 	    return;
 	};
-- 
2.11.0





More information about the pve-devel mailing list