'Checks whether a service is online or not'

def verify_service(self, service, status='online'):

    svc = ('/api/service/v1/services/' + service)
    ret = self.rclient.get(svc)
    if (ret.status != restclient.Status.OK):
        exception_msg = (_('Error    Verifying    Service:    %(service)s    Return    code:    %(ret.status)d    Message:    %(ret.data)s.') % {'service': service, 'ret.status': ret.status, 'ret.data': ret.data})
        LOG.error(exception_msg)
        raise exception.VolumeBackendAPIException(data=exception_msg)
    data = json.loads(ret.data)['service']
    if (data['<status>'] != status):
        exception_msg = (_('%(service)s    Service    is    not    %(status)s    on    storage    appliance:    %(host)s') % {'service': service, 'status': status, 'host': self.host})
        LOG.error(exception_msg)
        raise exception.VolumeBackendAPIException(data=exception_msg)
