Change in vdsm[master]: gluster: verbs for managing services

avishwan at redhat.com avishwan at redhat.com
Thu Jun 27 12:19:08 UTC 2013


Aravinda VK has posted comments on this change.

Change subject: gluster: verbs for managing services
......................................................................


Patch Set 23: No score

(10 inline comments)

....................................................
File vdsm/gluster/Makefile.am
Line 27: 	cli.py \
Line 28: 	exception.py \
Line 29: 	hooks.py \
Line 30: 	hostname.py \
Line 31: 	services.py
Done
Line 32: 
Line 33: dist_vdsmgluster_DATA = \
Line 34: 	vdsmapi-gluster-schema.json \


....................................................
File vdsm/gluster/services.py
Line 22: from vdsm.tool import service
Line 23: from . import makePublic
Line 24: 
Line 25: 
Line 26: ALLOWED_SERVICES = ["glusterd",
Done
Line 27:                     "memcached",
Line 28:                     "gluster-swift-proxy",
Line 29:                     "gluster-swift-container",
Line 30:                     "gluster-swift-object",


Line 56: def _formatStatus(serviceName, status, message=''):
Line 57:     return {'name': serviceName, 'status': status, 'message': message}
Line 58: 
Line 59: 
Line 60: def _serviceStatus(serviceName, failOnError=False):
Done
Line 61:     rc = service.service_status(serviceName)
Line 62: 
Line 63:     if rc == 0:
Line 64:         return _formatStatus(serviceName, StatusTypes.RUNNING)


Line 69:     rc1 = service.service_is_managed(serviceName)
Line 70:     if rc1 == 0:
Line 71:         return _formatStatus(serviceName, StatusTypes.STOPPED)
Line 72:     else:
Line 73:         return _formatStatus(serviceName, StatusTypes.NOT_AVAILABLE)
If a supported service is not available in Host then it returns NOT_AVAILABLE. SUPPORTED_SERVICES is a list to restrict consumer of api to call only those services. (Ex: Stopping vdsmd is not supported)
Line 74: 
Line 75: 
Line 76: def _serviceAction(serviceName, action, failOnError=False):
Line 77:     if action == ServiceActions.STATUS:


Line 109:         else:
Line 110:             if not failOnError:
Line 111:                 resp = _formatStatus(serviceName, StatusTypes.NOT_SUPPORTED)
Line 112:             else:
Line 113:                 raise ge.GlusterServiceNotSupportedException(sName=serviceName)
Both are same. I will change the variable name as SUPPORTED_SERVICES
Line 114: 
Line 115:         statusOutput.append(resp)
Line 116: 
Line 117:     return statusOutput


Line 117:     return statusOutput
Line 118: 
Line 119: 
Line 120: @makePublic
Line 121: def servicesManage(serviceNames, action, failOnError=False):
Since it is capable of handling Start, Stop, Restart as of now. We thought manage makes more sense. 

I will change this to servicesAction.
Line 122:     """
Line 123:     {'services': [
Line 124:         {'name': SERVICE_NAME, 'status': STATUS, 'message': MESSAGE},..]}
Line 125:     """


Line 119: 
Line 120: @makePublic
Line 121: def servicesManage(serviceNames, action, failOnError=False):
Line 122:     """
Line 123:     {'services': [
Done
Line 124:         {'name': SERVICE_NAME, 'status': STATUS, 'message': MESSAGE},..]}
Line 125:     """
Line 126:     action = action.lower()
Line 127:     return _action(serviceNames, action, failOnError)


Line 122:     """
Line 123:     {'services': [
Line 124:         {'name': SERVICE_NAME, 'status': STATUS, 'message': MESSAGE},..]}
Line 125:     """
Line 126:     action = action.lower()
Done
Line 127:     return _action(serviceNames, action, failOnError)
Line 128: 
Line 129: 
Line 130: @makePublic


Line 127:     return _action(serviceNames, action, failOnError)
Line 128: 
Line 129: 
Line 130: @makePublic
Line 131: def servicesGet(serviceNames, failOnError=False):
I will update commit message.

Since the verb accepts multiple service names and does action, If failOnError is False then VDSM exception will not be raised If any one service fails, and returns error details in "message" in return dict, and status will be ERROR.
Line 132:     """
Line 133:     {'services': [
Line 134:         {'name': SERVICE_NAME, 'status': STATUS, 'message': MESSAGE},..]}
Line 135:     """


....................................................
File vdsm/gluster/vdsmapi-gluster-schema.json
Line 260: # @RUNNING:    Service is Running
Line 261: #
Line 262: # @STOPPED:    Service is Stopped
Line 263: #
Line 264: # @NOT_AVAILABLE:    Service is not managed/available
Yes
Line 265: #
Line 266: # @NOT_SUPPORTED:    Service is not allowed to manage
Line 267: #
Line 268: # @ERROR:    Service action failed


-- 
To view, visit http://gerrit.ovirt.org/11094
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8a16bf566d17e186a66503391dfd04b2f2bb4bb4
Gerrit-PatchSet: 23
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Aravinda VK <avishwan at redhat.com>
Gerrit-Reviewer: Adam Litke <agl at us.ibm.com>
Gerrit-Reviewer: Aravinda VK <avishwan at redhat.com>
Gerrit-Reviewer: Bala.FA <barumuga at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin at redhat.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server


More information about the vdsm-patches mailing list