Aravinda VK has posted comments on this change.
Change subject: gluster: add task support
......................................................................
Patch Set 13:
(9 comments)
....................................................
Commit Message
Line 16: {TASKID: {
Line 17: "volume": VOLUMENAME,
Line 18: "status": TaskStatus,
Line 19: "type": TaskType,
Line 20: "data": SUMMARY
Done
Line 21: }, ...}
Line 22:
Line 23: Change-Id: I154df353bc6f23001d7bf61b8f5345abd2019cb6
Line 24: Signed-off-by: Bala.FA <barumuga(a)redhat.com>
....................................................
File vdsm/gluster/tasks.py
Line 24: from cli import TaskType
Line 25:
Line 26:
Line 27: @makePublic
Line 28: def tasksList(taskId=None):
After decorator, this func will be exported as glusterTasksList(For xmlrpc and vdsClient)
Line 29: subRes = {}
Line 30: tasks = cli.volumeStatusAll()
Line 31: for tid in tasks:
Line 32: if taskId:
Line 25:
Line 26:
Line 27: @makePublic
Line 28: def tasksList(taskId=None):
Line 29: subRes = {}
I will update var name as result.
Line 30: tasks = cli.volumeStatusAll()
Line 31: for tid in tasks:
Line 32: if taskId:
Line 33: if tid != taskId:
Line 26:
Line 27: @makePublic
Line 28: def tasksList(taskId=None):
Line 29: subRes = {}
Line 30: tasks = cli.volumeStatusAll()
If fails, exception will be raised inside volumeStatusAll()
Line 31: for tid in tasks:
Line 32: if taskId:
Line 33: if tid != taskId:
Line 34: continue
Line 32: if taskId:
Line 33: if tid != taskId:
Line 34: continue
Line 35:
Line 36: try:
Done
Line 37: value = tasks[tid]
Line 38: data = {}
Line 39: state = value['status']
Line 40: if value['taskType'] == TaskType.REBALANCE:
Line 37: value = tasks[tid]
Line 38: data = {}
Line 39: state = value['status']
Line 40: if value['taskType'] == TaskType.REBALANCE:
Line 41: data = cli.volumeRebalanceStatus(value['volumeName'])
Done
Line 42: elif value['taskType'] == TaskType.REMOVE_BRICK:
Line 43: data = cli.volumeRemoveBrickStatus(value['volumeName'],
Line 44: value['bricks'])
Line 45: elif value['taskType'] == TaskType.REPLACE_BRICK:
Line 42: elif value['taskType'] == TaskType.REMOVE_BRICK:
Line 43: data = cli.volumeRemoveBrickStatus(value['volumeName'],
Line 44: value['bricks'])
Line 45: elif value['taskType'] == TaskType.REPLACE_BRICK:
Line 46: data = cli.volumeReplaceBrickStatus(value['volumeName'],
Two different functions: volumeRemoveBrickStatus and volumeReplaceBrickStatus
Line 47: value['bricks'][0],
Line 48: value['bricks'][1])
Line 49:
Line 50: summary = data['summary'] if 'summary' in data else
{}
Line 46: data = cli.volumeReplaceBrickStatus(value['volumeName'],
Line 47: value['bricks'][0],
Line 48: value['bricks'][1])
Line 49:
Line 50: summary = data['summary'] if 'summary' in data else
{}
Done
Line 51: subRes[tid] = {"volume": value['volumeName'],
Line 52: "status": state,
Line 53: "type": value['taskType'],
Line 54: "data": summary}
Line 52: "status": state,
Line 53: "type": value['taskType'],
Line 54: "data": summary}
Line 55: except ge.GlusterException:
Line 56: logging.error("gluster exception occured", exc_info=True)
Done
--
To view, visit
http://gerrit.ovirt.org/10200
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I154df353bc6f23001d7bf61b8f5345abd2019cb6
Gerrit-PatchSet: 13
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Adam Litke <agl(a)us.ibm.com>
Gerrit-Reviewer: Aravinda VK <avishwan(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: ndarshan <dnarayan(a)redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes