cluster: RHEL511 - Remove locking from gfs_write_inode
by Benjamin Marzinski
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=ede0a6765d5...
Commit: ede0a6765d5c9468d2b10da910c8907ccf9e5ed7
Parent: b9dd9ffc8fd3bf6baf43c2672a795a46557ad292
Author: Benjamin Marzinski <bmarzins(a)redhat.com>
AuthorDate: Fri Jun 6 14:28:02 2014 -0500
Committer: Benjamin Marzinski <bmarzins(a)redhat.com>
CommitterDate: Fri Jun 6 14:37:27 2014 -0500
Remove locking from gfs_write_inode
gfs_write_inode is always called with the inode locked. When it locked
the the inode glock, it was grabbing locks in the wrong order. This could
gfs to deadlock. Now, gfs_write_inode never grabs a glock itself. Instead,
it only writes the inode out to disk if it was called with the glock already
held. Unfortunately, this means that it does not write out the inode in
many of the cases where it should.
---
gfs-kernel/src/gfs/ops_super.c | 18 +++---------------
1 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/gfs-kernel/src/gfs/ops_super.c b/gfs-kernel/src/gfs/ops_super.c
index 10dbff7..bfb236b 100644
--- a/gfs-kernel/src/gfs/ops_super.c
+++ b/gfs-kernel/src/gfs/ops_super.c
@@ -56,29 +56,20 @@ gfs_write_inode(struct inode *inode, int sync)
struct gfs_inode *ip = get_v2ip(inode);
struct buffer_head *dibh;
struct gfs_holder i_gh;
- int need_unlock = 0;
if (!ip)
return 0;
atomic_inc(&ip->i_sbd->sd_ops_super);
- if (current->flags & PF_MEMALLOC || get_transaction)
- goto do_flush;
-
- if (!gfs_glock_is_locked_by_me(ip->i_gl)) {
- ret = gfs_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &i_gh);
- if (ret)
- goto do_flush;
- need_unlock = 1;
- }
- else if (!gfs_glock_is_held_excl(ip->i_gl))
+ if (current->flags & PF_MEMALLOC || get_transaction ||
+ !gfs_glock_is_locked_by_me(ip->i_gl) || !gfs_glock_is_held_excl(ip->i_gl))
goto do_flush;
/* Trans may require:
one dinode block. */
ret = gfs_trans_begin(ip->i_sbd, 1, 0);
if (ret)
- goto do_unlock;
+ goto do_flush;
ret = gfs_get_inode_buffer(ip, &dibh);
if (ret == 0) {
@@ -90,9 +81,6 @@ gfs_write_inode(struct inode *inode, int sync)
gfs_trans_end(ip->i_sbd);
-do_unlock:
- if (need_unlock)
- gfs_glock_dq_uninit(&i_gh);
do_flush:
if (sync)
gfs_log_flush_glock(ip->i_gl, 0);
9 years, 11 months
cluster: RHEL6 - gfs2_edit: Ensure all leaf blocks in per_node are saved
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=84b78a12608...
Commit: 84b78a126085a34fc4b7bf39911431b5993bb221
Parent: 961deb270edfe04820e6c3bf75c949690e0d03de
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Jun 5 01:41:13 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Jun 6 16:34:53 2014 +0100
gfs2_edit: Ensure all leaf blocks in per_node are saved
block_is_in_per_node() only checks the first leaf block when the
per_node directory has been split (when the block size is small and/or
the number of journals is large). This caused savemeta to treat the
files in per_node as user data and so didn't save their metadata. Add an
outer loop to iterate over the indirect blocks.
Resolves: rhbz#1081523
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/hexedit.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index c3a450b3..d275069 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -1672,7 +1672,7 @@ int block_is_per_node(void)
/* ------------------------------------------------------------------------ */
int block_is_in_per_node(void)
{
- int d;
+ int i;
struct gfs2_inode *per_node_di;
if (sbd.gfs1)
@@ -1683,9 +1683,12 @@ int block_is_in_per_node(void)
do_dinode_extended(&per_node_di->i_di, per_node_di->i_bh);
inode_put(&per_node_di);
- for (d = 0; d < indirect->ii[0].dirents; d++) {
- if (block == indirect->ii[0].dirent[d].block)
- return TRUE;
+ for (i = 0; i < indirect_blocks; i++) {
+ int d;
+ for (d = 0; d < indirect->ii[i].dirents; d++) {
+ if (block == indirect->ii[i].dirent[d].block)
+ return TRUE;
+ }
}
return FALSE;
}
9 years, 11 months
cluster: RHEL6 - gfs2_edit: Fix loop arithmetic in restore_data
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=961deb270ed...
Commit: 961deb270edfe04820e6c3bf75c949690e0d03de
Parent: a0e022ff14116bc6323222a8acd3ca9a894b4974
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Tue Jun 3 23:11:12 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Wed Jun 4 16:17:09 2014 +0100
gfs2_edit: Fix loop arithmetic in restore_data
Compiling the previous commit with -O2 optimized away a memcmp and
highlighted a bug related to how the loop which checked for a superblock
in the first 256 bytes calculated the offsets to check within the
buffer. This fixes the arithmetic and tidies up the code to clarify what
this loop is doing, eradicating the memcmp for good measure.
Resolves: rhbz#1081523
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index 27480cb..b06d164 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -857,8 +857,9 @@ static int restore_data(int fd, gzFile gzin_fd, int printblocksonly,
uint16_t buf16;
int first = 1, pos, gzerr;
char rdbuf[256];
- char gfs_superblock_id[8] = {0x01, 0x16, 0x19, 0x70,
- 0x00, 0x00, 0x00, 0x01};
+ uint32_t magic = cpu_to_be32(GFS2_MAGIC);
+ const size_t hdsz = sizeof(uint64_t) + sizeof(uint16_t);
+ const size_t rdend = sizeof(rdbuf) - hdsz - sizeof(uint32_t);
if (!printblocksonly)
lseek(fd, 0, SEEK_SET);
@@ -868,15 +869,16 @@ static int restore_data(int fd, gzFile gzin_fd, int printblocksonly,
fprintf(stderr, "Error: File is too small.\n");
return -1;
}
- for (pos = startpos; pos < startpos + sizeof(rdbuf) - sizeof(uint64_t) - sizeof(uint16_t);
- pos++) {
- if (!memcmp(&rdbuf[pos + sizeof(uint64_t) + sizeof(uint16_t)],
- gfs_superblock_id, sizeof(gfs_superblock_id))) {
+
+ for (pos = startpos; pos < rdend; pos++) {
+ char *buf = &rdbuf[pos + hdsz];
+ uint32_t maybemagic = *(uint32_t *)buf;
+ if (maybemagic == magic)
break;
- }
}
- if (pos == startpos + sizeof(rdbuf) - sizeof(uint64_t) - sizeof(uint16_t))
+ if (pos == rdend)
pos = startpos;
+
if (gzseek(gzin_fd, pos, SEEK_SET) != pos) {
fprintf(stderr, "bad seek: %s from %s:%d: "
"offset %lld (0x%llx)\n", strerror(errno),
9 years, 11 months
gfs2-utils: master - libgfs2: Zero de_inum.no_addr when deleting dirents
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=f4fc86b2...
Commit: f4fc86b28a551252bd3b8fc1f7e19bf161c600b2
Parent: 24cac7395ef2559e7bd674e7ba543267672a4bd9
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Jun 5 10:53:07 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Thu Jun 5 11:03:49 2014 +0100
libgfs2: Zero de_inum.no_addr when deleting dirents
libgfs2 left deleted dirents in leaf blocks which have been split, which
is fine, but it only zeroed the no_formal_ino field, causing gfs2_edit
to display deleted dirents when printing leaf blocks. Zero the no_addr
field too, as the kernel code does.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/libgfs2/fs_ops.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index fdd4438..015b974 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -826,6 +826,7 @@ void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
dip->i_di.di_entries--;
}
if (!prev) {
+ cur->de_inum.no_addr = 0;
cur->de_inum.no_formal_ino = 0;
return;
}
9 years, 11 months
gfs2-utils: master - gfs2-utils tests: Add small-block savemeta tests
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=24cac739...
Commit: 24cac7395ef2559e7bd674e7ba543267672a4bd9
Parent: 11b917f96e4171b206da53a7b65262e152250180
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Jun 5 01:51:21 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Thu Jun 5 01:51:21 2014 +0100
gfs2-utils tests: Add small-block savemeta tests
Add some savemeta/restoremeta test scenarios which were used to discover
some recently fixed bugs, to make sure they stay fixed. They mainly cover
scenarios relating to small block sizes.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
tests/edit.at | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/tests/edit.at b/tests/edit.at
index e2a702c..49f4a58 100644
--- a/tests/edit.at
+++ b/tests/edit.at
@@ -1,7 +1,7 @@
AT_TESTED([gfs2_edit])
AT_BANNER([gfs2_edit tests])
-AT_SETUP([Savemeta/restoremeta, defaults])
+AT_SETUP([Save/restoremeta, defaults])
GFS_TGT_REGEN
AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT $(($(gfs_max_blocks 4096)/2))], 0, [ignore], [ignore])
AT_CHECK([gfs2_edit savemeta $GFS_TGT test.meta > savemeta.log], 0, [ignore], [ignore])
@@ -13,10 +13,38 @@ AT_CHECK([gfs2_edit restoremeta test.meta $GFS_TGT], 0, [ignore], [ignore])
AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
AT_CLEANUP
-AT_SETUP([Savemeta/restoremeta, no compression])
+AT_SETUP([Save/restoremeta, no compression])
GFS_TGT_REGEN
AT_CHECK([$GFS_MKFS -p lock_nolock $GFS_TGT $(($(gfs_max_blocks 4096)/2))], 0, [ignore], [ignore])
AT_CHECK([gfs2_edit savemeta -z0 $GFS_TGT test.meta], 0, [ignore], [ignore])
+GFS_TGT_REGEN
+AT_CHECK([gfs2_edit restoremeta test.meta $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
+AT_CLEANUP
+
+AT_SETUP([Save/restoremeta, min. block size])
+GFS_TGT_REGEN
+AT_CHECK([$GFS_MKFS -p lock_nolock -b512 $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([gfs2_edit savemeta -z0 $GFS_TGT test.meta], 0, [ignore], [ignore])
+GFS_TGT_REGEN
+AT_CHECK([gfs2_edit restoremeta test.meta $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
+AT_CLEANUP
+
+AT_SETUP([Save/restoremeta, 4 journals])
+GFS_TGT_REGEN
+AT_CHECK([$GFS_MKFS -p lock_nolock -j4 -J8 $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([gfs2_edit savemeta -z0 $GFS_TGT test.meta], 0, [ignore], [ignore])
+GFS_TGT_REGEN
+AT_CHECK([gfs2_edit restoremeta test.meta $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
+AT_CLEANUP
+
+AT_SETUP([Save/restoremeta, min. block size, 4 journals])
+GFS_TGT_REGEN
+AT_CHECK([$GFS_MKFS -p lock_nolock -b512 -j4 -J8 $GFS_TGT], 0, [ignore], [ignore])
+AT_CHECK([gfs2_edit savemeta -z0 $GFS_TGT test.meta], 0, [ignore], [ignore])
+GFS_TGT_REGEN
AT_CHECK([gfs2_edit restoremeta test.meta $GFS_TGT], 0, [ignore], [ignore])
AT_CHECK([fsck.gfs2 -n $GFS_TGT], 0, [ignore], [ignore])
AT_CLEANUP
9 years, 11 months
gfs2-utils: master - gfs2_edit: Ensure all leaf blocks in per_node are saved
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=11b917f9...
Commit: 11b917f96e4171b206da53a7b65262e152250180
Parent: 18d0318b96a6b88698fb9ffdfbb3176ae7119f9e
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Jun 5 01:41:13 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Thu Jun 5 01:41:13 2014 +0100
gfs2_edit: Ensure all leaf blocks in per_node are saved
block_is_in_per_node() only checks the first leaf block when the
per_node directory has been split (when the block size is small and/or
the number of journals is large). This caused savemeta to treat the
files in per_node as user data and so didn't save their metadata. Add an
outer loop to iterate over the indirect blocks.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index a43045f..360b144 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -75,7 +75,7 @@ static int block_is_a_journal(void)
static int block_is_in_per_node(void)
{
- int d;
+ int i;
struct gfs2_inode *per_node_di;
if (sbd.gfs1)
@@ -90,9 +90,12 @@ static int block_is_in_per_node(void)
do_dinode_extended(&per_node_di->i_di, per_node_di->i_bh);
inode_put(&per_node_di);
- for (d = 0; d < indirect->ii[0].dirents; d++) {
- if (block == indirect->ii[0].dirent[d].block)
- return TRUE;
+ for (i = 0; i < indirect_blocks; i++) {
+ int d;
+ for (d = 0; d < indirect->ii[i].dirents; d++) {
+ if (block == indirect->ii[i].dirent[d].block)
+ return TRUE;
+ }
}
return FALSE;
}
9 years, 11 months
gfs2-utils: master - gfs2-utils: Fix two logic errors
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=18d0318b...
Commit: 18d0318b96a6b88698fb9ffdfbb3176ae7119f9e
Parent: a96c74f47ec41e85a5cd6eef969d7231831a2c37
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Thu Jun 5 01:35:44 2014 +0100
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Thu Jun 5 01:40:18 2014 +0100
gfs2-utils: Fix two logic errors
Two uses of lgfs2_get_leaf_ptr() were still expecting it to return 0 on
failure. Remove the negations.
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/edit/savemeta.c | 2 +-
gfs2/fsck/pass2.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index e336100..a43045f 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -542,7 +542,7 @@ static void save_inode_data(struct metafd *mfd)
int li;
for (li = 0; li < (1 << inode->i_di.di_depth); li++) {
- if (!lgfs2_get_leaf_ptr(inode, li, &leaf_no)) {
+ if (lgfs2_get_leaf_ptr(inode, li, &leaf_no)) {
fprintf(stderr, "Could not read leaf index %d in dinode %"PRIu64"\n", li,
(uint64_t)inode->i_di.di_num.no_addr);
exit(-1);
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 2474ccb..2971b8c 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -370,7 +370,7 @@ static int wrong_leaf(struct gfs2_inode *ip, struct gfs2_inum *entry,
de->de_type) == 0) {
log_err(_("The misplaced directory entry was moved to a "
"valid leaf block.\n"));
- if (!lgfs2_get_leaf_ptr(ip, hash_index, &real_leaf)) {
+ if (lgfs2_get_leaf_ptr(ip, hash_index, &real_leaf)) {
log_err(_("Could not read leaf %d in dinode %"PRIu64": %s\n"), hash_index,
(uint64_t)ip->i_di.di_num.no_addr, strerror(errno));
}
9 years, 11 months
fence-agents: master - [clean] set_multi_power_fn now also includes support for --retry-on
by Marek Grác
Gitweb: http://git.fedorahosted.org/git/?p=fence-agents.git;a=commitdiff;h=1b5cc4...
Commit: 1b5cc47b0fa7dc806c6a30d9296cf5be488a1518
Parent: 5a490358e2b3ab10da9de3f2a20f6725c87f0476
Author: Marek 'marx' Grac <mgrac(a)redhat.com>
AuthorDate: Wed Jun 4 14:12:00 2014 +0200
Committer: Marek 'marx' Grac <mgrac(a)redhat.com>
CommitterDate: Wed Jun 4 14:12:00 2014 +0200
[clean] set_multi_power_fn now also includes support for --retry-on
Previously, the code was there multiple times.
---
fence/agents/lib/fencing.py.py | 92 +++++++++++++++-------------------------
1 files changed, 35 insertions(+), 57 deletions(-)
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
index fb9b006..431b363 100644
--- a/fence/agents/lib/fencing.py.py
+++ b/fence/agents/lib/fencing.py.py
@@ -780,40 +780,29 @@ def check_input(device_opt, opt):
return options
-def wait_power_status(tn, options, get_power_fn):
- for dummy in xrange(int(options["--power-timeout"])):
- if get_multi_power_fn(tn, options, get_power_fn) != options["--action"]:
- time.sleep(1)
- else:
- return 1
- return 0
-
## Obtain a power status from possibly more than one plug
## "on" is returned if at least one plug is ON
######
def get_multi_power_fn(tn, options, get_power_fn):
status = "off"
- if options.has_key("--plugs"):
- for plug in options["--plugs"]:
- try:
- options["--uuid"] = str(uuid.UUID(plug))
- except ValueError:
- pass
- except KeyError:
- pass
+ for plug in options["--plugs"]:
+ try:
+ options["--uuid"] = str(uuid.UUID(plug))
+ except ValueError:
+ pass
+ except KeyError:
+ pass
- options["--plug"] = plug
- plug_status = get_power_fn(tn, options)
- if plug_status != "off":
- status = plug_status
- else:
- status = get_power_fn(tn, options)
+ options["--plug"] = plug
+ plug_status = get_power_fn(tn, options)
+ if plug_status != "off":
+ status = plug_status
return status
-def set_multi_power_fn(tn, options, set_power_fn):
- if options.has_key("--plugs"):
+def set_multi_power_fn(tn, options, set_power_fn, get_power_fn, retry_attempts = 1):
+ for _ in range(1, retry_attempts):
for plug in options["--plugs"]:
try:
options["--uuid"] = str(uuid.UUID(plug))
@@ -821,10 +810,17 @@ def set_multi_power_fn(tn, options, set_power_fn):
pass
except KeyError:
pass
+
options["--plug"] = plug
set_power_fn(tn, options)
- else:
- set_power_fn(tn, options)
+ time.sleep(int(options["--power-wait"]))
+
+ for _ in xrange(int(options["--power-timeout"])):
+ if get_multi_power_fn(tn, options, get_power_fn) != options["--action"]:
+ time.sleep(1)
+ else:
+ return True
+ return False
def show_docs(options, docs=None):
device_opt = options["device_opt"]
@@ -882,32 +878,20 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list=None,
if status != "on" and status != "off":
fail(EC_STATUS)
+ if options["--action"] == status:
+ print "Success: Already %s" % (status.upper())
+ return 0
+
if options["--action"] == "on":
- if status == "on":
- print "Success: Already ON"
+ if set_multi_power_fn(tn, options, set_power_fn, get_power_fn, 1 + int(options["--retry-on"])):
+ print "Success: Powered ON"
else:
- power_on = False
- for _ in range(1, 1 + int(options["--retry-on"])):
- set_multi_power_fn(tn, options, set_power_fn)
- time.sleep(int(options["--power-wait"]))
- if wait_power_status(tn, options, get_power_fn):
- power_on = True
- break
-
- if power_on:
- print "Success: Powered ON"
- else:
- fail(EC_WAITING_ON)
+ fail(EC_WAITING_ON)
elif options["--action"] == "off":
- if status == "off":
- print "Success: Already OFF"
+ if set_multi_power_fn(tn, options, set_power_fn, get_power_fn):
+ print "Success: Powered OFF"
else:
- set_multi_power_fn(tn, options, set_power_fn)
- time.sleep(int(options["--power-wait"]))
- if wait_power_status(tn, options, get_power_fn):
- print "Success: Powered OFF"
- else:
- fail(EC_WAITING_OFF)
+ fail(EC_WAITING_OFF)
elif options["--action"] == "reboot":
power_on = False
if options.get("--method", "").lower() == "cycle" and reboot_cycle_fn is not None:
@@ -922,19 +906,13 @@ def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list=None,
else:
if status != "off":
options["--action"] = "off"
- set_multi_power_fn(tn, options, set_power_fn)
- time.sleep(int(options["--power-wait"]))
- if wait_power_status(tn, options, get_power_fn) == 0:
+ if not set_multi_power_fn(tn, options, set_power_fn, get_power_fn):
fail(EC_WAITING_OFF)
+
options["--action"] = "on"
try:
- for _ in range(1, 1 + int(options["--retry-on"])):
- set_multi_power_fn(tn, options, set_power_fn)
- time.sleep(int(options["--power-wait"]))
- if wait_power_status(tn, options, get_power_fn) == 1:
- power_on = True
- break
+ power_on = set_multi_power_fn(tn, options, set_power_fn, get_power_fn, int(options["--retry-on"]))
except Exception, ex:
# an error occured during power ON phase in reboot
# fence action was completed succesfully even in that case
9 years, 11 months