|
|
e4ffb1 |
commit 004ce512d61867bcc981ae49c5fbf5ffb30172fa
|
|
|
e4ffb1 |
Author: Marek 'marx' Grac <mgrac@redhat.com>
|
|
|
e4ffb1 |
Date: Mon Sep 15 15:05:25 2014 +0200
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
fence_zvm: Add support for 'on', improve documentation
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
Author: Neale Ferguson
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
diff --git a/fence/agents/zvm/fence_zvm.8 b/fence/agents/zvm/fence_zvm.8
|
|
|
e4ffb1 |
index 359436e..8c0d35a 100644
|
|
|
e4ffb1 |
--- a/fence/agents/zvm/fence_zvm.8
|
|
|
e4ffb1 |
+++ b/fence/agents/zvm/fence_zvm.8
|
|
|
e4ffb1 |
@@ -52,7 +52,7 @@ forcibly terminated. Currently, this option is ignored.
|
|
|
e4ffb1 |
This option is used by fence_node(8) and is ignored by fence_zvm.
|
|
|
e4ffb1 |
.TP
|
|
|
e4ffb1 |
\fIaction = < action >\fP
|
|
|
e4ffb1 |
-Fencing action: "off" - fence off device; "metadata" - display device metadata; "status" - state of device
|
|
|
e4ffb1 |
+Fencing action: "off" - deactivate virtual machine; "on" - activate virtual machine; "metadata" - display device metadata" - describe fence agent parameters; "status" - state of virtual machine
|
|
|
e4ffb1 |
.TP
|
|
|
e4ffb1 |
\fIport = < target >\fP
|
|
|
e4ffb1 |
Name of virtual machine to recycle.
|
|
|
e4ffb1 |
diff --git a/fence/agents/zvm/fence_zvm.c b/fence/agents/zvm/fence_zvm.c
|
|
|
e4ffb1 |
index e5a7c2b..524e21e 100644
|
|
|
e4ffb1 |
--- a/fence/agents/zvm/fence_zvm.c
|
|
|
e4ffb1 |
+++ b/fence/agents/zvm/fence_zvm.c
|
|
|
e4ffb1 |
@@ -699,15 +699,15 @@ get_options_stdin (zvm_driver_t *zvm)
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
if (!strcasecmp (opt, "action")) {
|
|
|
e4ffb1 |
if (strcasecmp(arg, "off") == 0) {
|
|
|
e4ffb1 |
- fence = 0;
|
|
|
e4ffb1 |
- } else if (strcasecmp(arg, "on") == 0) {
|
|
|
e4ffb1 |
fence = 1;
|
|
|
e4ffb1 |
- } else if (strcasecmp(arg, "metadata") == 0) {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(arg, "on") == 0) {
|
|
|
e4ffb1 |
fence = 2;
|
|
|
e4ffb1 |
- } else if (strcasecmp(arg, "status") == 0) {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(arg, "metadata") == 0) {
|
|
|
e4ffb1 |
fence = 3;
|
|
|
e4ffb1 |
- } else {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(arg, "status") == 0) {
|
|
|
e4ffb1 |
fence = 4;
|
|
|
e4ffb1 |
+ } else {
|
|
|
e4ffb1 |
+ fence = 5;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
} else if (!strcasecmp (opt, "ipaddr")) {
|
|
|
e4ffb1 |
lSrvName = MIN(strlen(arg), sizeof(zvm->smapiSrv));
|
|
|
e4ffb1 |
@@ -738,7 +738,7 @@ get_options_stdin (zvm_driver_t *zvm)
|
|
|
e4ffb1 |
zvm->delay = DEFAULT_DELAY;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
} else if (!strcasecmp (opt, "help")) {
|
|
|
e4ffb1 |
- fence = 4;
|
|
|
e4ffb1 |
+ fence = 5;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
return(fence);
|
|
|
e4ffb1 |
@@ -769,15 +769,15 @@ get_options(int argc, char **argv, zvm_driver_t *zvm)
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
case 'o' :
|
|
|
e4ffb1 |
if (strcasecmp(optarg, "off") == 0) {
|
|
|
e4ffb1 |
- fence = 0;
|
|
|
e4ffb1 |
- } else if (strcasecmp(optarg, "on") == 0) {
|
|
|
e4ffb1 |
fence = 1;
|
|
|
e4ffb1 |
- } else if (strcasecmp(optarg, "metadata") == 0) {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(optarg, "on") == 0) {
|
|
|
e4ffb1 |
fence = 2;
|
|
|
e4ffb1 |
- } else if (strcasecmp(optarg, "status") == 0) {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(optarg, "metadata") == 0) {
|
|
|
e4ffb1 |
fence = 3;
|
|
|
e4ffb1 |
- } else {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(optarg, "status") == 0) {
|
|
|
e4ffb1 |
fence = 4;
|
|
|
e4ffb1 |
+ } else {
|
|
|
e4ffb1 |
+ fence = 5;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
case 'a' :
|
|
|
e4ffb1 |
@@ -807,7 +807,7 @@ get_options(int argc, char **argv, zvm_driver_t *zvm)
|
|
|
e4ffb1 |
memcpy(zvm->node, optarg, lSrvNode);
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
default :
|
|
|
e4ffb1 |
- fence = 4;
|
|
|
e4ffb1 |
+ fence = 5;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
return(fence);
|
|
|
e4ffb1 |
@@ -874,22 +874,26 @@ main(int argc, char **argv)
|
|
|
e4ffb1 |
fence = get_options_stdin(&zvm);
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
switch(fence) {
|
|
|
e4ffb1 |
- case 0 : // OFF
|
|
|
e4ffb1 |
+ case 0 : // OFFON
|
|
|
e4ffb1 |
+ if ((rc = check_parm(&zvm)) == 0)
|
|
|
e4ffb1 |
+ rc = zvm_smapi_imageRecycle(&zvm);
|
|
|
e4ffb1 |
+ break;
|
|
|
e4ffb1 |
+ case 1 : // OFF
|
|
|
e4ffb1 |
if ((rc = check_parm(&zvm)) == 0)
|
|
|
e4ffb1 |
rc = zvm_smapi_imageDeactivate(&zvm);
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
- case 1 : // ON
|
|
|
e4ffb1 |
+ case 2 : // ON
|
|
|
e4ffb1 |
if ((rc = check_parm(&zvm)) == 0)
|
|
|
e4ffb1 |
rc = zvm_smapi_imageActivate(&zvm);
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
- case 2 : // METADATA
|
|
|
e4ffb1 |
+ case 3 : // METADATA
|
|
|
e4ffb1 |
rc = zvm_metadata();
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
- case 3 : // STATUS
|
|
|
e4ffb1 |
+ case 4 : // STATUS
|
|
|
e4ffb1 |
if ((rc = check_parm(&zvm)) == 0)
|
|
|
e4ffb1 |
rc = zvm_smapi_imageQuery(&zvm);
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
- case 4 :
|
|
|
e4ffb1 |
+ case 5 :
|
|
|
e4ffb1 |
rc = usage();
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
closelog();
|
|
|
e4ffb1 |
diff --git a/fence/agents/zvm/fence_zvmip.8 b/fence/agents/zvm/fence_zvmip.8
|
|
|
e4ffb1 |
index 8217d61..6b01425 100644
|
|
|
e4ffb1 |
--- a/fence/agents/zvm/fence_zvmip.8
|
|
|
e4ffb1 |
+++ b/fence/agents/zvm/fence_zvmip.8
|
|
|
e4ffb1 |
@@ -55,7 +55,7 @@ Display usage information
|
|
|
e4ffb1 |
This option is used by fence_node(8) and is ignored by fence_zvmip.
|
|
|
e4ffb1 |
.TP
|
|
|
e4ffb1 |
\fIaction = < action >\fP
|
|
|
e4ffb1 |
-Fencing action: "off" - fence off device; "metadata" - display device metadata; "status" - state of device
|
|
|
e4ffb1 |
+Fencing action: "off" - deactivate virtual machine; "on" - activate virtual machine; "metadata" - display device metadata" - describe fence agent parameters; "status" - state of virtual machine
|
|
|
e4ffb1 |
.TP
|
|
|
e4ffb1 |
\fIplug = < plug >\fP
|
|
|
e4ffb1 |
Name of virtual machine to recycle.
|
|
|
e4ffb1 |
diff --git a/fence/agents/zvm/fence_zvmip.c b/fence/agents/zvm/fence_zvmip.c
|
|
|
e4ffb1 |
index 3342bc6..bd7c536 100644
|
|
|
e4ffb1 |
--- a/fence/agents/zvm/fence_zvmip.c
|
|
|
e4ffb1 |
+++ b/fence/agents/zvm/fence_zvmip.c
|
|
|
e4ffb1 |
@@ -677,15 +677,15 @@ get_options_stdin (zvm_driver_t *zvm)
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
if (!strcasecmp (opt, "action")) {
|
|
|
e4ffb1 |
if (strcasecmp(arg, "off") == 0) {
|
|
|
e4ffb1 |
- fence = 0;
|
|
|
e4ffb1 |
- } else if (strcasecmp(arg, "on") == 0) {
|
|
|
e4ffb1 |
fence = 1;
|
|
|
e4ffb1 |
- } else if (strcasecmp(arg, "metadata") == 0) {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(arg, "on") == 0) {
|
|
|
e4ffb1 |
fence = 2;
|
|
|
e4ffb1 |
- } else if (strcasecmp(arg, "status") == 0) {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(arg, "metadata") == 0) {
|
|
|
e4ffb1 |
fence = 3;
|
|
|
e4ffb1 |
- } else {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(arg, "status") == 0) {
|
|
|
e4ffb1 |
fence = 4;
|
|
|
e4ffb1 |
+ } else {
|
|
|
e4ffb1 |
+ fence = 5;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
} else if (!strcasecmp (opt, "ipaddr")) {
|
|
|
e4ffb1 |
lSrvName = MIN(strlen(arg), sizeof(zvm->smapiSrv)-1);
|
|
|
e4ffb1 |
@@ -712,7 +712,7 @@ get_options_stdin (zvm_driver_t *zvm)
|
|
|
e4ffb1 |
zvm->timeOut = DEFAULT_TIMEOUT;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
} else if (!strcasecmp (opt, "help")) {
|
|
|
e4ffb1 |
- fence = 2;
|
|
|
e4ffb1 |
+ fence = 5;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
return(fence);
|
|
|
e4ffb1 |
@@ -746,15 +746,15 @@ get_options(int argc, char **argv, zvm_driver_t *zvm)
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
case 'o' :
|
|
|
e4ffb1 |
if (strcasecmp(optarg, "off") == 0) {
|
|
|
e4ffb1 |
- fence = 0;
|
|
|
e4ffb1 |
- } else if (strcasecmp(optarg, "on") == 0) {
|
|
|
e4ffb1 |
fence = 1;
|
|
|
e4ffb1 |
- } else if (strcasecmp(optarg, "metadata") == 0) {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(optarg, "on") == 0) {
|
|
|
e4ffb1 |
fence = 2;
|
|
|
e4ffb1 |
- } else if (strcasecmp(optarg, "status") == 0) {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(optarg, "metadata") == 0) {
|
|
|
e4ffb1 |
fence = 3;
|
|
|
e4ffb1 |
- } else {
|
|
|
e4ffb1 |
+ } else if (strcasecmp(optarg, "status") == 0) {
|
|
|
e4ffb1 |
fence = 4;
|
|
|
e4ffb1 |
+ } else {
|
|
|
e4ffb1 |
+ fence = 5;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
case 'p' :
|
|
|
e4ffb1 |
@@ -784,7 +784,7 @@ get_options(int argc, char **argv, zvm_driver_t *zvm)
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
default :
|
|
|
e4ffb1 |
- fence = 4;
|
|
|
e4ffb1 |
+ fence = 5;
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
return(fence);
|
|
|
e4ffb1 |
@@ -944,22 +944,26 @@ main(int argc, char **argv)
|
|
|
e4ffb1 |
fence = get_options_stdin(&zvm);
|
|
|
e4ffb1 |
|
|
|
e4ffb1 |
switch(fence) {
|
|
|
e4ffb1 |
- case 0 : // OFF
|
|
|
e4ffb1 |
+ case 0 : // OFFON
|
|
|
e4ffb1 |
+ if ((rc = check_parm(&zvm)) == 0)
|
|
|
e4ffb1 |
+ rc = zvm_smapi_imageRecycle(&zvm);
|
|
|
e4ffb1 |
+ break;
|
|
|
e4ffb1 |
+ case 1 : // OFF
|
|
|
e4ffb1 |
if ((rc = check_parm(&zvm)) == 0)
|
|
|
e4ffb1 |
rc = zvm_smapi_imageDeactivate(&zvm);
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
- case 1 : // ON
|
|
|
e4ffb1 |
+ case 2 : // ON
|
|
|
e4ffb1 |
if ((rc = check_parm(&zvm)) == 0)
|
|
|
e4ffb1 |
rc = zvm_smapi_imageActivate(&zvm);
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
- case 2 : // METADATA
|
|
|
e4ffb1 |
+ case 3 : // METADATA
|
|
|
e4ffb1 |
rc = zvm_metadata();
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
- case 3 : // STATUS
|
|
|
e4ffb1 |
+ case 4 : // STATUS
|
|
|
e4ffb1 |
if ((rc = check_parm(&zvm)) == 0)
|
|
|
e4ffb1 |
rc = zvm_smapi_imageQuery(&zvm);
|
|
|
e4ffb1 |
break;
|
|
|
e4ffb1 |
- case 4 :
|
|
|
e4ffb1 |
+ case 5 :
|
|
|
e4ffb1 |
rc = usage();
|
|
|
e4ffb1 |
}
|
|
|
e4ffb1 |
closelog();
|