Return 2 for 'off' like other fencing agents

Signed-off-by: Lon Hohberger <lon@users.sourceforge.net>
This commit is contained in:
Lon Hohberger 2010-01-15 08:06:34 -05:00
parent 2c4df2e500
commit 30481d4cc9
5 changed files with 23 additions and 9 deletions

View File

@ -127,6 +127,7 @@ main(int argc, char **argv)
}
switch(ret) {
case RESP_OFF:
case 0:
break;
case RESP_FAIL:

View File

@ -115,7 +115,8 @@ typedef struct __attribute__((packed)) _serial_fense_resp {
#define RESP_SUCCESS 0
#define RESP_FAIL 1
#define RESP_PERM 2
#define RESP_OFF 2
#define RESP_PERM 3
#define RESP_HOSTLIST 253

View File

@ -527,7 +527,7 @@ do_real_work(void *data, size_t len, uint32_t nodeid, uint32_t seqno)
struct ckpt_fence_req *req = data;
struct ckpt_fence_req reply;
uint32_t owner;
int ret;
int ret = 1;
memcpy(&reply, req, sizeof(reply));
@ -539,6 +539,9 @@ do_real_work(void *data, size_t len, uint32_t nodeid, uint32_t seqno)
if (ret == 2) {
return;
}
if (ret == 1) {
ret = RESP_OFF;
}
break;
case FENCE_OFF:
ret = cluster_virt_status(req->vm_name, &owner);
@ -558,6 +561,8 @@ do_real_work(void *data, size_t len, uint32_t nodeid, uint32_t seqno)
break;
}
reply.response = ret;
cpg_send_reply(&reply, sizeof(reply), nodeid, seqno);
}

View File

@ -29,6 +29,7 @@
#include <malloc.h>
#include <errno.h>
#include "uuid-test.h"
#include <xvm.h>
#include <qpid/console/SessionManager.h>
@ -147,13 +148,14 @@ do_lq_request(struct lq_info *info, const char *vm_name,
}
}
if (!found) {
return 1;
}
Object::AttributeMap attrs;
MethodResponse result;
if (!found) {
result.code = 1;
goto out;
}
vm_state = domain->attrString("state").c_str();
std::cout << domain->attrString(property) << " "
@ -163,11 +165,16 @@ do_lq_request(struct lq_info *info, const char *vm_name,
!strcmp( vm_state, "idle" ) ||
!strcmp( vm_state, "paused" ) ||
!strcmp( vm_state, "no state" ) ) {
i = 1;
i = RESP_OFF;
} else {
i = 0;
}
if (!strcasecmp(action, "status")) {
result.code = i;
goto out;
}
result.code = 1;
if (!strcasecmp(action, "destroy") && !i) {
std::cout << "Domain is inactive; nothing to do" << std::endl;
@ -239,7 +246,7 @@ lq_status(const char *vm_name, void *priv)
VALIDATE(priv);
printf("[libvirt-qpid] STATUS operation on %s\n", vm_name);
return 1;
return do_lq_request((lq_info *)priv, vm_name, "destroy");
}

View File

@ -282,7 +282,7 @@ libvirt_status(const char *vm_name, void *priv)
if (!vdp || ((virDomainGetInfo(vdp, &vdi) == 0) &&
(vdi.state == VIR_DOMAIN_SHUTOFF))) {
ret = 1;
ret = RESP_OFF;
}
if (vdp)