dlm: master - dlm_controld: don't skip unlinking checkpoint
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=fc714e99...
Commit: fc714e99ee117288c3cc35e20cefb4d55df234ea
Parent: ad80dd21d1f2f91989ba09e47277c939859dc5ca
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Mar 31 15:06:30 2010 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 20 17:06:05 2010 -0500
dlm_controld: don't skip unlinking checkpoint
This reverts commit c1e139fb328408891d054e577b33d724230dde43
which was wrong.
bz 578628
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/dlm_controld/plock.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
index 9766ec3..8b3eae2 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -1708,9 +1708,6 @@ static int _unlink_checkpoint(struct lockspace *ls, SaNameT *name)
h = (SaCkptCheckpointHandleT) ls->plock_ckpt_handle;
log_group(ls, "unlink ckpt %llx", (unsigned long long)h);
- if (!h)
- return ret;
-
unlink_retry:
rv = saCkptCheckpointUnlink(system_ckpt_handle, name);
if (rv == SA_AIS_ERR_TRY_AGAIN) {
@@ -1732,7 +1729,7 @@ static int _unlink_checkpoint(struct lockspace *ls, SaNameT *name)
goto status_retry;
}
if (rv != SA_AIS_OK) {
- log_error("unlink ckpt status error %d %s", rv, ls->name);
+ log_group(ls, "unlink ckpt status error %d %s", rv, ls->name);
goto out_close;
}
14 years
dlm: master - dlm_controld: set last_plock_time for ownership operations
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=ad80dd21...
Commit: ad80dd21d1f2f91989ba09e47277c939859dc5ca
Parent: 812bc3508dad949c0ee5c5a73ab5bd5b6023310a
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Mar 31 15:05:49 2010 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 20 17:05:49 2010 -0500
dlm_controld: set last_plock_time for ownership operations
last_plock_time was not being set for ops related to ownership mode
like "own" and "drop" which change the plock state that is saved in
checkpoints. Not changing last_plock_time means we don't detect
that plock state has changed when it has, and may end up reusing an
old checkpoint, causing a mounting node to read incorrect resource
ownership state.
bz 578626
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/dlm_controld/plock.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
index a318eda..9766ec3 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -1072,6 +1072,8 @@ static void _receive_own(struct lockspace *ls, struct dlm_header *hd, int len)
int from = hd->nodeid;
int rv;
+ ls->last_plock_time = time(NULL);
+
memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
info_bswap_in(&info);
@@ -1244,6 +1246,8 @@ static void _receive_sync(struct lockspace *ls, struct dlm_header *hd, int len)
int from = hd->nodeid;
int rv;
+ ls->last_plock_time = time(NULL);
+
memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
info_bswap_in(&info);
@@ -1289,6 +1293,8 @@ static void _receive_drop(struct lockspace *ls, struct dlm_header *hd, int len)
int from = hd->nodeid;
int rv;
+ ls->last_plock_time = time(NULL);
+
memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
info_bswap_in(&info);
14 years
dlm: master - dlm_controld: add plock checkpoint signatures
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=812bc350...
Commit: 812bc3508dad949c0ee5c5a73ab5bd5b6023310a
Parent: 2092236c14402ed31f9141c2d517e925fc9c12a5
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Apr 20 17:05:03 2010 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 20 17:05:03 2010 -0500
dlm_controld: add plock checkpoint signatures
A signature of the plock checkpoint data is made by the writer and
included in the "checkpoint ready" message it sends. The reader
then computes the signature of the data it reads from the checkpoint
and compares against the signature of the writer. If they don't
match, the reader has retrieved incorrect plock state so it disables
plock operations for the given lockspace on that node.
bz 578625
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/dlm_controld/cpg.c | 56 ++++++++++-----
group/dlm_controld/dlm_daemon.h | 14 +++-
group/dlm_controld/plock.c | 138 ++++++++++++++++++++++++++++-----------
3 files changed, 147 insertions(+), 61 deletions(-)
diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c
index 20d59d5..af7ac40 100644
--- a/group/dlm_controld/cpg.c
+++ b/group/dlm_controld/cpg.c
@@ -263,6 +263,7 @@ void dlm_send_message(struct lockspace *ls, char *buf, int len)
hd->global_id = cpu_to_le32(ls->global_id);
hd->flags = cpu_to_le32(hd->flags);
hd->msgdata = cpu_to_le32(hd->msgdata);
+ hd->msgdata2 = cpu_to_le32(hd->msgdata2);
_send_message(ls->cpg_handle, buf, len, type);
}
@@ -1081,9 +1082,11 @@ static void receive_plocks_stored(struct lockspace *ls, struct dlm_header *hd,
{
struct ls_info *li;
struct id_info *ids;
+ uint32_t sig;
- log_group(ls, "receive_plocks_stored %d:%u need_plocks %d",
- hd->nodeid, hd->msgdata, ls->need_plocks);
+ log_group(ls, "receive_plocks_stored %d:%u flags %x sig %x "
+ "need_plocks %d", hd->nodeid, hd->msgdata, hd->flags,
+ hd->msgdata2, ls->need_plocks);
if (!ls->need_plocks)
return;
@@ -1109,14 +1112,25 @@ static void receive_plocks_stored(struct lockspace *ls, struct dlm_header *hd,
return;
}
- retrieve_plocks(ls);
+ retrieve_plocks(ls, &sig);
+
+ if ((hd->flags & DLM_MFLG_PLOCK_SIG) && (sig != hd->msgdata2)) {
+ log_error("lockspace %s plock disabled our sig %x "
+ "nodeid %d sig %x", ls->name, sig, hd->nodeid,
+ hd->msgdata2);
+ ls->disable_plock = 1;
+ ls->need_plocks = 1; /* don't set HAVEPLOCK */
+ ls->save_plocks = 0;
+ return;
+ }
+
process_saved_plocks(ls);
ls->need_plocks = 0;
ls->save_plocks = 0;
}
static void send_info(struct lockspace *ls, struct change *cg, int type,
- uint32_t flags)
+ uint32_t flags, uint32_t msgdata2)
{
struct dlm_header *hd;
struct ls_info *li;
@@ -1146,6 +1160,7 @@ static void send_info(struct lockspace *ls, struct change *cg, int type,
hd->type = type;
hd->msgdata = cg->seq;
hd->flags = flags;
+ hd->msgdata2 = msgdata2;
if (ls->joining)
hd->flags |= DLM_MFLG_JOINING;
@@ -1170,10 +1185,11 @@ static void send_info(struct lockspace *ls, struct change *cg, int type,
id++;
}
- log_group(ls, "send_%s cg %u flags %x counts %u %d %d %d %d",
+ log_group(ls, "send_%s cg %u flags %x data2 %x counts %u %d %d %d %d",
type == DLM_MSG_START ? "start" : "plocks_stored",
- cg->seq, hd->flags, ls->started_count, cg->member_count,
- cg->joined_count, cg->remove_count, cg->failed_count);
+ cg->seq, hd->flags, hd->msgdata2, ls->started_count,
+ cg->member_count, cg->joined_count, cg->remove_count,
+ cg->failed_count);
dlm_send_message(ls, buf, len);
@@ -1184,14 +1200,14 @@ static void send_start(struct lockspace *ls)
{
struct change *cg = list_first_entry(&ls->changes, struct change, list);
- send_info(ls, cg, DLM_MSG_START, 0);
+ send_info(ls, cg, DLM_MSG_START, 0, 0);
}
-static void send_plocks_stored(struct lockspace *ls)
+static void send_plocks_stored(struct lockspace *ls, uint32_t sig)
{
struct change *cg = list_first_entry(&ls->changes, struct change, list);
- send_info(ls, cg, DLM_MSG_PLOCKS_STORED, 0);
+ send_info(ls, cg, DLM_MSG_PLOCKS_STORED, DLM_MFLG_PLOCK_SIG, sig);
}
static int same_members(struct change *cg1, struct change *cg2)
@@ -1218,7 +1234,7 @@ static void send_nacks(struct lockspace *ls, struct change *startcg)
same_members(cg, startcg)) {
log_group(ls, "send nack old cg %u new cg %u",
cg->seq, startcg->seq);
- send_info(ls, cg, DLM_MSG_START, DLM_MFLG_NACK);
+ send_info(ls, cg, DLM_MSG_START, DLM_MFLG_NACK, 0);
}
}
}
@@ -1238,8 +1254,9 @@ static void prepare_plocks(struct lockspace *ls)
{
struct change *cg = list_first_entry(&ls->changes, struct change, list);
struct member *memb;
+ uint32_t sig;
- if (!cfgd_enable_plock)
+ if (!cfgd_enable_plock || ls->disable_plock)
return;
/* if we're the only node in the lockspace, then we are the ckpt_node
@@ -1297,8 +1314,8 @@ static void prepare_plocks(struct lockspace *ls)
previous ckpt_node upon receiving the stored message from us. */
if (nodes_added(ls))
- store_plocks(ls);
- send_plocks_stored(ls);
+ store_plocks(ls, &sig);
+ send_plocks_stored(ls, sig);
}
static void apply_changes(struct lockspace *ls)
@@ -1532,6 +1549,7 @@ static void dlm_header_in(struct dlm_header *hd)
hd->global_id = le32_to_cpu(hd->global_id);
hd->flags = le32_to_cpu(hd->flags);
hd->msgdata = le32_to_cpu(hd->msgdata);
+ hd->msgdata2 = le32_to_cpu(hd->msgdata2);
}
static void deliver_cb(cpg_handle_t handle,
@@ -1579,7 +1597,7 @@ static void deliver_cb(cpg_handle_t handle,
case DLM_MSG_PLOCK:
if (cfgd_enable_plock)
receive_plock(ls, hd, len);
- else
+ else if (!ls->disable_plock)
log_error("msg %d nodeid %d enable_plock %d",
hd->type, nodeid, cfgd_enable_plock);
break;
@@ -1587,7 +1605,7 @@ static void deliver_cb(cpg_handle_t handle,
case DLM_MSG_PLOCK_OWN:
if (cfgd_enable_plock && cfgd_plock_ownership)
receive_own(ls, hd, len);
- else
+ else if (!ls->disable_plock)
log_error("msg %d nodeid %d enable_plock %d owner %d",
hd->type, nodeid, cfgd_enable_plock,
cfgd_plock_ownership);
@@ -1596,7 +1614,7 @@ static void deliver_cb(cpg_handle_t handle,
case DLM_MSG_PLOCK_DROP:
if (cfgd_enable_plock && cfgd_plock_ownership)
receive_drop(ls, hd, len);
- else
+ else if (!ls->disable_plock)
log_error("msg %d nodeid %d enable_plock %d owner %d",
hd->type, nodeid, cfgd_enable_plock,
cfgd_plock_ownership);
@@ -1606,7 +1624,7 @@ static void deliver_cb(cpg_handle_t handle,
case DLM_MSG_PLOCK_SYNC_WAITER:
if (cfgd_enable_plock && cfgd_plock_ownership)
receive_sync(ls, hd, len);
- else
+ else if (!ls->disable_plock)
log_error("msg %d nodeid %d enable_plock %d owner %d",
hd->type, nodeid, cfgd_enable_plock,
cfgd_plock_ownership);
@@ -1615,7 +1633,7 @@ static void deliver_cb(cpg_handle_t handle,
case DLM_MSG_PLOCKS_STORED:
if (cfgd_enable_plock)
receive_plocks_stored(ls, hd, len);
- else
+ else if (!ls->disable_plock)
log_error("msg %d nodeid %d enable_plock %d",
hd->type, nodeid, cfgd_enable_plock);
break;
diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h
index 6b5935e..0b0e9f2 100644
--- a/group/dlm_controld/dlm_daemon.h
+++ b/group/dlm_controld/dlm_daemon.h
@@ -164,6 +164,7 @@ enum {
#define DLM_MFLG_HAVEPLOCK 2 /* accompanies start, we have plock state */
#define DLM_MFLG_NACK 4 /* accompanies start, prevent wrong match when
two outstanding changes are the same */
+#define DLM_MFLG_PLOCK_SIG 8 /* msgdata2 is a plock signature */
struct dlm_header {
uint16_t version[3];
@@ -174,8 +175,8 @@ struct dlm_header {
uint32_t flags; /* DLM_MFLG_ */
uint32_t msgdata; /* in-header payload depends on MSG type; lkid
for deadlock, seq for lockspace membership */
- uint32_t pad1;
- uint64_t pad2;
+ uint32_t msgdata2; /* second MSG-specific data */
+ uint64_t pad;
};
struct lockspace {
@@ -203,6 +204,7 @@ struct lockspace {
int plock_ckpt_node;
int need_plocks;
int save_plocks;
+ int disable_plock;
uint32_t associated_mg_id;
struct list_head saved_messages;
struct list_head plock_resources;
@@ -210,6 +212,10 @@ struct lockspace {
time_t last_plock_time;
struct timeval drop_resources_last;
uint64_t plock_ckpt_handle;
+ uint64_t checkpoint_r_num_first;
+ uint64_t checkpoint_r_num_last;
+ uint32_t checkpoint_r_count;
+ uint32_t checkpoint_p_count;
/* deadlock stuff */
@@ -326,8 +332,8 @@ void receive_sync(struct lockspace *ls, struct dlm_header *hd, int len);
void receive_drop(struct lockspace *ls, struct dlm_header *hd, int len);
void process_saved_plocks(struct lockspace *ls);
void close_plock_checkpoint(struct lockspace *ls);
-void store_plocks(struct lockspace *ls);
-void retrieve_plocks(struct lockspace *ls);
+void store_plocks(struct lockspace *ls, uint32_t *sig);
+void retrieve_plocks(struct lockspace *ls, uint32_t *sig);
void purge_plocks(struct lockspace *ls, int nodeid, int unmount);
int fill_plock_dump_buf(struct lockspace *ls);
diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
index 981e9be..a318eda 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -1488,6 +1488,11 @@ void process_plocks(int ci)
goto fail;
}
+ if (ls->disable_plock) {
+ rv = -ENOSYS;
+ goto fail;
+ }
+
log_plock(ls, "read plock %llx %s %s %llx-%llx %d/%u/%llx w %d",
(unsigned long long)info.number,
op_str(info.optype),
@@ -1620,7 +1625,8 @@ static void pack_section_buf(struct lockspace *ls, struct resource *r)
section_len = count * sizeof(struct pack_plock);
}
-static int unpack_section_buf(struct lockspace *ls, char *numbuf, int buflen)
+static int unpack_section_buf(struct lockspace *ls, char *numbuf, int buflen,
+ uint64_t *r_num, int *lock_count)
{
struct pack_plock *pp;
struct posix_lock *po;
@@ -1647,6 +1653,8 @@ static int unpack_section_buf(struct lockspace *ls, char *numbuf, int buflen)
r->owner = owner;
r->last_access = now;
+ *r_num = num;
+
pp = (struct pack_plock *) §ion_buf;
for (i = 0; i < count; i++) {
@@ -1675,6 +1683,7 @@ static int unpack_section_buf(struct lockspace *ls, char *numbuf, int buflen)
}
list_add_tail(&r->list, &ls->plock_resources);
+ *lock_count = count;
return 0;
}
@@ -1797,7 +1806,7 @@ void close_plock_checkpoint(struct lockspace *ls)
it. The ckpt should then disappear and the new node can create a new ckpt
for the next mounter. */
-void store_plocks(struct lockspace *ls)
+void store_plocks(struct lockspace *ls, uint32_t *sig)
{
SaCkptCheckpointCreationAttributesT attr;
SaCkptCheckpointHandleT h;
@@ -1810,15 +1819,21 @@ void store_plocks(struct lockspace *ls)
struct resource *r;
struct posix_lock *po;
struct lock_waiter *w;
- int r_count, lock_count, total_size, section_size, max_section_size;
+ int total_size, section_size, max_section_size;
int len, owner;
+ uint32_t r_count = 0, p_count = 0;
+ uint64_t r_num_first = 0, r_num_last = 0;
- if (!cfgd_enable_plock)
+ if (!cfgd_enable_plock || ls->disable_plock)
return;
/* no change to plock state since we created the last checkpoint */
if (ls->last_checkpoint_time > ls->last_plock_time) {
- log_group(ls, "store_plocks: saved ckpt uptodate");
+ log_group(ls, "store_plocks saved ckpt uptodate");
+ r_num_first = ls->checkpoint_r_num_first;
+ r_num_last = ls->checkpoint_r_num_last;
+ r_count = ls->checkpoint_r_count;
+ p_count = ls->checkpoint_p_count;
goto out;
}
ls->last_checkpoint_time = time(NULL);
@@ -1833,7 +1848,7 @@ void store_plocks(struct lockspace *ls)
the attr fields */
r_count = 0;
- lock_count = 0;
+ p_count = 0;
total_size = 0;
max_section_size = 0;
@@ -1845,22 +1860,23 @@ void store_plocks(struct lockspace *ls)
section_size = 0;
list_for_each_entry(po, &r->locks, list) {
section_size += sizeof(struct pack_plock);
- lock_count++;
+ p_count++;
}
list_for_each_entry(w, &r->waiters, list) {
section_size += sizeof(struct pack_plock);
- lock_count++;
+ p_count++;
}
total_size += section_size;
if (section_size > max_section_size)
max_section_size = section_size;
}
- log_group(ls, "store_plocks: r_count %d, lock_count %d, pp %u bytes",
- r_count, lock_count, (unsigned int)sizeof(struct pack_plock));
-
- log_group(ls, "store_plocks: total %d bytes, max_section %d bytes",
- total_size, max_section_size);
+ log_group(ls, "store_plocks r_count %u p_count %u "
+ "total_size %d max_section_size %d",
+ r_count, p_count, total_size, max_section_size);
+ log_plock(ls, "store_plocks r_count %u p_count %u "
+ "total_size %d max_section_size %d",
+ r_count, p_count, total_size, max_section_size);
attr.creationFlags = SA_CKPT_WR_ALL_REPLICAS;
attr.checkpointSize = total_size;
@@ -1876,20 +1892,20 @@ void store_plocks(struct lockspace *ls)
open_retry:
rv = saCkptCheckpointOpen(system_ckpt_handle, &name,&attr,flags,0,&h);
if (rv == SA_AIS_ERR_TRY_AGAIN) {
- log_group(ls, "store_plocks: ckpt open retry");
+ log_group(ls, "store_plocks ckpt open retry");
sleep(1);
goto open_retry;
}
if (rv == SA_AIS_ERR_EXIST) {
- log_group(ls, "store_plocks: ckpt already exists");
+ log_group(ls, "store_plocks ckpt already exists");
return;
}
if (rv != SA_AIS_OK) {
- log_error("store_plocks: ckpt open error %d %s", rv, ls->name);
+ log_error("store_plocks ckpt open error %d %s", rv, ls->name);
return;
}
- log_group(ls, "store_plocks: open ckpt handle %llx",
+ log_group(ls, "store_plocks open ckpt handle %llx",
(unsigned long long)h);
ls->plock_ckpt_handle = (uint64_t) h;
@@ -1934,20 +1950,24 @@ void store_plocks(struct lockspace *ls)
pack_section_buf(ls, r);
- log_plock(ls, "store_plocks: section size %u id %u \"%s\"",
+ if (!r_num_first)
+ r_num_first = r->number;
+ r_num_last = r->number;
+
+ log_plock(ls, "store_plocks section size %u id %u \"%s\"",
section_len, section_id.idLen, buf);
create_retry:
rv = saCkptSectionCreate(h, §ion_attr, §ion_buf,
section_len);
if (rv == SA_AIS_ERR_TRY_AGAIN) {
- log_group(ls, "store_plocks: ckpt create retry");
+ log_group(ls, "store_plocks ckpt create retry");
sleep(1);
goto create_retry;
}
if (rv == SA_AIS_ERR_EXIST) {
/* this shouldn't happen in general */
- log_group(ls, "store_plocks: clearing old ckpt");
+ log_group(ls, "store_plocks clearing old ckpt");
/* do we need this close or will the close in
the unlink function be ok? */
saCkptCheckpointClose(h);
@@ -1955,19 +1975,36 @@ void store_plocks(struct lockspace *ls)
goto open_retry;
}
if (rv != SA_AIS_OK) {
- log_error("store_plocks: ckpt section create err %d %s",
+ log_error("store_plocks ckpt section create err %d %s",
rv, ls->name);
break;
}
}
out:
- return;
+ *sig = (0xFFFFFFFF & r_num_first) ^ (0xFFFFFFFF & r_num_last) ^
+ r_count ^ p_count;
+
+ log_group(ls, "store_plocks first %llu last %llu r_count %u "
+ "p_count %u sig %x",
+ (unsigned long long)r_num_first,
+ (unsigned long long)r_num_last,
+ r_count, p_count, *sig);
+ log_plock(ls, "store_plocks first %llu last %llu r_count %u "
+ "p_count %u sig %x",
+ (unsigned long long)r_num_first,
+ (unsigned long long)r_num_last,
+ r_count, p_count, *sig);
+
+ ls->checkpoint_r_num_first = r_num_first;
+ ls->checkpoint_r_num_last = r_num_last;
+ ls->checkpoint_r_count = r_count;
+ ls->checkpoint_p_count = p_count;
}
/* called by a node that's just been added to the group to get existing plock
state */
-void retrieve_plocks(struct lockspace *ls)
+void retrieve_plocks(struct lockspace *ls, uint32_t *sig)
{
SaCkptCheckpointHandleT h;
SaCkptSectionIterationHandleT itr;
@@ -1976,9 +2013,11 @@ void retrieve_plocks(struct lockspace *ls)
SaNameT name;
SaAisErrorT rv;
char buf[SECTION_NAME_LEN];
- int len;
+ int len, lock_count;
+ uint32_t r_count = 0, p_count = 0;
+ uint64_t r_num, r_num_first = 0, r_num_last = 0;
- if (!cfgd_enable_plock)
+ if (!cfgd_enable_plock || ls->disable_plock)
return;
log_group(ls, "retrieve_plocks");
@@ -1991,12 +2030,12 @@ void retrieve_plocks(struct lockspace *ls)
rv = saCkptCheckpointOpen(system_ckpt_handle, &name, NULL,
SA_CKPT_CHECKPOINT_READ, 0, &h);
if (rv == SA_AIS_ERR_TRY_AGAIN) {
- log_group(ls, "retrieve_plocks: ckpt open retry");
+ log_group(ls, "retrieve_plocks ckpt open retry");
sleep(1);
goto open_retry;
}
if (rv != SA_AIS_OK) {
- log_error("retrieve_plocks: ckpt open error %d %s",
+ log_error("retrieve_plocks ckpt open error %d %s",
rv, ls->name);
return;
}
@@ -2004,12 +2043,12 @@ void retrieve_plocks(struct lockspace *ls)
init_retry:
rv = saCkptSectionIterationInitialize(h, SA_CKPT_SECTIONS_ANY, 0, &itr);
if (rv == SA_AIS_ERR_TRY_AGAIN) {
- log_group(ls, "retrieve_plocks: ckpt iterinit retry");
+ log_group(ls, "retrieve_plocks ckpt iterinit retry");
sleep(1);
goto init_retry;
}
if (rv != SA_AIS_OK) {
- log_error("retrieve_plocks: ckpt iterinit error %d %s",
+ log_error("retrieve_plocks ckpt iterinit error %d %s",
rv, ls->name);
goto out;
}
@@ -2020,12 +2059,12 @@ void retrieve_plocks(struct lockspace *ls)
if (rv == SA_AIS_ERR_NO_SECTIONS)
break;
if (rv == SA_AIS_ERR_TRY_AGAIN) {
- log_group(ls, "retrieve_plocks: ckpt iternext retry");
+ log_group(ls, "retrieve_plocks ckpt iternext retry");
sleep(1);
goto next_retry;
}
if (rv != SA_AIS_OK) {
- log_error("retrieve_plocks: ckpt iternext error %d %s",
+ log_error("retrieve_plocks ckpt iternext error %d %s",
rv, ls->name);
goto out_it;
}
@@ -2042,19 +2081,19 @@ void retrieve_plocks(struct lockspace *ls)
memset(&buf, 0, sizeof(buf));
snprintf(buf, SECTION_NAME_LEN, "%s", desc.sectionId.id);
- log_plock(ls, "retrieve_plocks: section size %llu id %u \"%s\"",
+ log_plock(ls, "retrieve_plocks section size %llu id %u \"%s\"",
(unsigned long long)iov.dataSize, iov.sectionId.idLen,
buf);
read_retry:
rv = saCkptCheckpointRead(h, &iov, 1, NULL);
if (rv == SA_AIS_ERR_TRY_AGAIN) {
- log_group(ls, "retrieve_plocks: ckpt read retry");
+ log_group(ls, "retrieve_plocks ckpt read retry");
sleep(1);
goto read_retry;
}
if (rv != SA_AIS_OK) {
- log_error("retrieve_plocks: ckpt read error %d %s",
+ log_error("retrieve_plocks ckpt read error %d %s",
rv, ls->name);
goto out_it;
}
@@ -2063,24 +2102,47 @@ void retrieve_plocks(struct lockspace *ls)
no locks, which exist in ownership mode; the resource
name and owner come from the section id */
- log_plock(ls, "retrieve_plocks: ckpt read %llu bytes",
+ log_plock(ls, "retrieve_plocks ckpt read %llu bytes",
(unsigned long long)iov.readSize);
section_len = iov.readSize;
if (section_len % sizeof(struct pack_plock)) {
- log_error("retrieve_plocks: bad section len %d %s",
+ log_error("retrieve_plocks bad section len %d %s",
section_len, ls->name);
continue;
}
+ r_num = 0;
+ lock_count = 0;
+
unpack_section_buf(ls, (char *)desc.sectionId.id,
- desc.sectionId.idLen);
+ desc.sectionId.idLen, &r_num, &lock_count);
+ r_count++;
+ p_count += lock_count;
+
+ if (!r_num_first)
+ r_num_first = r_num;
+ r_num_last = r_num;
}
out_it:
saCkptSectionIterationFinalize(itr);
out:
saCkptCheckpointClose(h);
+
+ *sig = (0xFFFFFFFF & r_num_first) ^ (0xFFFFFFFF & r_num_last)
+ ^ r_count ^ p_count;
+
+ log_group(ls, "retrieve_plocks first %llu last %llu r_count %u "
+ "p_count %u sig %x",
+ (unsigned long long)r_num_first,
+ (unsigned long long)r_num_last,
+ r_count, p_count, *sig);
+ log_plock(ls, "retrieve_plocks first %llu last %llu r_count %u "
+ "p_count %u sig %x",
+ (unsigned long long)r_num_first,
+ (unsigned long long)r_num_last,
+ r_count, p_count, *sig);
}
/* Called when a node has failed, or we're unmounting. For a node failure, we
@@ -2094,7 +2156,7 @@ void purge_plocks(struct lockspace *ls, int nodeid, int unmount)
struct resource *r, *r2;
int purged = 0;
- if (!cfgd_enable_plock)
+ if (!cfgd_enable_plock || ls->disable_plock)
return;
list_for_each_entry_safe(r, r2, &ls->plock_resources, list) {
14 years
dlm: master - dlm_controld: check all messages against enable options
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=2092236c...
Commit: 2092236c14402ed31f9141c2d517e925fc9c12a5
Parent: 29ddcc7de91828a7d96cd2f07dd054daba7b1e1f
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Feb 22 11:31:30 2010 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 20 17:02:17 2010 -0500
dlm_controld: check all messages against enable options
Check every plock and deadlk related message against the
enable_plock and enable_deadlk options. Log error and drop
any message for a feature that's not enabled.
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/dlm_controld/cpg.c | 57 ++++++++++++++++++++++++++++++++++++++-------
1 files changed, 48 insertions(+), 9 deletions(-)
diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c
index ef0b741..20d59d5 100644
--- a/group/dlm_controld/cpg.c
+++ b/group/dlm_controld/cpg.c
@@ -1577,40 +1577,79 @@ static void deliver_cb(cpg_handle_t handle,
break;
case DLM_MSG_PLOCK:
- receive_plock(ls, hd, len);
+ if (cfgd_enable_plock)
+ receive_plock(ls, hd, len);
+ else
+ log_error("msg %d nodeid %d enable_plock %d",
+ hd->type, nodeid, cfgd_enable_plock);
break;
case DLM_MSG_PLOCK_OWN:
- receive_own(ls, hd, len);
+ if (cfgd_enable_plock && cfgd_plock_ownership)
+ receive_own(ls, hd, len);
+ else
+ log_error("msg %d nodeid %d enable_plock %d owner %d",
+ hd->type, nodeid, cfgd_enable_plock,
+ cfgd_plock_ownership);
break;
case DLM_MSG_PLOCK_DROP:
- receive_drop(ls, hd, len);
+ if (cfgd_enable_plock && cfgd_plock_ownership)
+ receive_drop(ls, hd, len);
+ else
+ log_error("msg %d nodeid %d enable_plock %d owner %d",
+ hd->type, nodeid, cfgd_enable_plock,
+ cfgd_plock_ownership);
break;
case DLM_MSG_PLOCK_SYNC_LOCK:
case DLM_MSG_PLOCK_SYNC_WAITER:
- receive_sync(ls, hd, len);
+ if (cfgd_enable_plock && cfgd_plock_ownership)
+ receive_sync(ls, hd, len);
+ else
+ log_error("msg %d nodeid %d enable_plock %d owner %d",
+ hd->type, nodeid, cfgd_enable_plock,
+ cfgd_plock_ownership);
break;
case DLM_MSG_PLOCKS_STORED:
- receive_plocks_stored(ls, hd, len);
+ if (cfgd_enable_plock)
+ receive_plocks_stored(ls, hd, len);
+ else
+ log_error("msg %d nodeid %d enable_plock %d",
+ hd->type, nodeid, cfgd_enable_plock);
break;
case DLM_MSG_DEADLK_CYCLE_START:
- receive_cycle_start(ls, hd, len);
+ if (cfgd_enable_deadlk)
+ receive_cycle_start(ls, hd, len);
+ else
+ log_error("msg %d nodeid %d enable_deadlk %d",
+ hd->type, nodeid, cfgd_enable_deadlk);
break;
case DLM_MSG_DEADLK_CYCLE_END:
- receive_cycle_end(ls, hd, len);
+ if (cfgd_enable_deadlk)
+ receive_cycle_end(ls, hd, len);
+ else
+ log_error("msg %d nodeid %d enable_deadlk %d",
+ hd->type, nodeid, cfgd_enable_deadlk);
break;
case DLM_MSG_DEADLK_CHECKPOINT_READY:
- receive_checkpoint_ready(ls, hd, len);
+ if (cfgd_enable_deadlk)
+ receive_checkpoint_ready(ls, hd, len);
+ else
+ log_error("msg %d nodeid %d enable_deadlk %d",
+ hd->type, nodeid, cfgd_enable_deadlk);
break;
case DLM_MSG_DEADLK_CANCEL_LOCK:
- receive_cancel_lock(ls, hd, len);
+ if (cfgd_enable_deadlk)
+ receive_cancel_lock(ls, hd, len);
+ else
+ log_error("msg %d nodeid %d enable_deadlk %d",
+ hd->type, nodeid, cfgd_enable_deadlk);
break;
default:
14 years
fence: master - fenced: add debug message
by David Teigland
Gitweb: http://git.fedorahosted.org/git/fence.git?p=fence.git;a=commitdiff;h=740a...
Commit: 740a1a8ba973894cce3dfa8e69db2b4cc87cc5df
Parent: 01379f5feb1eee761eb8f9cee4b3a29c48b09730
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Nov 19 17:23:23 2009 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Apr 20 16:39:39 2010 -0500
fenced: add debug message
before first calling cpg_join, to make it obvious when fenced
is stuck on cpg_join.
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
fence/fenced/cpg.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
index 0b1cd48..4ecef4a 100644
--- a/fence/fenced/cpg.c
+++ b/fence/fenced/cpg.c
@@ -2161,6 +2161,7 @@ int setup_cpg_daemon(void)
sprintf(name.value, "fenced:daemon");
name.length = strlen(name.value) + 1;
+ log_debug("cpg_join %s ...", name.value);
retry:
error = cpg_join(cpg_handle_daemon, &name);
if (error == CPG_ERR_TRY_AGAIN) {
14 years
cluster: RHEL56 - fencing: Creating manual pages fails when default value is a list
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: c57d8c5a6b3ba804a0d3242fdbd9daeb9476b58d
Parent: e70c7da2565b692bd382df0ba0f44834c134ecd2
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Tue Apr 20 12:27:47 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Tue Apr 20 19:48:18 2010 +0200
fencing: Creating manual pages fails when default value is a list
Problem was concatenating string + list in python. Lists can't be
entered using command line or stdin.
Resolves: rhbz#583053
---
fence/agents/lib/fencing.py.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index 0128a20..585baa1 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -434,7 +434,7 @@ def metadata(avail_opt, options, docs):
default = ""
if all_opt[option].has_key("default"):
- default = "default=\""+all_opt[option]["default"]+"\""
+ default = "default=\""+str(all_opt[option]["default"])+"\""
elif options.has_key("-" + all_opt[option]["getopt"][:-1]):
if options["-" + all_opt[option]["getopt"][:-1]]:
try:
@@ -442,7 +442,7 @@ def metadata(avail_opt, options, docs):
except TypeError:
## @todo/@note: Currently there is no clean way how to handle lists
## we can create a string from it but we can't set it on command line
- default = "default=\"list of values\""
+ default = "default=\"" + str(options["-" + all_opt[option]["getopt"][:-1]]) +"\""
elif options.has_key("-" + all_opt[option]["getopt"]):
default = "default=\"true\" "
14 years
cluster: RHEL56 - fencing: add information needed for automatic man page generation
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: e70c7da2565b692bd382df0ba0f44834c134ecd2
Parent: 27e67bdb516048b86026b5fb4e6d31bcb5bceae9
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Tue Apr 20 19:46:58 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Tue Apr 20 19:46:58 2010 +0200
fencing: add information needed for automatic man page generation
Resolves: rhbz#488959 (partially)
---
fence/agents/apc/fence_apc.py | 10 ++++++++-
fence/agents/apc_snmp/fence_apc_snmp.py | 11 ++++++++-
fence/agents/bladecenter/fence_bladecenter.py | 11 ++++++++-
fence/agents/cisco_mds/fence_cisco_mds.py | 7 +++++-
fence/agents/drac/fence_drac5.py | 10 ++++++++-
fence/agents/egenera/fence_egenera.pl | 6 ++--
fence/agents/eps/fence_eps.py | 13 +++++++++++-
fence/agents/ibmblade/fence_ibmblade.py | 10 ++++++++-
fence/agents/ilo/fence_ilo.py | 10 ++++++++-
fence/agents/ilo_mp/fence_ilo_mp.py | 6 ++++-
fence/agents/lib/fencing.py.py | 8 ++++--
fence/agents/lpar/fence_lpar.py | 14 ++++++------
fence/agents/rsa/fence_rsa.py | 11 +++++++++-
fence/agents/rsb/fence_rsb.py | 2 +-
fence/agents/sanbox2/fence_sanbox2.py | 10 ++++++++-
fence/agents/virsh/fence_virsh.py | 11 +++++++++-
fence/agents/vmware/fence_vmware.py | 26 ++++++++++++++++++++++++-
fence/agents/wti/fence_wti.py | 10 ++++++++-
fence/agents/xcat/fence_xcat.pl | 4 +-
19 files changed, 158 insertions(+), 32 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 2985072..b9e253e 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -201,7 +201,15 @@ def main():
if 0 == options.has_key("-c"):
options["-c"] = "\n>"
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for APC over telnet/ssh"
+ docs["longdesc"] = "fence_apc is an I/O Fencing agent \
+which can be used with the APC network power switch. It logs into device \
+via telnet/ssh and reboots a specified outlet. Lengthy telnet/ssh connections \
+should be avoided while a GFS cluster is running because the connection \
+will block any necessary fencing actions."
+ docs["vendorurl"] = "http://www.apc.com"
+ show_docs(options, docs)
## Support for -n [switch]:[plug] notation that was used before
if (options.has_key("-n") == 1) and (-1 != options["-n"].find(":")):
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index d2d67b2..6251073 100755
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -174,7 +174,7 @@ def main():
atexit.register(atexit_handler)
- snmp_define_defaults()
+ snmp_define_defaults ()
apc_snmp_define_defaults()
options=check_input(device_opt,process_input(device_opt))
@@ -189,7 +189,14 @@ def main():
if (not (options.has_key("-s"))):
options["-s"]="1"
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for APC over SNMP"
+ docs["longdesc"] = "fence_apc_snmp is an I/O Fencing agent \
+which can be used with the APC network power switch. It logs \
+into a device via SNMP and reboots a specified outlet. It supports \
+SNMP v1 and v3 with all combinations of authenticity/privacy settings."
+ docs["vendorurl"] = "http://www.apc.com"
+ show_docs(options, docs)
# Operate the fencing device
result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index 0cc189c..b4f7eb9 100755
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -105,8 +105,15 @@ def main():
options = check_input(device_opt, process_input(device_opt))
- show_docs(options)
-
+ docs = { }
+ docs["shortdesc"] = "Fence agent for IBM BladeCenter"
+ docs["longdesc"] = "fence_bladecenter is an I/O Fencing agent \
+which can be used with IBM Bladecenters with recent enough firmware that \
+includes telnet support. It logs into a Brocade chasis via telnet or ssh \
+and uses the command line interface to power on and off blades."
+ docs["vendorurl"] = "http://www.ibm.com"
+ show_docs(options, docs)
+
##
## Operate the fencing device
######
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index 032983d..2371f4a 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -107,7 +107,12 @@ def main():
options = check_input(device_opt, options)
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for Cisco MDS"
+ docs["longdesc"] = "fence_cisco_mds is an I/O Fencing agent \
+which can be used with any Cisco MDS 9000 series with SNMP enabled device."
+ docs["vendorurl"] = "http://www.cisco.com"
+ show_docs(options, docs)
if (not (options["-o"] in ["list","monitor"])):
port_oid=cisco_port2oid(options["-n"])
diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
index 11d8434..46c9fb0 100755
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -97,7 +97,15 @@ def main():
if 0 == options.has_key("-c"):
options["-c"] = "\$"
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for Dell DRAC CMC/5"
+ docs["longdesc"] = "fence_drac5 is an I/O Fencing agent \
+which can be used with the Dell Remote Access Card v5 or CMC (DRAC). \
+This device provides remote access to controlling power to a server. \
+It logs into the DRAC through the telnet/ssh interface of the card. \
+By default, the telnet interface is not enabled."
+ docs["vendorurl"] = "http://www.dell.com"
+ show_docs(options, docs)
##
## Operate the fencing device
diff --git a/fence/agents/egenera/fence_egenera.pl b/fence/agents/egenera/fence_egenera.pl
index 8607919..ce191cd 100755
--- a/fence/agents/egenera/fence_egenera.pl
+++ b/fence/agents/egenera/fence_egenera.pl
@@ -305,9 +305,9 @@ sub pserver_boot
sub pserver_shutdown
{
my $rtrn=1;
- local *egen_log;
- open(egen_log,">>/@LOGDIR@/eglog");
- print egen_log "Attempting shutdown at ".`date`."\n";
+ local *egen_log;
+ open(egen_log,">>/@LOGDIR(a)/fence_egenera.log");
+ print egen_log "Attempting shutdown at ".`date`."\n";
for (my $trys=0; $trys<20; $trys++)
{
last if (pserver_status != 0);
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index daec240..f781106 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -107,7 +107,18 @@ def main():
if (not options.has_key("-c")):
options["-c"]="hidden.htm"
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for ePowerSwitch"
+ docs["longdesc"] = "fence_eps is an I/O Fencing agent \
+which can be used with the ePowerSwitch 8M+ power switch to fence \
+connected machines. Fence agent works ONLY on 8M+ device, because \
+this is only one, which has support for hidden page feature. \
+\n.TP\n\
+Agent basically works by connecting to hidden page and pass \
+appropriate arguments to GET request. This means, that hidden \
+page feature must be enabled and properly configured."
+ docs["vendorurl"] = "http://www.epowerswitch.com"
+ show_docs(options, docs)
#Run fence action. Conn is None, beacause we always need open new http connection
result = fence_action(None, options, set_power_status, get_power_status,get_power_status)
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index a0d0884..10b548b 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -66,11 +66,19 @@ def main():
atexit.register(atexit_handler)
+ snmp_define_defaults ()
ibmblade_define_defaults()
options=check_input(device_opt,process_input(device_opt))
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for IBM BladeCenter over SNMP"
+ docs["longdesc"] = "fence_ibmblade is an I/O Fencing agent \
+which can be used with IBM BladeCenter chassis. It issues SNMP Set \
+request to BladeCenter chassis, rebooting, powering up or down \
+the specified Blade Server."
+ docs["vendorurl"] = "http://www.ibm.com"
+ show_docs(options, docs)
# Operate the fencing device
result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index 380a91d..a782250 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -70,7 +70,15 @@ def main():
LOGIN_TIMEOUT = 10
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for HP iLO"
+ docs["longdesc"] = "fence_ilo is an I/O Fencing agent \
+used for HP servers with the Integrated Light Out (iLO) PCI card.\
+The agent opens an SSL connection to the iLO card. Once the SSL \
+connection is established, the agent is able to communicate with \
+the iLO card through an XML stream."
+ docs["vendorurl"] = "http://www.hp.com"
+ show_docs(options, docs)
##
## Login and get version number
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index c1ef5da..eef4f30 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -57,7 +57,11 @@ def main():
options = check_input(device_opt, process_input(device_opt))
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for HP iLO MP"
+ docs["longdesc"] = ""
+ docs["vendorurl"] = "http://www.hp.com"
+ show_docs(options, docs)
conn = fence_login(options)
conn.send("SMCLP\r\n")
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index a7647f7..0128a20 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -376,7 +376,7 @@ def atexit_handler():
os.close(1)
except IOError:
sys.stderr.write("%s failed to close standard output\n"%(sys.argv[0]))
- sys.exit(1)
+ sys.exit(EC_GENERIC_ERROR)
def version(command, release, build_date, copyright_notice):
print command, " ", release, " ", build_date
@@ -423,8 +423,10 @@ def metadata(avail_opt, options, docs):
sorted_list.sort(lambda x, y: cmp(x[1]["order"], y[1]["order"]))
print "<?xml version=\"1.0\" ?>"
- print "<resource-agent name=\"" + os.path.basename(sys.argv[0])[:-3] + "\" shortdesc=\"" + docs["shortdesc"] + "\" >"
+ print "<resource-agent name=\"" + os.path.basename(sys.argv[0]) + "\" shortdesc=\"" + docs["shortdesc"] + "\" >"
print "<longdesc>" + docs["longdesc"] + "</longdesc>"
+ if docs.has_key("vendorurl"):
+ print "<vendor-url>" + docs["vendorurl"] + "</vendor-url>"
print "<parameters>"
for option, value in sorted_list:
if all_opt[option].has_key("shortdesc"):
@@ -467,7 +469,7 @@ def metadata(avail_opt, options, docs):
print "\t<action name=\"status\" />"
print "\t<action name=\"list\" />"
print "\t<action name=\"monitor\" />"
- print "\t<action name=\"meta-data\" />"
+ print "\t<action name=\"metadata\" />"
print "</actions>"
print "</resource-agent>"
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index a2b672c..5b12716 100755
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -139,21 +139,21 @@ def main():
atexit.register(atexit_handler)
- all_opt["login_timeout"]["default"] = 15
- all_opt["secure"]["default"] = 1
+ all_opt["login_timeout"]["default"] = "15"
+ all_opt["secure"]["default"] = "1"
options = check_input(device_opt, process_input(device_opt))
##
- ## Fence agent specific defaults
+ ## Fence agent specific settings and default values
#####
if 0 == options.has_key("-c"):
options["-c"] = [ ":~>", "]\$", "\$ " ]
- if 0 == options.has_key("-H"):
- options["-H"] = "4"
-
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for IBM LPAR"
+ docs["longdesc"] = ""
+ show_docs(options, docs)
if 0 == options.has_key("-s"):
fail_usage("Failed: You have to enter name of managed system")
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index e9eac5f..d836711 100755
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -58,7 +58,16 @@ def main():
# This device will not allow us to login even with LANG=C
options["ssh_options"] = "-F /dev/null"
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for IBM RSA"
+ docs["longdesc"] = "fence_rsa is an I/O Fencing agent \
+which can be used with the IBM RSA II management interface. It \
+logs into an RSA II device via telnet and reboots the associated \
+machine. Lengthy telnet connections to the RSA II device should \
+be avoided while a GFS cluster is running because the connection \
+will block any necessary fencing actions."
+ docs["vendorurl"] = "http://www.ibm.com"
+ show_docs(options, docs)
##
## Operate the fencing device
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index a98c0f5..cb4f436 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -181,7 +181,7 @@ def main():
try:
a = params["option"]
- a_lower = a.lower()
+ a_lower=a.lower()
if a_lower == "off":
action = POWER_OFF
elif a_lower == "on":
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 12c0e2e..c95e602 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -123,7 +123,15 @@ def main():
if 0 == options.has_key("-c"):
options["-c"] = [ " #> " ]
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for QLogic SANBox2 FC switches"
+ docs["longdesc"] = "fence_sanbox2 is an I/O Fencing agent which can be used with \
+QLogic SANBox2 FC switches. It logs into a SANBox2 switch via telnet and disables a specified \
+port. Disabling the port which a machine is connected to effectively fences that machine. \
+Lengthy telnet connections to the switch should be avoided while a GFS cluster is running \
+because the connection will block any necessary fencing actions."
+ docs["vendorurl"] = "http://www.qlogic.com"
+ show_docs(options, docs)
##
## Operate the fencing device
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index 9cb5a12..a266150 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -79,7 +79,16 @@ def main():
options["ssh_options"]="-t '/bin/bash -c \"PS1=\[EXPECT\]#\ /bin/bash --noprofile --norc\"'"
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for virsh"
+ docs["longdesc"] = "fence_virsh is an I/O Fencing agent \
+which can be used with the virtual machines managed by libvirt. \
+It logs via ssh to a dom0 and there run virsh command, which does \
+all work. \
+\n.P\n\
+By default, virsh needs root account to do properly work. So you \
+must allow ssh login in your sshd_config."
+ show_docs(options, docs)
## Operate the fencing device
conn = fence_login(options)
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index a5e2277..a88ed91 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -299,7 +299,31 @@ def main():
# Default is secure connection
options["-x"] = 1
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for VMWare"
+ docs["longdesc"] = "fence_vmware is an I/O Fencing agent \
+which can be used with the VMware ESX, VMware ESXi or VMware Server \
+to fence virtual machines.\
+\n.P\n\
+Before you can use this agent, it must be installed VI Perl Toolkit or \
+vmrun command on every node you want to make fencing.\
+\n.P\n\
+VI Perl Toolkit is preferred for VMware ESX/ESXi and Virtual Center. Vmrun \
+command is only solution for VMware Server 1/2 (this command will works against \
+ESX/ESXi 3.5 up2 and VC up2 too, but not cluster aware!) and is available as part \
+of VMware VIX API SDK package. VI Perl and VIX API SDK are both available from \
+VMware web pages (not int RHEL repository!). \
+\n.P\n\
+You can specify type of VMware you are connecting to with \\fB-d\\fP switch \
+(or \\fIvmware_type\\fR for stdin). Possible values are esx, server2 and server1.\
+Default value is esx, which will use VI Perl. With server1 and server2, vmrun \
+command is used.\
+\n.P\n\
+After you have successfully installed VI Perl Toolkit or VIX API, you should \
+be able to run fence_vmware_helper (part of this agent) or vmrun command. \
+This agent supports only vmrun from version 2.0.0 (VIX API 1.6.0)."
+ docs["vendorurl"] = "http://www.vmware.com"
+ show_docs(options, docs)
# Check vmware type and set path
vmware_check_vmware_type(options)
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 3198aeb..292dcaa 100755
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -90,7 +90,15 @@ def main():
if 0 == options.has_key("-c"):
options["-c"] = [ "RSM>", "MPC>", "IPS>", "TPS>", "NBB>", "NPS>" ]
- show_docs(options)
+ docs = { }
+ docs["shortdesc"] = "Fence agent for WTI"
+ docs["longdesc"] = "fence_wti is an I/O Fencing agent \
+which can be used with the WTI Network Power Switch (NPS). It logs \
+into an NPS via telnet or ssh and boots a specified plug. \
+Lengthy telnet connections to the NPS should be avoided while a GFS cluster \
+is running because the connection will block any necessary fencing actions."
+ docs["vendorurl"] = "http://www.wti.com"
+ show_docs(options, docs)
##
## Operate the fencing device
diff --git a/fence/agents/xcat/fence_xcat.pl b/fence/agents/xcat/fence_xcat.pl
index 209c680..1b5b2c2 100755
--- a/fence/agents/xcat/fence_xcat.pl
+++ b/fence/agents/xcat/fence_xcat.pl
@@ -138,7 +138,7 @@ if (@ARGV > 0) {
fail_usage "Unknown parameter." if (@ARGV > 0);
fail_usage "No '-n' flag specified." unless defined $opt_n;
- $opt_o=lc($opt_o)
+ $opt_o=lc($opt_o);
fail_usage "Unrecognised action '$opt_o' for '-o' flag"
unless $opt_o =~ /^(on|off|reset|stat)$/;
@@ -146,7 +146,7 @@ if (@ARGV > 0) {
get_options_stdin();
fail "failed: no plug number" unless defined $opt_n;
- $opt_o=lc($opt_o)
+ $opt_o=lc($opt_o);
fail "failed: unrecognised action: $opt_o"
unless $opt_o =~ /^(on|off|reset|stat)$/;
}
14 years
cluster: RHEL56 - fence_ilo: remove openSSL as python dep as we don't need it here
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 27e67bdb516048b86026b5fb4e6d31bcb5bceae9
Parent: bd170f06917930694790c2a69281cb6110902293
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Tue Apr 20 19:17:30 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Tue Apr 20 19:17:30 2010 +0200
fence_ilo: remove openSSL as python dep as we don't need it here
Resolves: rhbz#583049
---
fence/agents/ilo/fence_ilo.py | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index fcf4b0c..380a91d 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -15,7 +15,6 @@
import sys, re, pexpect, socket
sys.path.append("/usr/lib/fence")
from fencing import *
-from OpenSSL import SSL
#BEGIN_VERSION_GENERATION
FENCE_RELEASE_NAME=""
14 years
cluster: RHEL56 - fencing: Correct return codes for operation 'status'
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: bd170f06917930694790c2a69281cb6110902293
Parent: c774ea0aabf408e80e1afd9f2caf40b4834c6a5e
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Tue Apr 20 19:07:32 2010 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Tue Apr 20 19:07:32 2010 +0200
fencing: Correct return codes for operation 'status'
Fixes all perl + python based fence agents (except fence_scsi)
Resolves: rhbz#583034 (partially)
---
fence/agents/apc/fence_apc.py | 4 +++-
fence/agents/apc_snmp/fence_apc_snmp.py | 3 ++-
fence/agents/baytech/fence_baytech.pl | 8 +++++++-
fence/agents/bladecenter/fence_bladecenter.py | 4 +++-
fence/agents/bullpap/fence_bullpap.pl | 6 +++++-
fence/agents/cisco_mds/fence_cisco_mds.py | 4 +++-
fence/agents/drac/fence_drac.pl | 17 ++++++++++++-----
fence/agents/drac/fence_drac5.py | 6 ++++--
fence/agents/eps/fence_eps.py | 4 +++-
fence/agents/ibmblade/fence_ibmblade.py | 3 ++-
fence/agents/ilo/fence_ilo.py | 4 +++-
fence/agents/ilo_mp/fence_ilo_mp.py | 4 +++-
fence/agents/lib/fencing.py.py | 10 ++++++++--
fence/agents/lpar/fence_lpar.py | 3 ++-
fence/agents/rsa/fence_rsa.py | 6 ++++--
fence/agents/rsb/fence_rsb.py | 8 ++++++++
fence/agents/sanbox2/fence_sanbox2.py | 4 +++-
fence/agents/virsh/fence_virsh.py | 3 ++-
fence/agents/vmware/fence_vmware.py | 3 ++-
fence/agents/wti/fence_wti.py | 4 +++-
20 files changed, 82 insertions(+), 26 deletions(-)
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
index 3a8c194..2985072 100755
--- a/fence/agents/apc/fence_apc.py
+++ b/fence/agents/apc/fence_apc.py
@@ -213,7 +213,7 @@ def main():
## Operate the fencing device
####
conn = fence_login(options)
- fence_action(conn, options, set_power_status, get_power_status, get_power_status)
+ result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
##
## Logout from system
@@ -229,6 +229,8 @@ def main():
pass
except pexpect.ExceptionPexpect:
pass
+
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
index 943902c..d2d67b2 100755
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ b/fence/agents/apc_snmp/fence_apc_snmp.py
@@ -192,7 +192,8 @@ def main():
show_docs(options)
# Operate the fencing device
- fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
+ result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/baytech/fence_baytech.pl b/fence/agents/baytech/fence_baytech.pl
index 39d91da..1549430 100755
--- a/fence/agents/baytech/fence_baytech.pl
+++ b/fence/agents/baytech/fence_baytech.pl
@@ -583,7 +583,13 @@ elsif ($action =~ /status/i)
{
print "Outlet '$bt_name' is $bt_state and is ".
(($bt_locked eq "")?"not ":"")."Locked\n";
- $exit=0;
+
+ if ($bt_state =~ /on/i)
+ {
+ $exit=0;
+ } else {
+ $exit=2;
+ }
}
elsif ($bt_locked ne "")
{
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
index b5b2238..0cc189c 100755
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ b/fence/agents/bladecenter/fence_bladecenter.py
@@ -111,7 +111,7 @@ def main():
## Operate the fencing device
######
conn = fence_login(options)
- fence_action(conn, options, set_power_status, get_power_status, get_blades_list)
+ result = fence_action(conn, options, set_power_status, get_power_status, get_blades_list)
##
## Logout from system
@@ -123,6 +123,8 @@ def main():
pass
except pexpect.ExceptionPexpect:
pass
+
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/bullpap/fence_bullpap.pl b/fence/agents/bullpap/fence_bullpap.pl
index a53c8e1..a63b19c 100755
--- a/fence/agents/bullpap/fence_bullpap.pl
+++ b/fence/agents/bullpap/fence_bullpap.pl
@@ -309,6 +309,7 @@ elsif (/^status$/i) { $action = "status"; }
#
$success=0;
$_ = $action;
+my $exit_code=0;
if (/(on|off)/)
{
my $timeout = 120; # 120 = max of (60, 120). Max timeout for "on"
@@ -353,6 +354,9 @@ elsif (/status/)
get_power_state $host,$domain,$login,$passwd;
$state=$_;
$success = 1 if defined $state;
+ if ($state eq "OFF") {
+ $exit_code = 2;
+ }
}
else
{
@@ -363,7 +367,7 @@ if ($success)
{
print "success: domain $domain $action". ((defined $state) ? ": $state":"")
."\n" unless defined $quiet;
- exit 0;
+ exit $exit_code;
}
else
{
diff --git a/fence/agents/cisco_mds/fence_cisco_mds.py b/fence/agents/cisco_mds/fence_cisco_mds.py
index cd25e96..032983d 100644
--- a/fence/agents/cisco_mds/fence_cisco_mds.py
+++ b/fence/agents/cisco_mds/fence_cisco_mds.py
@@ -113,7 +113,9 @@ def main():
port_oid=cisco_port2oid(options["-n"])
# Operate the fencing device
- fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
+ result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
+
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/drac/fence_drac.pl b/fence/agents/drac/fence_drac.pl
index 3d8c497..e6dfbd9 100755
--- a/fence/agents/drac/fence_drac.pl
+++ b/fence/agents/drac/fence_drac.pl
@@ -457,7 +457,7 @@ sub do_action
if ($status =~ /^on$/i)
{
msg "success: already on";
- return;
+ return 0;
}
set_power_status on;
@@ -470,7 +470,7 @@ sub do_action
if ($status =~ /^off$/i)
{
msg "success: already off";
- return;
+ return 0;
}
set_power_status off;
@@ -494,12 +494,19 @@ sub do_action
elsif ($action =~ /^status$/i)
{
msg "status: $status";
- return;
+ if ($status =~ /on/i)
+ {
+ return 0;
+ } else {
+ return 2;
+ }
}
else
{
fail "failed: unrecognised action: '$action'";
}
+
+ return 0;
}
#
@@ -663,10 +670,10 @@ elsif ($drac_version eq $DRAC_VERSION_MC)
unless defined $modulename;
}
-do_action;
+my $res = do_action;
logout;
-exit 0;
+exit $res;
diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
index d93501a..11d8434 100755
--- a/fence/agents/drac/fence_drac5.py
+++ b/fence/agents/drac/fence_drac5.py
@@ -98,7 +98,7 @@ def main():
options["-c"] = "\$"
show_docs(options)
-
+
##
## Operate the fencing device
######
@@ -115,7 +115,7 @@ def main():
## Assume this is DRAC 5 by default as we don't want to break anything
options["model"]="DRAC 5"
- fence_action(conn, options, set_power_status, get_power_status, get_list_devices)
+ result = fence_action(conn, options, set_power_status, get_power_status, get_list_devices)
##
## Logout from system
@@ -127,6 +127,8 @@ def main():
pass
except pexpect.ExceptionPexpect:
pass
+
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
index 1660931..daec240 100644
--- a/fence/agents/eps/fence_eps.py
+++ b/fence/agents/eps/fence_eps.py
@@ -110,7 +110,9 @@ def main():
show_docs(options)
#Run fence action. Conn is None, beacause we always need open new http connection
- fence_action(None, options, set_power_status, get_power_status,get_power_status)
+ result = fence_action(None, options, set_power_status, get_power_status,get_power_status)
+
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/ibmblade/fence_ibmblade.py b/fence/agents/ibmblade/fence_ibmblade.py
index 08022ea..a0d0884 100644
--- a/fence/agents/ibmblade/fence_ibmblade.py
+++ b/fence/agents/ibmblade/fence_ibmblade.py
@@ -73,7 +73,8 @@ def main():
show_docs(options)
# Operate the fencing device
- fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
+ result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
index cf2993d..fcf4b0c 100755
--- a/fence/agents/ilo/fence_ilo.py
+++ b/fence/agents/ilo/fence_ilo.py
@@ -107,7 +107,9 @@ def main():
##
## Fence operations
####
- fence_action(conn, options, set_power_status, get_power_status, None)
+ result = fence_action(conn, options, set_power_status, get_power_status, None)
+
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/ilo_mp/fence_ilo_mp.py b/fence/agents/ilo_mp/fence_ilo_mp.py
index 98d7d69..c1ef5da 100644
--- a/fence/agents/ilo_mp/fence_ilo_mp.py
+++ b/fence/agents/ilo_mp/fence_ilo_mp.py
@@ -65,7 +65,7 @@ def main():
##
## Fence operations
####
- fence_action(conn, options, set_power_status, get_power_status)
+ result = fence_action(conn, options, set_power_status, get_power_status)
try:
conn.send("exit\r\n")
@@ -74,5 +74,7 @@ def main():
except pexpect.ExceptionPexpect:
pass
+ sys.exit(result)
+
if __name__ == "__main__":
main()
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index b54d1a8..a7647f7 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -387,7 +387,7 @@ def fail_usage(message = ""):
if len(message) > 0:
sys.stderr.write(message+"\n")
sys.stderr.write("Please use '-h' for usage\n")
- sys.exit(EC_BAD_ARGS)
+ sys.exit(EC_GENERIC_ERROR)
def fail(error_code):
message = {
@@ -400,7 +400,7 @@ def fail(error_code):
EC_STATUS_HMC : "Failed: Either unable to obtaion correct plug status, partition is not available or incorrect HMC version used"
}[error_code] + "\n"
sys.stderr.write(message)
- sys.exit(error_code)
+ sys.exit(EC_GENERIC_ERROR)
def usage(avail_opt):
global all_opt
@@ -703,6 +703,8 @@ def show_docs(options, docs = None):
sys.exit(0)
def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None):
+ result = 0
+
## Process options that manipulate fencing device
#####
if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition")):
@@ -784,8 +786,12 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None
print "Success: Rebooted"
elif options["-o"] == "status":
print "Status: " + status.upper()
+ if status.upper() == "OFF":
+ result = 2
elif options["-o"] == "monitor":
1
+
+ return result
def fence_login(options):
force_ipvx=""
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
index 3a22edc..a2b672c 100755
--- a/fence/agents/lpar/fence_lpar.py
+++ b/fence/agents/lpar/fence_lpar.py
@@ -168,7 +168,7 @@ def main():
## Operate the fencing device
####
conn = fence_login(options)
- fence_action(conn, options, set_power_status, get_power_status, get_lpar_list)
+ result = fence_action(conn, options, set_power_status, get_power_status, get_lpar_list)
##
## Logout from system
@@ -181,5 +181,6 @@ def main():
except pexpect.ExceptionPexpect:
pass
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
index ed794fa..e9eac5f 100755
--- a/fence/agents/rsa/fence_rsa.py
+++ b/fence/agents/rsa/fence_rsa.py
@@ -64,7 +64,7 @@ def main():
## Operate the fencing device
######
conn = fence_login(options)
- fence_action(conn, options, set_power_status, get_power_status, None)
+ result = fence_action(conn, options, set_power_status, get_power_status, None)
##
## Logout from system
@@ -75,7 +75,9 @@ def main():
except exceptions.OSError:
pass
except pexpect.ExceptionPexpect:
- pass
+ pass
+
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
index 25a2826..a98c0f5 100755
--- a/fence/agents/rsb/fence_rsb.py
+++ b/fence/agents/rsb/fence_rsb.py
@@ -60,6 +60,9 @@ def main():
POWER_STATUS = 2
POWER_REBOOT = 3
+ STATUS_ON = 0
+ STATUS_OFF = 2
+
power_command_issued = 0
address = ""
@@ -73,6 +76,8 @@ def main():
standard_err = 2
+ result = 0
+
completed_action = 0
#set up regex list
@@ -382,8 +387,10 @@ def main():
print "Determining power state..."
if power_state == 1:
print "Server is On"
+ result = STATUS_ON
elif power_state == 0:
print "Server is Off"
+ result = STATUS_OFF
else:
os.write(standard_err, ("FENCE: Cannot determine power state: %s" % buf))
sys.exit(1)
@@ -397,6 +404,7 @@ def main():
sock.write("\r")
sock.close()
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/sanbox2/fence_sanbox2.py b/fence/agents/sanbox2/fence_sanbox2.py
index 4581974..12c0e2e 100644
--- a/fence/agents/sanbox2/fence_sanbox2.py
+++ b/fence/agents/sanbox2/fence_sanbox2.py
@@ -139,7 +139,7 @@ def main():
sys.stderr.write("Failed: Unable to switch to admin section\n")
sys.exit(EC_GENERIC_ERROR)
- fence_action(conn, options, set_power_status, get_power_status, get_list_devices)
+ result = fence_action(conn, options, set_power_status, get_power_status, get_list_devices)
##
## Logout from system
@@ -153,5 +153,7 @@ def main():
except pexpect.ExceptionPexpect:
pass
+ sys.exit(result)
+
if __name__ == "__main__":
main()
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
index 7913cd2..9cb5a12 100644
--- a/fence/agents/virsh/fence_virsh.py
+++ b/fence/agents/virsh/fence_virsh.py
@@ -83,7 +83,7 @@ def main():
## Operate the fencing device
conn = fence_login(options)
- fence_action(conn, options, set_power_status, get_power_status, get_outlets_status)
+ result = fence_action(conn, options, set_power_status, get_power_status, get_outlets_status)
## Logout from system
try:
@@ -94,5 +94,6 @@ def main():
except pexpect.ExceptionPexpect:
pass
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
index 7e51df5..a5e2277 100644
--- a/fence/agents/vmware/fence_vmware.py
+++ b/fence/agents/vmware/fence_vmware.py
@@ -310,8 +310,9 @@ def main():
fail_usage("Unsupported version of vmrun command! You must use at least version %d!"%(VMRUN_MINIMUM_REQUIRED_VERSION))
# Operate the fencing device
- fence_action(None, options, set_power_status, get_power_status, get_outlets_status)
+ result = fence_action(None, options, set_power_status, get_power_status, get_outlets_status)
+ sys.exit(result)
if __name__ == "__main__":
main()
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
index 888695f..3198aeb 100755
--- a/fence/agents/wti/fence_wti.py
+++ b/fence/agents/wti/fence_wti.py
@@ -131,7 +131,7 @@ def main():
else:
conn = fence_login(options)
- fence_action(conn, options, set_power_status, get_power_status, get_power_status)
+ result = fence_action(conn, options, set_power_status, get_power_status, get_power_status)
##
## Logout from system
@@ -143,6 +143,8 @@ def main():
pass
except pexpect.ExceptionPexpect:
pass
+
+ sys.exit(result)
if __name__ == "__main__":
main()
14 years
gfs2-utils: master - gfs2_convert: Doesn't convert indirectly-pointed extended attributes correctly
by Abhijith Das
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 3ec446ad397ab64d614e5f5a5cbca81f548cd78d
Parent: 56b6aa902c70fcdc78edf58352d850f62f1e67be
Author: Abhijith Das <adas(a)redhat.com>
AuthorDate: Wed Apr 7 12:04:34 2010 -0500
Committer: Abhijith Das <adas(a)redhat.com>
CommitterDate: Tue Apr 20 10:37:16 2010 -0500
gfs2_convert: Doesn't convert indirectly-pointed extended attributes correctly
When the extended attributes for a file don't fit
in one fs block, the dinode->di_eattr block becomes
an indirect block that contains pointers to blocks
that actually contain the xattrs. The gfs1 indirect
block header is different (larger) than that of gfs2
and this causes an incorrect conversion. The
resulting gfs2 filesystem cannot display the xattrs
because of leading nulls in the indirect block. This
patch adjusts this correctly.
Resolves: rhbz#579626
Signed-off-by: Abhi Das <adas(a)redhat.com>
---
gfs2/convert/gfs2_convert.c | 45 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 324342d..3f72b51 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -941,6 +941,45 @@ static int fix_cdpn_symlink(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, s
return ret;
}
+
+/*
+ * fix_xattr -
+ * Extended attributes can be either direct (in the ip->i_di.di_eattr block) or
+ * then can be at a maximum of 1 indirect level. Multiple levels of indirection
+ * are not supported. If the di_eattr block contains extended attribute data,
+ * i.e block type = GFS_METATYPE_EA, we ignore it.
+ * If the di_eattr block contains block pointers to extended attributes we need
+ * to fix the header. gfs1 uses gfs_indirect as the header which is 64 bytes
+ * bigger than gfs2_meta_header that gfs2 uses.
+ */
+static int fix_xattr(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh, struct gfs2_inode *ip)
+{
+ int ret = 0, len, old_hdr_sz, new_hdr_sz;
+ struct gfs2_buffer_head *eabh;
+ char *buf;
+
+ /* Read in the i_di.di_eattr block */
+ eabh = bread(sbp, ip->i_di.di_eattr);
+ if (!gfs2_check_meta(eabh, GFS_METATYPE_IN)) {/* if it is an indirect block */
+ len = sbp->bsize - sizeof(struct gfs_indirect);
+ buf = malloc(len);
+ if (!buf) {
+ log_crit("Error: out of memory.\n");
+ return -1;
+ }
+ old_hdr_sz = sizeof(struct gfs_indirect);
+ new_hdr_sz = sizeof(struct gfs2_meta_header);
+ memcpy(buf, eabh->b_data + old_hdr_sz, sbp->bsize - old_hdr_sz);
+ memset(eabh->b_data + new_hdr_sz, 0, sbp->bsize - new_hdr_sz);
+ memcpy(eabh->b_data + new_hdr_sz, buf, len);
+ free(buf);
+ bmodified(eabh);
+ }
+ brelse(eabh);
+
+ return ret;
+}
+
/* ------------------------------------------------------------------------- */
/* adjust_inode - change an inode from gfs1 to gfs2 */
/* */
@@ -1032,6 +1071,12 @@ static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
if (ret)
return -1;
}
+ /* Check for extended attributes */
+ if (inode->i_di.di_eattr) {
+ ret = fix_xattr(sbp, bh, inode);
+ if (ret)
+ return -1;
+ }
}
bmodified(inode->i_bh);
14 years