Node resources should not be exposed
Change-Id: I49a4835c2186c0b439abdfb12d2ca86fea29e235 Closes-Bug: #1441919
This commit is contained in:
parent
02f6398c91
commit
e2e1372c9b
|
@ -85,8 +85,6 @@ class Cluster(base.APIBase):
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
self.fields = []
|
self.fields = []
|
||||||
cluster_object_fields = list(objects.Cluster.fields)
|
cluster_object_fields = list(objects.Cluster.fields)
|
||||||
# Adding nodes since it is an api-only attribute.
|
|
||||||
self.fields.append('nodes')
|
|
||||||
for k in cluster_object_fields:
|
for k in cluster_object_fields:
|
||||||
# only add fields we expose in the api
|
# only add fields we expose in the api
|
||||||
if hasattr(self, k):
|
if hasattr(self, k):
|
||||||
|
@ -187,7 +185,7 @@ def delete_complete_cluster(context, cluster_id):
|
||||||
}
|
}
|
||||||
|
|
||||||
job_client = task_flow_client.get_client_instance()
|
job_client = task_flow_client.get_client_instance()
|
||||||
#TODO(dagnello): might be better to use request_id for job_uuid
|
# TODO(dagnello): might be better to use request_id for job_uuid
|
||||||
job_uuid = uuidutils.generate_uuid()
|
job_uuid = uuidutils.generate_uuid()
|
||||||
job_client.post(delete_cluster, job_args, flow_kwargs=flow_kwargs,
|
job_client.post(delete_cluster, job_args, flow_kwargs=flow_kwargs,
|
||||||
tx_uuid=job_uuid)
|
tx_uuid=job_uuid)
|
||||||
|
@ -231,17 +229,19 @@ class ClusterController(rest.RestController):
|
||||||
except nova_exc.ClientException as ex:
|
except nova_exc.ClientException as ex:
|
||||||
if ex.http_status == 404:
|
if ex.http_status == 404:
|
||||||
raise exception.Invalid(_('Invalid flavor %s provided') %
|
raise exception.Invalid(_('Invalid flavor %s provided') %
|
||||||
cluster_flavor)
|
cluster_flavor)
|
||||||
else:
|
else:
|
||||||
raise exception.InternalServerError
|
raise exception.InternalServerError
|
||||||
|
|
||||||
# validate flavor with broker image metadata
|
# validate flavor with broker image metadata
|
||||||
if (flavor_disk < image_minDisk):
|
if (flavor_disk < image_minDisk):
|
||||||
raise exception.Invalid(_("Flavor disk is smaller than the "
|
raise exception.Invalid(_("Flavor disk is smaller than the "
|
||||||
"minimum %s required for broker") % image_minDisk)
|
"minimum %s required for broker") %
|
||||||
|
image_minDisk)
|
||||||
elif (flavor_ram < image_minRam):
|
elif (flavor_ram < image_minRam):
|
||||||
raise exception.Invalid(_("Flavor ram is smaller than the "
|
raise exception.Invalid(_("Flavor ram is smaller than the "
|
||||||
"minimum %s required for broker") % image_minRam)
|
"minimum %s required for broker") %
|
||||||
|
image_minRam)
|
||||||
|
|
||||||
@wsme_pecan.wsexpose(Cluster, wtypes.text, status_code=200)
|
@wsme_pecan.wsexpose(Cluster, wtypes.text, status_code=200)
|
||||||
def get_one(self, cluster_id):
|
def get_one(self, cluster_id):
|
||||||
|
@ -380,7 +380,7 @@ class ClusterController(rest.RestController):
|
||||||
'default_rabbit_pass': default_rabbit_pass,
|
'default_rabbit_pass': default_rabbit_pass,
|
||||||
}
|
}
|
||||||
job_client = task_flow_client.get_client_instance()
|
job_client = task_flow_client.get_client_instance()
|
||||||
#TODO(dagnello): might be better to use request_id for job_uuid
|
# TODO(dagnello): might be better to use request_id for job_uuid
|
||||||
job_uuid = uuidutils.generate_uuid()
|
job_uuid = uuidutils.generate_uuid()
|
||||||
job_client.post(create_cluster, job_args,
|
job_client.post(create_cluster, job_args,
|
||||||
flow_kwargs=flow_kwargs,
|
flow_kwargs=flow_kwargs,
|
||||||
|
@ -388,13 +388,12 @@ class ClusterController(rest.RestController):
|
||||||
|
|
||||||
LOG.info(_LI('Create Cluster Request Cluster ID %(cluster_id)s '
|
LOG.info(_LI('Create Cluster Request Cluster ID %(cluster_id)s '
|
||||||
'Cluster size %(size)s network ID %(network_id)s '
|
'Cluster size %(size)s network ID %(network_id)s '
|
||||||
'Job ID %(job_id)s Broker name %(broker_name)s') % (
|
'Job ID %(job_id)s Broker name %(broker_name)s') %
|
||||||
{"cluster_id": cluster.id,
|
({"cluster_id": cluster.id,
|
||||||
"size": cluster.size,
|
"size": cluster.size,
|
||||||
"network_id":
|
"network_id": cluster.network_id,
|
||||||
cluster.network_id,
|
"job_id": job_uuid,
|
||||||
"job_id": job_uuid,
|
"broker_name": broker_name}))
|
||||||
"broker_name": broker_name}))
|
|
||||||
|
|
||||||
cluster.additional_information = []
|
cluster.additional_information = []
|
||||||
cluster.additional_information.append(
|
cluster.additional_information.append(
|
||||||
|
|
Loading…
Reference in New Issue