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