Aravinda VK has uploaded a new change for review.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
gluster: Return status after remove brick/rebalance stop
Initially glusterVolumeRebalanceStop and glusterVolumeRemoveBrickStop returns true/false.
Since rebalance and remove brick operations are async operations, if rebalance/remove-brick STOP is triggered after these async tasks completed then vdsm returns success when executing stop command. But since task is completed engine has to show that task is completed(Now showing STOPPED)
This patch returns status after successful execution of stop command. engine will check the summary[status] to see the status of task and display in UI accordingly.
This patch will not affect the backward compatibility since "status" is not changed in output dict. 'status': {'code': 0, 'message': 'Done'}
Output: {'hosts': [{'filesFailed': LONG as STR, 'filesMoved': LONG as STR, 'filesScanned': LONG as STR, 'filesSkipped': LONG as STR, 'name': STRING, 'status': STRING, 'totalSizeMoved': LONG as STR},..], 'status': {'code': 0, 'message': 'Done'}, 'summary': {'filesFailed': LONG as STR, 'filesMoved': LONG as STR, 'filesScanned': LONG as STR, 'filesSkipped': LONG as STR, 'status': STRING, 'totalSizeMoved': LONG as STR}}
Exceptions: GlusterVolumeRebalanceStopFailedException code = 4137 message = "Volume rebalance stop failed"
GlusterVolumeRemoveBrickStopFailedException code = 4150 message = "Volume remove brick stop failed"
GlusterXmlErrorException code = 4106 message = "XML error"
Change-Id: I5b46296c8ec9544644d2ab8fed5f9c12236b7ed0 Signed-off-by: Aravinda VK avishwan@redhat.com --- M client/vdsClientGluster.py M vdsm/gluster/api.py M vdsm/gluster/cli.py M vdsm/gluster/vdsmapi-gluster-schema.json 4 files changed, 22 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/20482/1
diff --git a/client/vdsClientGluster.py b/client/vdsClientGluster.py index 3c1199c..65e6282 100644 --- a/client/vdsClientGluster.py +++ b/client/vdsClientGluster.py @@ -131,6 +131,7 @@ force = (params.get('force', 'no').upper() == 'YES')
status = self.s.glusterVolumeRebalanceStop(volumeName, force) + pp.pprint(status) return status['status']['code'], status['status']['message']
def do_glusterVolumeRebalanceStatus(self, args): @@ -234,6 +235,7 @@ status = self.s.glusterVolumeRemoveBrickStop(volumeName, brickList, replicaCount) + pp.pprint(status) return status['status']['code'], status['status']['message']
def do_glusterVolumeRemoveBrickStatus(self, args): diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py index 284fa97..193d6bd 100644 --- a/vdsm/gluster/api.py +++ b/vdsm/gluster/api.py @@ -122,7 +122,7 @@
@exportAsVerb def volumeRebalanceStop(self, volumeName, force=False, options=None): - self.svdsmProxy.glusterVolumeRebalanceStop(volumeName, force) + return self.svdsmProxy.glusterVolumeRebalanceStop(volumeName, force)
@exportAsVerb def volumeRebalanceStatus(self, volumeName, options=None): @@ -175,8 +175,9 @@ @exportAsVerb def volumeRemoveBrickStop(self, volumeName, brickList, replicaCount=0, options=None): - self.svdsmProxy.glusterVolumeRemoveBrickStop(volumeName, brickList, - replicaCount) + return self.svdsmProxy.glusterVolumeRemoveBrickStop(volumeName, + brickList, + replicaCount)
@exportAsVerb def volumeRemoveBrickStatus(self, volumeName, brickList, diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py index a67658f..a654b56 100644 --- a/vdsm/gluster/cli.py +++ b/vdsm/gluster/cli.py @@ -583,11 +583,15 @@ if force: command.append('force') try: - _execGlusterXml(command) - return True + xmltree = _execGlusterXml(command) except ge.GlusterCmdFailedException, e: raise ge.GlusterVolumeRebalanceStopFailedException(rc=e.rc, err=e.err) + + try: + return _parseVolumeRebalanceRemoveBrickStatus(xmltree, 'rebalance') + except _etreeExceptions: + raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)])
@makePublic @@ -751,12 +755,16 @@ command += ["replica", "%s" % replicaCount] command += brickList + ["stop"] try: - _execGlusterXml(command) - return True + xmltree = _execGlusterXml(command) except ge.GlusterCmdFailedException, e: raise ge.GlusterVolumeRemoveBrickStopFailedException(rc=e.rc, err=e.err)
+ try: + return _parseVolumeRebalanceRemoveBrickStatus(xmltree, 'remove-brick') + except _etreeExceptions: + raise ge.GlusterXmlErrorException(err=[etree.tostring(xmltree)]) +
@makePublic def volumeRemoveBrickStatus(volumeName, brickList, replicaCount=0): diff --git a/vdsm/gluster/vdsmapi-gluster-schema.json b/vdsm/gluster/vdsmapi-gluster-schema.json index f45a438..7de762a 100644 --- a/vdsm/gluster/vdsmapi-gluster-schema.json +++ b/vdsm/gluster/vdsmapi-gluster-schema.json @@ -705,13 +705,13 @@ # @volumeName: Gluster volume name # # Returns: -# Success or failure +# Status information of remove brick operation # # Since: 4.10.3 ## {'command': {'class': 'GlusterVolume', 'name': 'removeBrickStop'}, 'data': {'volumeName': 'str', 'brickList': ['str'], 'replicaCount': 'int'}, - 'returns': 'bool'} + 'returns': 'RebalanceRemoveStatus'}
## # @TaskStatus: @@ -881,13 +881,13 @@ # @volumeName: Gluster volume name # # Returns: -# Success or failure +# Gluster volume rebalance status # # Since: 4.10.3 ## {'command': {'class': 'GlusterVolume', 'name': 'rebalanceStop'}, 'data': {'volumeName': 'str', 'force': 'bool'}, - 'returns': 'bool'} + 'returns': 'RebalanceRemoveStatus'}
## # @GlusterVolume.rebalanceStatus:
oVirt Jenkins CI Server has posted comments on this change.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5045/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/4241/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/5119/ : SUCCESS
Aravinda VK has posted comments on this change.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
Patch Set 1: Verified+1
Bala.FA has posted comments on this change.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
Patch Set 2: Code-Review+1
oVirt Jenkins CI Server has posted comments on this change.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
Patch Set 2: Verified-1
Build Failed
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5046/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/4242/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/5120/ : ABORTED
oVirt Jenkins CI Server has posted comments on this change.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
Patch Set 2: -Verified
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5055/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/4251/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/5129/ : SUCCESS
Timothy Asir has posted comments on this change.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
Patch Set 2: Code-Review+1
Could you please verify this!
Aravinda VK has posted comments on this change.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
Patch Set 2: Verified+1
Dan Kenigsberg has posted comments on this change.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
Patch Set 2: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: gluster: Return status after remove brick/rebalance stop ......................................................................
gluster: Return status after remove brick/rebalance stop
Initially glusterVolumeRebalanceStop and glusterVolumeRemoveBrickStop returns true/false.
Since rebalance and remove brick operations are async operations, if rebalance/remove-brick STOP is triggered after these async tasks completed then vdsm returns success when executing stop command. But since task is completed engine has to show that task is completed(Now showing STOPPED)
This patch returns status after successful execution of stop command. engine will check the summary[status] to see the status of task and display in UI accordingly.
This patch will not affect the backward compatibility since "status" is not changed in output dict. 'status': {'code': 0, 'message': 'Done'}
Output: {'hosts': [{'filesFailed': LONG as STR, 'filesMoved': LONG as STR, 'filesScanned': LONG as STR, 'filesSkipped': LONG as STR, 'name': STRING, 'status': STRING, 'totalSizeMoved': LONG as STR},..], 'status': {'code': 0, 'message': 'Done'}, 'summary': {'filesFailed': LONG as STR, 'filesMoved': LONG as STR, 'filesScanned': LONG as STR, 'filesSkipped': LONG as STR, 'status': STRING, 'totalSizeMoved': LONG as STR}}
Possible exceptions with these verbs: No new exceptions introduced, XmlErrorException was raised when status parsing fails.
GlusterVolumeRebalanceStopFailedException code = 4137 message = "Volume rebalance stop failed"
GlusterVolumeRemoveBrickStopFailedException code = 4150 message = "Volume remove brick stop failed"
GlusterXmlErrorException code = 4106 message = "XML error"
Change-Id: I5b46296c8ec9544644d2ab8fed5f9c12236b7ed0 Signed-off-by: Aravinda VK avishwan@redhat.com Reviewed-on: http://gerrit.ovirt.org/20482 Reviewed-by: Bala.FA barumuga@redhat.com Reviewed-by: Timothy Asir tjeyasin@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com --- M client/vdsClientGluster.py M vdsm/gluster/api.py M vdsm/gluster/cli.py M vdsm/gluster/vdsmapi-gluster-schema.json 4 files changed, 22 insertions(+), 11 deletions(-)
Approvals: Timothy Asir: Looks good to me, but someone else must approve Bala.FA: Looks good to me, but someone else must approve Aravinda VK: Verified Dan Kenigsberg: Looks good to me, approved
vdsm-patches@lists.fedorahosted.org