def cluster_create(self, context, cluster, create_timeout):
    LOG.debug('cluster_heat cluster_create')
    osc = clients.OpenStackClients(context)
    cluster.status = fields.ClusterStatus.CREATE_IN_PROGRESS
    cluster.status_reason = None
    cluster.create()
    try:
        trust_manager.create_trustee_and_trust(osc, cluster)
        cert_manager.generate_certificates_to_cluster(cluster, context=context)
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_CREATE, taxonomy.OUTCOME_PENDING)
        cluster_driver = driver.Driver.get_driver_for_cluster(context, cluster)
        cluster_driver.create_cluster(context, cluster, create_timeout)
        cluster.save()
    except Exception as e:
        cluster.status = fields.ClusterStatus.CREATE_FAILED
        cluster.status_reason = six.text_type(e)
        cluster.save()
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_CREATE, taxonomy.OUTCOME_FAILURE)
        if isinstance(e, exc.HTTPBadRequest):
            e = exception.InvalidParameterValue(message=six.text_type(e))
            raise e
        raise
    return cluster
def cluster_create(self, context, cluster, create_timeout):
    LOG.debug('cluster_heat cluster_create')
    osc = clients.OpenStackClients(context)
    cluster.status = fields.ClusterStatus.CREATE_IN_PROGRESS
    cluster.status_reason = None
    cluster.create()
    try:
        trust_manager.create_trustee_and_trust(osc, cluster)
        cert_manager.generate_certificates_to_cluster(cluster, context=context)
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_CREATE, taxonomy.OUTCOME_PENDING)
        cluster_driver = driver.Driver.get_driver_for_cluster(context, cluster)
        cluster_driver.create_cluster(context, cluster, create_timeout)
        cluster.save()
    except Exception as e:
        cluster.status = fields.ClusterStatus.CREATE_FAILED
        cluster.status_reason = six.text_type(e)
        cluster.save()
        conductor_utils.notify_about_cluster_operation(context, taxonomy.ACTION_CREATE, taxonomy.OUTCOME_FAILURE)
        if isinstance(e, exc.HTTPBadRequest):
            e = exception.InvalidParameterValue(message=six.text_type(e))
            raise e
        raise
    return cluster