]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
sanlock: Forbid VIR_DOMAIN_LOCK_FAILURE_IGNORE
authorJiri Denemark <jdenemar@redhat.com>
Mon, 24 Mar 2014 13:22:36 +0000 (14:22 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 25 Mar 2014 08:08:39 +0000 (09:08 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=905280
https://bugzilla.redhat.com/show_bug.cgi?id=967493

Sanlock expects that the configured kill script either kills the PID on
lock failure or removes all locks the PID owns. If none of the two
options happen, sanlock will reboot the host. Although IGNORE action is
supposed to ignore the request to kill the PID or remove all leases,
it's certainly not designed to cause the host to be rebooted. That said,
IGNORE action is incompatible with sanlock and should be forbidden by
libvirt.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
src/locking/lock_driver_sanlock.c
src/locking/sanlock_helper.c

index 3e12c4fdb85a47da523f92348db2885e4bf8e56d..b8c86fcd732efc3eb7e8ccc1f00223710960ab53 100644 (file)
@@ -781,7 +781,17 @@ virLockManagerSanlockRegisterKillscript(int sock,
     int ret = -1;
     int rv;
 
-    if (action > VIR_DOMAIN_LOCK_FAILURE_IGNORE) {
+    switch (action) {
+    case VIR_DOMAIN_LOCK_FAILURE_DEFAULT:
+        return 0;
+
+    case VIR_DOMAIN_LOCK_FAILURE_POWEROFF:
+    case VIR_DOMAIN_LOCK_FAILURE_RESTART:
+    case VIR_DOMAIN_LOCK_FAILURE_PAUSE:
+        break;
+
+    case VIR_DOMAIN_LOCK_FAILURE_IGNORE:
+    case VIR_DOMAIN_LOCK_FAILURE_LAST:
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Failure action %s is not supported by sanlock"),
                        virDomainLockFailureTypeToString(action));
index 3e400b7605a733b9d257b5525ad6318e37ad548d..c913cc3f6481ef6647ff08ed3e1de8996af03b1c 100644 (file)
@@ -117,11 +117,9 @@ main(int argc, char **argv)
             ret = EXIT_SUCCESS;
         break;
 
+    case VIR_DOMAIN_LOCK_FAILURE_DEFAULT:
     case VIR_DOMAIN_LOCK_FAILURE_IGNORE:
-        ret = EXIT_SUCCESS;
-        break;
-
-    default:
+    case VIR_DOMAIN_LOCK_FAILURE_LAST:
         fprintf(stderr, _("unsupported failure action: '%s'\n"),
                 virDomainLockFailureTypeToString(action));
         break;