[pve-devel] [PATCH] Add check when KVM failed to start

Wolfgang Link w.link at proxmox.com
Mon Mar 7 12:49:19 CET 2016


If a Vm failed to start, check if Vm disk is on ZFS (filesystem) and "No cache" or "Default" is set as Cache mode.
---
 PVE/QemuServer.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 17b43d2..f6cde2c 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4558,6 +4558,17 @@ sub vm_start {
 
 	if (my $err = $@) {
 	    # deactivate volumes if start fails
+
+	    my  $cache_mode_is_possible = sub {
+		my ($ds, $drive) = @_;
+
+		if ( (!$drive->{cache} || $drive->{cache} eq "none") &&
+		     PVE::Storage::is_image_on_zfs($drive->{file})) {
+		    die "Please use ZFSPoolPlugin to run KVM on ZFS\n";
+		}
+	    };
+
+	    PVE::QemuServer::foreach_drive($conf, $cache_mode_is_possible);
 	    eval { PVE::Storage::deactivate_volumes($storecfg, $vollist); };
 	    die "start failed: $err";
 	}
-- 
2.1.4





More information about the pve-devel mailing list