blob: 062afb7f7c23e7cdf3bf3dcc98976a7169166ee4 [file] [log] [blame]
Sean Daguee263c822014-12-05 14:25:28 -05001#!/bin/bash
2#
Alexander Gordeev06fb29c2014-01-31 18:02:07 +04003# lib/nova_plugins/hypervisor-ironic
4# Configure the ironic hypervisor
5
6# Enable with:
7# VIRT_DRIVER=ironic
8
9# Dependencies:
10# ``functions`` file
11# ``nova`` configuration
12
13# install_nova_hypervisor - install any external requirements
14# configure_nova_hypervisor - make configuration changes, including those to other services
15# start_nova_hypervisor - start any external services
16# stop_nova_hypervisor - stop any external services
17# cleanup_nova_hypervisor - remove transient data and cache
18
19# Save trace setting
Ian Wienand523f4882015-10-13 11:03:03 +110020_XTRACE_HYP_IRONIC=$(set +o | grep xtrace)
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040021set +o xtrace
22
Adam Gandelmanea861742014-03-17 16:23:01 -070023source $TOP_DIR/lib/nova_plugins/functions-libvirt
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040024
25# Defaults
26# --------
27
28# Entry Points
29# ------------
30
31# clean_nova_hypervisor - Clean up an installation
32function cleanup_nova_hypervisor {
33 # This function intentionally left blank
34 :
35}
36
37# configure_nova_hypervisor - Set config files, create data dirs, etc
38function configure_nova_hypervisor {
Adam Gandelmanea861742014-03-17 16:23:01 -070039 configure_libvirt
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040040 LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"}
Davide Guerri08448e32014-03-21 18:14:18 +000041
vsaienkoe3a04dd2016-04-26 10:26:25 +030042 iniset $NOVA_CONF DEFAULT compute_driver ironic.IronicDriver
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040043 iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER
Yingxinb298e572016-01-29 05:11:27 +000044 iniset $NOVA_CONF DEFAULT scheduler_host_manager ironic_host_manager
Sam Betts80149452017-08-03 12:41:36 +010045
46 if [[ "$IRONIC_USE_RESOURCE_CLASSES" == "False" ]]; then
47 iniset $NOVA_CONF filter_scheduler use_baremetal_filters True
48 fi
49
Vasyl Saienko0525e772017-08-15 22:02:30 +030050 iniset $NOVA_CONF filter_scheduler host_subset_size 999
51
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040052 iniset $NOVA_CONF DEFAULT ram_allocation_ratio 1.0
53 iniset $NOVA_CONF DEFAULT reserved_host_memory_mb 0
54 # ironic section
Clenimar Filemon57df1862016-06-30 17:30:26 -030055 iniset $NOVA_CONF ironic auth_type password
56 iniset $NOVA_CONF ironic username admin
57 iniset $NOVA_CONF ironic password $ADMIN_PASSWORD
Sean Daguec13b8a12017-04-20 06:54:51 -040058 iniset $NOVA_CONF ironic auth_url $KEYSTONE_AUTH_URI
Clenimar Filemon57df1862016-06-30 17:30:26 -030059 iniset $NOVA_CONF ironic project_domain_id default
60 iniset $NOVA_CONF ironic user_domain_id default
61 iniset $NOVA_CONF ironic project_name demo
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040062}
63
64# install_nova_hypervisor() - Install external components
65function install_nova_hypervisor {
Adam Gandelmande77c472015-03-11 17:15:42 -070066 if is_ironic_hardware; then
Zhongyue Luo37026f52014-12-16 10:56:54 +080067 return
Adam Gandelman6d271482014-08-05 18:12:29 -070068 fi
Adam Gandelmanea861742014-03-17 16:23:01 -070069 install_libvirt
Adam Gandelman9eb81772014-11-21 09:41:45 -080070 if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] && is_ubuntu; then
71 # Ubuntu packaging+apparmor issue prevents libvirt from loading
72 # the ROM from /usr/share/misc. Workaround by installing it directly
73 # to a directory that it can read from. (LP: #1393548)
74 sudo rm -rf /usr/share/qemu/sgabios.bin
75 sudo cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin
76 fi
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040077}
78
79# start_nova_hypervisor - Start any required external services
80function start_nova_hypervisor {
81 # This function intentionally left blank
82 :
83}
84
85# stop_nova_hypervisor - Stop any external services
86function stop_nova_hypervisor {
87 # This function intentionally left blank
88 :
89}
90
91
92# Restore xtrace
Ian Wienand523f4882015-10-13 11:03:03 +110093$_XTRACE_HYP_IRONIC
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040094
95# Local variables:
96# mode: shell-script
97# End: