blob: abf59b8008cd28f111b2ceec77b0629b276581c1 [file] [log] [blame]
Alexander Gordeev06fb29c2014-01-31 18:02:07 +04001# lib/nova_plugins/hypervisor-ironic
2# Configure the ironic hypervisor
3
4# Enable with:
5# VIRT_DRIVER=ironic
6
7# Dependencies:
8# ``functions`` file
9# ``nova`` configuration
10
11# install_nova_hypervisor - install any external requirements
12# configure_nova_hypervisor - make configuration changes, including those to other services
13# start_nova_hypervisor - start any external services
14# stop_nova_hypervisor - stop any external services
15# cleanup_nova_hypervisor - remove transient data and cache
16
17# Save trace setting
18MY_XTRACE=$(set +o | grep xtrace)
19set +o xtrace
20
Adam Gandelmanea861742014-03-17 16:23:01 -070021source $TOP_DIR/lib/nova_plugins/functions-libvirt
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040022
23# Defaults
24# --------
25
26# Entry Points
27# ------------
28
29# clean_nova_hypervisor - Clean up an installation
30function cleanup_nova_hypervisor {
31 # This function intentionally left blank
32 :
33}
34
35# configure_nova_hypervisor - Set config files, create data dirs, etc
36function configure_nova_hypervisor {
Adam Gandelmanea861742014-03-17 16:23:01 -070037 configure_libvirt
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040038 LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"}
Davide Guerri08448e32014-03-21 18:14:18 +000039
Devananda van der Veend0023fd2014-09-08 10:41:04 -070040 iniset $NOVA_CONF DEFAULT compute_driver nova.virt.ironic.IronicDriver
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040041 iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER
Devananda van der Veend0023fd2014-09-08 10:41:04 -070042 iniset $NOVA_CONF DEFAULT scheduler_host_manager nova.scheduler.ironic_host_manager.IronicHostManager
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040043 iniset $NOVA_CONF DEFAULT ram_allocation_ratio 1.0
44 iniset $NOVA_CONF DEFAULT reserved_host_memory_mb 0
45 # ironic section
46 iniset $NOVA_CONF ironic admin_username admin
47 iniset $NOVA_CONF ironic admin_password $ADMIN_PASSWORD
Jamie Lennox3561d7f2014-05-21 17:18:43 +100048 iniset $NOVA_CONF ironic admin_url $KEYSTONE_AUTH_URI/v2.0
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040049 iniset $NOVA_CONF ironic admin_tenant_name demo
Adam Gandelman4b45fca2014-11-17 09:59:23 -080050 iniset $NOVA_CONF ironic api_endpoint $IRONIC_SERVICE_PROTOCOL://$IRONIC_HOSTPORT/v1
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040051}
52
53# install_nova_hypervisor() - Install external components
54function install_nova_hypervisor {
Adam Gandelman6d271482014-08-05 18:12:29 -070055 if ! is_service_enabled neutron; then
56 die $LINENO "Neutron should be enabled for usage of the Ironic Nova driver."
57 fi
Adam Gandelmanea861742014-03-17 16:23:01 -070058 install_libvirt
Adam Gandelman9eb81772014-11-21 09:41:45 -080059 if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] && is_ubuntu; then
60 # Ubuntu packaging+apparmor issue prevents libvirt from loading
61 # the ROM from /usr/share/misc. Workaround by installing it directly
62 # to a directory that it can read from. (LP: #1393548)
63 sudo rm -rf /usr/share/qemu/sgabios.bin
64 sudo cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin
65 fi
Alexander Gordeev06fb29c2014-01-31 18:02:07 +040066}
67
68# start_nova_hypervisor - Start any required external services
69function start_nova_hypervisor {
70 # This function intentionally left blank
71 :
72}
73
74# stop_nova_hypervisor - Stop any external services
75function stop_nova_hypervisor {
76 # This function intentionally left blank
77 :
78}
79
80
81# Restore xtrace
82$MY_XTRACE
83
84# Local variables:
85# mode: shell-script
86# End: