From a2f2e322be524aeedb4ff7522896a7c9a50998fd Mon Sep 17 00:00:00 2001
From: Jeffrey Zhang <zhang.lei.fly@gmail.com>
Date: Wed, 8 Mar 2017 21:59:09 +0800
Subject: [PATCH] Enable run nova-compute-ironic with nova-compute on the same
 node

It is unnecessary and a waste to run nova-compute-ironic on a single
node, change the host name field in nova-compute-ironic could ensure
nova-compute and nova-compute-ironic run on the same node.

Change-Id: If2acbf25caab0570da444472003599b9e0f2a1ff
Closes-Bug: #1671103
---
 ansible/roles/nova/defaults/main.yml      | 2 +-
 ansible/roles/nova/templates/nova.conf.j2 | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/ansible/roles/nova/defaults/main.yml b/ansible/roles/nova/defaults/main.yml
index d92a991485..c28525e9b7 100644
--- a/ansible/roles/nova/defaults/main.yml
+++ b/ansible/roles/nova/defaults/main.yml
@@ -112,7 +112,7 @@ nova_services:
     group: "compute"
     image: "{{ nova_compute_image_full }}"
     privileged: True
-    enabled: "{{ True if orchestration_engine == 'KUBERNETES' else not enable_nova_fake | bool and not enable_ironic | bool }}"
+    enabled: "{{ True if orchestration_engine == 'KUBERNETES' else not enable_nova_fake | bool }}"
     volumes:
       - "{{ node_config_directory }}/nova-compute/:{{ container_config_directory }}/:ro"
       - "/etc/localtime:/etc/localtime:ro"
diff --git a/ansible/roles/nova/templates/nova.conf.j2 b/ansible/roles/nova/templates/nova.conf.j2
index 191d6abdf2..9b4354297f 100644
--- a/ansible/roles/nova/templates/nova.conf.j2
+++ b/ansible/roles/nova/templates/nova.conf.j2
@@ -33,6 +33,7 @@ scheduler_host_manager = ironic_host_manager
 {% endif %}
 
 {% if service_name == "nova-compute-ironic" %}
+host={{ ansible_hostname }}-ironic
 compute_driver = ironic.IronicDriver
 vnc_enabled = False
 ram_allocation_ratio = 1.0