377
class CephBrokerRq(object):
378
"""Ceph broker request.
380
Multiple operations can be added to a request and sent to the Ceph broker
383
Request is json-encoded for sending over the wire.
385
The API is versioned and defaults to version 1.
387
def __init__(self, api_version=1):
388
self.api_version = api_version
391
def add_op_create_pool(self, name, replica_count=3):
392
self.ops.append({'op': 'create-pool', 'name': name,
393
'replicas': replica_count})
397
return json.dumps({'api-version': self.api_version, 'ops': self.ops})
400
class CephBrokerRsp(object):
401
"""Ceph broker response.
403
Response is json-decoded and contents provided as methods/properties.
405
The API is versioned and defaults to version 1.
407
def __init__(self, encoded_rsp):
408
self.api_version = None
409
self.rsp = json.loads(encoded_rsp)
413
return self.rsp.get('exit-code')
417
return self.rsp.get('stderr')