From fd2f8679aab9ea9eebee0321f56061fa1323d191 Mon Sep 17 00:00:00 2001 From: Will Miller Date: Tue, 11 Sep 2018 08:40:14 +0000 Subject: [PATCH] Disable automatic power-on of Libvirt nodes Ironic will be controlling the power state of the nodes, and we may want to be able to control when inspection happens, so don't start Libvirt domains automatically. --- ansible/create_nodes.yml | 1 + ansible/filter_plugins/tenks.py | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/ansible/create_nodes.yml b/ansible/create_nodes.yml index 8cd22c0..f3d459d 100644 --- a/ansible/create_nodes.yml +++ b/ansible/create_nodes.yml @@ -21,4 +21,5 @@ libvirt_vms: >- {{ nodes | map('set_libvirt_interfaces') | map('set_libvirt_volume_pool') + | map('set_libvirt_start_params') | list }} diff --git a/ansible/filter_plugins/tenks.py b/ansible/filter_plugins/tenks.py index e284f22..e736c68 100644 --- a/ansible/filter_plugins/tenks.py +++ b/ansible/filter_plugins/tenks.py @@ -41,6 +41,7 @@ class FilterModule(object): # Libvirt filters. 'set_libvirt_interfaces': set_libvirt_interfaces, + 'set_libvirt_start_params': set_libvirt_start_params, 'set_libvirt_volume_pool': set_libvirt_volume_pool, # Miscellaneous filters. @@ -83,6 +84,18 @@ def set_libvirt_volume_pool(context, node): return node +def set_libvirt_start_params(node): + """Set the Libvirt start and autostart parameters. + + Since Ironic will be managing the power state and we may want to perform + inspection, don't start the VM after definition or automatically start on + host start-up. + """ + node['start'] = False + node['autostart'] = False + return node + + @contextfilter def bridge_name(context, physnet): """Get the Tenks OVS bridge name from a physical network name.