update api code
Change-Id: I1712ce8507386f6ad47c4aa637f0b61d102c11ba
This commit is contained in:
parent
d643bf8dbc
commit
3b59f335b9
@ -40,8 +40,9 @@ RESP_FIELDS = [
|
|||||||
]
|
]
|
||||||
RESP_CLUSTERHOST_FIELDS = [
|
RESP_CLUSTERHOST_FIELDS = [
|
||||||
'id', 'host_id', 'machine_id', 'name', 'hostname',
|
'id', 'host_id', 'machine_id', 'name', 'hostname',
|
||||||
'cluster_id', 'clustername',
|
'cluster_id', 'clustername', 'location', 'tag',
|
||||||
'mac', 'os_installed', 'distributed_system_installed',
|
'networks', 'mac',
|
||||||
|
'os_installed', 'distributed_system_installed',
|
||||||
'os_name', 'distributed_system_name',
|
'os_name', 'distributed_system_name',
|
||||||
'reinstall_os', 'reinstall_distributed_system',
|
'reinstall_os', 'reinstall_distributed_system',
|
||||||
'owner', 'cluster_id',
|
'owner', 'cluster_id',
|
||||||
@ -1023,15 +1024,15 @@ def review_cluster(session, reviewer, cluster_id, review={}, **kwargs):
|
|||||||
session, models.Cluster, id=cluster_id
|
session, models.Cluster, id=cluster_id
|
||||||
)
|
)
|
||||||
is_cluster_editable(session, cluster, reviewer)
|
is_cluster_editable(session, cluster, reviewer)
|
||||||
|
host_ids = review.get('hosts', [])
|
||||||
clusterhost_ids = review.get('clusterhosts', [])
|
clusterhost_ids = review.get('clusterhosts', [])
|
||||||
filters = {
|
clusterhosts = []
|
||||||
'cluster_id': cluster_id
|
for clusterhost in cluster.clusterhosts:
|
||||||
}
|
if (
|
||||||
if clusterhost_ids:
|
clusterhost.id in clusterhost_ids or
|
||||||
filters['id'] = clusterhost_ids
|
clusterhost.host_id in host_ids
|
||||||
clusterhosts = utils.list_db_objects(
|
):
|
||||||
session, models.ClusterHost, **filters
|
clusterhosts.append(clusterhost)
|
||||||
)
|
|
||||||
os_config = cluster.os_config
|
os_config = cluster.os_config
|
||||||
if os_config:
|
if os_config:
|
||||||
metadata_api.validate_os_config(
|
metadata_api.validate_os_config(
|
||||||
@ -1074,7 +1075,7 @@ def review_cluster(session, reviewer, cluster_id, review={}, **kwargs):
|
|||||||
utils.update_db_object(session, cluster, config_validated=True)
|
utils.update_db_object(session, cluster, config_validated=True)
|
||||||
return {
|
return {
|
||||||
'cluster': cluster,
|
'cluster': cluster,
|
||||||
'clusterhosts': cluster.clusterhosts
|
'clusterhosts': clusterhosts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1097,15 +1098,15 @@ def deploy_cluster(
|
|||||||
cluster = utils.get_db_object(
|
cluster = utils.get_db_object(
|
||||||
session, models.Cluster, id=cluster_id
|
session, models.Cluster, id=cluster_id
|
||||||
)
|
)
|
||||||
|
host_ids = deploy.get('hosts', [])
|
||||||
clusterhost_ids = deploy.get('clusterhosts', [])
|
clusterhost_ids = deploy.get('clusterhosts', [])
|
||||||
filters = {
|
clusterhosts = []
|
||||||
'cluster_id': cluster_id
|
for clusterhost in cluster.clusterhosts:
|
||||||
}
|
if (
|
||||||
if clusterhost_ids:
|
clusterhost.id in clusterhost_ids or
|
||||||
filters['id'] = clusterhost_ids
|
clusterhost.host_id in host_ids
|
||||||
clusterhosts = utils.list_db_objects(
|
):
|
||||||
session, models.ClusterHost, **filters
|
clusterhosts.append(clusterhost)
|
||||||
)
|
|
||||||
is_cluster_editable(session, cluster, deployer)
|
is_cluster_editable(session, cluster, deployer)
|
||||||
is_cluster_validated(session, cluster)
|
is_cluster_validated(session, cluster)
|
||||||
utils.update_db_object(session, cluster.state, state='INITIALIZED')
|
utils.update_db_object(session, cluster.state, state='INITIALIZED')
|
||||||
@ -1127,12 +1128,15 @@ def deploy_cluster(
|
|||||||
|
|
||||||
celery_client.celery.send_task(
|
celery_client.celery.send_task(
|
||||||
'compass.tasks.deploy_cluster',
|
'compass.tasks.deploy_cluster',
|
||||||
(deployer.email, cluster_id, deploy.get('clusterhosts', []))
|
(
|
||||||
|
deployer.email, cluster_id,
|
||||||
|
[clusterhost.id for clusterhost in clusterhosts]
|
||||||
|
)
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
'status': 'deploy action sent',
|
'status': 'deploy action sent',
|
||||||
'cluster': cluster,
|
'cluster': cluster,
|
||||||
'clusterhosts': cluster.clusterhosts
|
'clusterhosts': clusterhosts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,13 +17,12 @@ METADATA = {
|
|||||||
'field': 'general',
|
'field': 'general',
|
||||||
'default_value': 'UTC',
|
'default_value': 'UTC',
|
||||||
'options': [
|
'options': [
|
||||||
'GMT -12:00', 'GMT -11:00', 'GMT -10:00', 'GMT -9:00',
|
'America/New_York', 'America/Chicago',
|
||||||
'GMT -8:00', 'GMT -7:00', 'GMT -6:00', 'GMT -5:00',
|
'America/Los_Angeles', 'Asia/Shanghai',
|
||||||
'GMT -4:00', 'GMT -3:00', 'GMT -2:00', 'GMT -1:00',
|
'Asia/Tokyo', 'Europe/Paris',
|
||||||
'GMT 0:00', 'GMT +1:00', 'GMT +2:00', 'GMT +3:00',
|
'Europe/London', 'Europe/Moscow',
|
||||||
'GMT +4:00', 'GMT +5:00', 'GMT +6:00', 'GMT +7:00',
|
'Europe/Rome', 'Europe/Madrid',
|
||||||
'GMT +8:00', 'GMT +9:00', 'GMT +10:00', 'GMT +11:00',
|
'Europe/Berlin', 'UTC'
|
||||||
'GMT +12:00', 'UTC'
|
|
||||||
],
|
],
|
||||||
'mapping_to': 'timezone'
|
'mapping_to': 'timezone'
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ADAPTER_NAME = 'openstack(chef)'
|
ADAPTER_NAME = 'openstack_icehouse'
|
||||||
ROLES = [{
|
ROLES = [{
|
||||||
'role': 'os-compute-worker',
|
'role': 'os-compute-worker',
|
||||||
'display_name': 'compute node',
|
'display_name': 'compute node',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user