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

Wolfgang Link w.link at proxmox.com
Fri Mar 11 09:46:09 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 c0907bc..39ebd07 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -4463,6 +4463,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