示例#1
0
 def get_current_request(self):
     broker_reqs = []
     for relation in self.relations:
         broker_req = relation.to_publish.get('broker_req', {})
         if broker_req:
             rq = CephBrokerRq()
             rq.set_ops(broker_req['ops'])
             broker_reqs.append(rq)
     # Check that if there are multiple requests then they are the same.
     assert all(x == broker_reqs[0] for x in broker_reqs)
     if broker_reqs:
         return broker_reqs[0]
示例#2
0
    def request_ceph_permissions(self, ceph):
        rq = CephBrokerRq()

        json_rq = ceph.get_local(key='broker_req')
        if json_rq:
            try:
                j = json.loads(json_rq)
                log("Json request: {}".format(json_rq))
                rq.set_ops(j['ops'])
            except ValueError as err:
                log("Unable to decode broker_req: {}. Error {}".format(
                    json_rq, err))

        rq.add_op({'op': 'set-key-permissions',
                   'permissions': CEPH_CAPABILITIES,
                   'client': 'manila-ganesha'})
        ceph.set_local(key='broker_req', value=rq.request)
        send_request_if_needed(rq, relation='ceph')