[pve-devel] [RFC PATCH] add kiosk option to vm

Dominik Csapak d.csapak at proxmox.com
Thu Feb 8 15:39:36 CET 2018


this adds a 'kiosk' option, which enables qemus snapshot
mode, which redirects all writes to a temporary file, so
that if you stop the qemu process, the disks are in their original state

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
the only possible pitfall with this mode is that the temporary writes
go on a file on (i think) /var/tmp which in our case means the
root partition could get full, but since we can already enable this
option per disk, i guess this is not an issue

 PVE/QemuServer.pm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 20d6682..28a0f19 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -532,6 +532,12 @@ EODESCR
 	description => "Select BIOS implementation.",
 	default => 'seabios',
     },
+    kiosk => {
+	optional => 1,
+	type => 'boolean',
+	default => 0,
+	description => "If activated, writes to the disks of the VM will be temporary, and will be lost when stopping the VM."
+    }
 };
 
 # what about other qemu settings ?
@@ -3401,6 +3407,10 @@ sub config_to_command {
 	}
     }
 
+    if ($conf->{kiosk}) {
+	push @$cmd, '-snapshot';
+    }
+
     # add custom args
     if ($conf->{args}) {
 	my $aa = PVE::Tools::split_args($conf->{args});
-- 
2.11.0





More information about the pve-devel mailing list