Change in vdsm[ovirt-3.5]: fence: Fix description and JSONRPC marshalling for fenceNode...
mperina at redhat.com
mperina at redhat.com
Mon Sep 22 08:46:20 UTC 2014
Hello Piotr Kliczewski, Yaniv Bronhaim, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/33156
to review the following change.
Change subject: fence: Fix description and JSONRPC marshalling for fenceNode API
......................................................................
fence: Fix description and JSONRPC marshalling for fenceNode API
1) Fixes description of fenceNode return value
2) Fixes marshalling of fenceNode return value for JSONRPC
Change-Id: Ib39744828d56de2ec0bc6406d7dcfa116a7ec8d8
Bug-Url: https://bugzilla.redhat.com/1143860
Signed-off-by: Martin Perina <mperina at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/33034
Reviewed-by: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Reviewed-by: Yaniv Bronhaim <ybronhei at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
---
M tests/bridgeTests.py
M vdsm/rpc/Bridge.py
M vdsm/rpc/vdsmapi-schema.json
3 files changed, 42 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/56/33156/1
diff --git a/tests/bridgeTests.py b/tests/bridgeTests.py
index f75ca00..acfa6a5 100644
--- a/tests/bridgeTests.py
+++ b/tests/bridgeTests.py
@@ -90,7 +90,7 @@
params = obj.get('params', [])
method = getattr(bridge, mangledMethod)
- self.assertEquals(method(**params), 'on')
+ self.assertEquals(method(**params), {'power': 'on'})
def testMethodWithNoParams(self):
createFakeAPI()
diff --git a/vdsm/rpc/Bridge.py b/vdsm/rpc/Bridge.py
index a111bb9..1601b4b 100644
--- a/vdsm/rpc/Bridge.py
+++ b/vdsm/rpc/Bridge.py
@@ -286,6 +286,19 @@
return self._fixupRet(className, methodName, ret)
+def Host_fenceNode_Ret(ret):
+ """
+ Only 'power' and 'operationStatus' should be part of return value if they
+ are not None
+ """
+ result = {}
+ for key in ('power', 'operationStatus'):
+ val = ret.get(key)
+ if val is not None:
+ result[key] = val
+ return result
+
+
def Host_getCapabilities_Ret(server_address, ret):
"""
We need to add additional information to getCaps as it is done for xmlrpc.
@@ -377,7 +390,7 @@
'ConnectionRefs_acquire': {'ret': 'results'},
'ConnectionRefs_release': {'ret': 'results'},
'ConnectionRefs_statuses': {'ret': 'connectionslist'},
- 'Host_fenceNode': {'ret': 'power'},
+ 'Host_fenceNode': {'ret': Host_fenceNode_Ret},
'Host_getAllTasksInfo': {'ret': 'allTasksInfo'},
'Host_getAllTasksStatuses': {'ret': 'allTasksStatus'},
'Host_getCapabilities': {'ret': Host_getCapabilities_Ret},
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index db441f5..a03eb56 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -276,9 +276,9 @@
{'enum': 'FenceNodeAction', 'data': ['status', 'on', 'off', 'reboot']}
##
-# @FenceNodeResult:
+# @FenceNodePowerStatusResult:
#
-# For 'status' action, the result is the power status of the host
+# The host power status as a result of 'status' action.
#
# @on: The remote host is powered on
#
@@ -287,8 +287,14 @@
# @unknown: The power status is not known
#
# Since: 4.10.0
+##
+{'enum': 'FenceNodePowerStatusResult', 'data': ['on', 'off', 'unknown']}
+
+##
+# @FenceNodeOperationStatusResult:
#
-# For 'on', 'off' and 'reboot', the result is status of fence script execution
+# Status of fence script execution as a result of 'on', 'off' and 'reboot'
+# actions.
#
# @initiated: Fence script was executed
#
@@ -296,8 +302,24 @@
#
# Since: 4.16.0
##
-{'enum': 'FenceNodeResult', 'data': ['on', 'off', 'unknown', 'initiated',
- 'skipped']}
+{'enum': 'FenceNodeOperationStatusResult', 'data': ['initiated', 'skipped']}
+
+##
+# @FenceNodeResult:
+#
+# Result of fenceNode command.
+#
+# @power: #optional power status of host as a result of 'status'
+# action
+# Since: 4.10.0
+#
+# @operationStatus: #optional status of fence action executions for 'on',
+# 'off' and 'reboot' actions
+# Since: 4.16.0
+##
+{'type': 'FenceNodeResult',
+ 'data': {'*power': 'FenceNodePowerStatusResult',
+ '*operationStatus': 'FenceNodeOperationStatusResult'}}
##
# @HostIdMap:
--
To view, visit http://gerrit.ovirt.org/33156
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib39744828d56de2ec0bc6406d7dcfa116a7ec8d8
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Martin Peřina <mperina at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
More information about the vdsm-patches
mailing list