Eli Mesika has uploaded a new change for review. Change subject: vdsm: making PM 'on' and 'off' sync ......................................................................
vdsm: making PM 'on' and 'off' sync Consider the following scenario: DC1 with H1 (with PM) and H2 on cluster C1 another host H3 on DC1 cluster C2 When we are blocking the communication with iptables from H2 to H1 PM card and use the default proxy preferences (cluster, dc) a Restart operation will always fail. VDSM should perform start/stop sync and return the correct script returned code in order that engine will know that H2 fails to perform the operation and will try to use H3 as a proxy for the failed operation This patch changes the fenceNode function to be sync when 'on' 'off' operation are used in the same manner of 'status' operation and return the correct exit code of the invoked fencing script to the caller. Change-Id: I81d45977664c99c954c4663a26642e6e21cc65e3 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1139643 Signed-off-by: Eli Mesika <[email protected]> --- M vdsm/API.py 1 file changed, 16 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/69/33469/1 diff --git a/vdsm/API.py b/vdsm/API.py index 6378f2c..5d948f8 100644 --- a/vdsm/API.py +++ b/vdsm/API.py @@ -1205,19 +1205,19 @@ inp += 'secure=yes\n' inp += options + try: + rc, out, err = fence(script, inp) + except OSError as e: + if e.errno == os.errno.ENOENT: + return errCode['fenceAgent'] + raise + self.log.debug('rc %s in %s out %s err %s', rc, + hidePasswd(inp), out, err) + if not 0 <= rc <= 2: + return {'status': {'code': 1, + 'message': out + err}} + message = doneCode['message'] if action == 'status': - try: - rc, out, err = fence(script, inp) - except OSError as e: - if e.errno == os.errno.ENOENT: - return errCode['fenceAgent'] - raise - self.log.debug('rc %s in %s out %s err %s', rc, - hidePasswd(inp), out, err) - if not 0 <= rc <= 2: - return {'status': {'code': 1, - 'message': out + err}} - message = doneCode['message'] if rc == 0: power = 'on' elif rc == 2: @@ -1227,9 +1227,10 @@ message = out + err return {'status': {'code': 0, 'message': message}, 'power': power} - threading.Thread(target=fence, args=(script, inp)).start() - return {'status': doneCode, 'power': 'unknown', - 'operationStatus': 'initiated'} + if rc != 0: + message = out + err + return {'status': {'code': rc, 'message': message}, + 'power': 'unknown', 'operationStatus': 'initiated'} def ping(self): "Ping the server. Useful for tests" -- To view, visit http://gerrit.ovirt.org/33469 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I81d45977664c99c954c4663a26642e6e21cc65e3 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: ovirt-3.5 Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
