fixed bug in xiaodong's commit
Change-Id: Ifff027bfcccabc797bb4d0c57037cf83a46ab126
This commit is contained in:
parent
14ad281057
commit
86e56f58d0
@ -1597,8 +1597,9 @@ def update_cluster_hosts(
|
|||||||
_set_clusterhosts(
|
_set_clusterhosts(
|
||||||
cluster, session=session, user=user, **set_hosts
|
cluster, session=session, user=user, **set_hosts
|
||||||
)
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'hosts': cluster.clusterhosts
|
'hosts': list_cluster_hosts(cluster_id, session=session)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -177,20 +177,22 @@ def validate_flavor_config(
|
|||||||
):
|
):
|
||||||
"""Validate flavor config."""
|
"""Validate flavor config."""
|
||||||
load_metadatas()
|
load_metadatas()
|
||||||
if flavor_id not in FLAVOR_METADATA_MAPPING:
|
if not flavor_id:
|
||||||
|
logging.info('There is no flavor, skipping flavor validation...')
|
||||||
|
elif flavor_id not in FLAVOR_METADATA_MAPPING:
|
||||||
raise exception.InvalidParameter(
|
raise exception.InvalidParameter(
|
||||||
'flavor %s is not found in flavor metedata mapping' % flavor_id
|
'flavor %s is not found in flavor metedata mapping' % flavor_id
|
||||||
)
|
)
|
||||||
_validate_config(
|
else:
|
||||||
'', config, FLAVOR_METADATA_MAPPING[flavor_id],
|
_validate_config(
|
||||||
whole_check, **kwargs
|
'', config, FLAVOR_METADATA_MAPPING[flavor_id],
|
||||||
)
|
whole_check, **kwargs
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _filter_metadata(metadata, **kwargs):
|
def _filter_metadata(metadata, **kwargs):
|
||||||
"""Filter metadata before return it to api.
|
"""Filter metadata before return it to api.
|
||||||
|
|
||||||
|
|
||||||
Some metadata fields are not json compatible or
|
Some metadata fields are not json compatible or
|
||||||
only used in db/api internally.
|
only used in db/api internally.
|
||||||
We should strip these fields out before return to api.
|
We should strip these fields out before return to api.
|
||||||
@ -251,11 +253,14 @@ def get_package_metadata(adapter_id, user=None, session=None, **kwargs):
|
|||||||
def _get_flavor_metadata(flavor_id):
|
def _get_flavor_metadata(flavor_id):
|
||||||
"""get flavor metadata."""
|
"""get flavor metadata."""
|
||||||
load_metadatas()
|
load_metadatas()
|
||||||
if flavor_id not in FLAVOR_METADATA_MAPPING:
|
if not flavor_id:
|
||||||
|
logging.info('There is no flavor id, skipping...')
|
||||||
|
elif flavor_id not in FLAVOR_METADATA_MAPPING:
|
||||||
raise exception.RecordNotExists(
|
raise exception.RecordNotExists(
|
||||||
'flavor %s does not exist' % flavor_id
|
'flavor %s does not exist' % flavor_id
|
||||||
)
|
)
|
||||||
return _filter_metadata(FLAVOR_METADATA_MAPPING[flavor_id])
|
else:
|
||||||
|
return _filter_metadata(FLAVOR_METADATA_MAPPING[flavor_id])
|
||||||
|
|
||||||
|
|
||||||
@utils.supported_filters([])
|
@utils.supported_filters([])
|
||||||
@ -714,11 +719,13 @@ def autofill_flavor_config(
|
|||||||
config, flavor_id, **kwargs
|
config, flavor_id, **kwargs
|
||||||
):
|
):
|
||||||
load_metadatas()
|
load_metadatas()
|
||||||
if flavor_id not in FLAVOR_METADATA_MAPPING:
|
if not flavor_id:
|
||||||
|
logging.info('There is no flavor, skipping...')
|
||||||
|
elif flavor_id not in FLAVOR_METADATA_MAPPING:
|
||||||
raise exception.InvalidParameter(
|
raise exception.InvalidParameter(
|
||||||
'flavor %s is not found in flavor metadata mapping' % flavor_id
|
'flavor %s is not found in flavor metadata mapping' % flavor_id
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
return _autofill_config(
|
return _autofill_config(
|
||||||
'', config, FLAVOR_METADATA_MAPPING[flavor_id], **kwargs
|
'', config, FLAVOR_METADATA_MAPPING[flavor_id], **kwargs
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user