| Sean Dague | e263c82 | 2014-12-05 14:25:28 -0500 | [diff] [blame] | 1 | #!/bin/bash | 
 | 2 | # | 
| Alexander Gordeev | 06fb29c | 2014-01-31 18:02:07 +0400 | [diff] [blame] | 3 | # 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 Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 20 | _XTRACE_HYP_IRONIC=$(set +o | grep xtrace) | 
| Alexander Gordeev | 06fb29c | 2014-01-31 18:02:07 +0400 | [diff] [blame] | 21 | set +o xtrace | 
 | 22 |  | 
| Adam Gandelman | ea86174 | 2014-03-17 16:23:01 -0700 | [diff] [blame] | 23 | source $TOP_DIR/lib/nova_plugins/functions-libvirt | 
| Alexander Gordeev | 06fb29c | 2014-01-31 18:02:07 +0400 | [diff] [blame] | 24 |  | 
 | 25 | # Defaults | 
 | 26 | # -------- | 
 | 27 |  | 
 | 28 | # Entry Points | 
 | 29 | # ------------ | 
 | 30 |  | 
 | 31 | # clean_nova_hypervisor - Clean up an installation | 
 | 32 | function cleanup_nova_hypervisor { | 
 | 33 |     # This function intentionally left blank | 
 | 34 |     : | 
 | 35 | } | 
 | 36 |  | 
 | 37 | # configure_nova_hypervisor - Set config files, create data dirs, etc | 
 | 38 | function configure_nova_hypervisor { | 
| Vanou Ishii | 705e9cb | 2019-07-02 00:40:24 -0400 | [diff] [blame] | 39 |     if ! is_ironic_hardware; then | 
 | 40 |         configure_libvirt | 
 | 41 |     fi | 
| Davide Guerri | 08448e3 | 2014-03-21 18:14:18 +0000 | [diff] [blame] | 42 |  | 
| vsaienko | e3a04dd | 2016-04-26 10:26:25 +0300 | [diff] [blame] | 43 |     iniset $NOVA_CONF DEFAULT compute_driver ironic.IronicDriver | 
| Sam Betts | 8014945 | 2017-08-03 12:41:36 +0100 | [diff] [blame] | 44 |  | 
| Alexander Gordeev | 06fb29c | 2014-01-31 18:02:07 +0400 | [diff] [blame] | 45 |     # ironic section | 
| Clenimar Filemon | 57df186 | 2016-06-30 17:30:26 -0300 | [diff] [blame] | 46 |     iniset $NOVA_CONF ironic auth_type password | 
 | 47 |     iniset $NOVA_CONF ironic username admin | 
 | 48 |     iniset $NOVA_CONF ironic password $ADMIN_PASSWORD | 
| Sean Dague | c13b8a1 | 2017-04-20 06:54:51 -0400 | [diff] [blame] | 49 |     iniset $NOVA_CONF ironic auth_url $KEYSTONE_AUTH_URI | 
| Clenimar Filemon | 57df186 | 2016-06-30 17:30:26 -0300 | [diff] [blame] | 50 |     iniset $NOVA_CONF ironic project_domain_id default | 
 | 51 |     iniset $NOVA_CONF ironic user_domain_id default | 
 | 52 |     iniset $NOVA_CONF ironic project_name demo | 
| Erik Olof Gunnar Andersson | a13474f | 2019-04-18 12:18:23 -0700 | [diff] [blame] | 53 |     iniset $NOVA_CONF ironic region_name $REGION_NAME | 
| Vasyl Saienko | 64039ef | 2018-01-23 12:06:57 +0200 | [diff] [blame] | 54 |  | 
| Eric Fried | e273c04 | 2019-08-13 14:28:24 -0500 | [diff] [blame] | 55 |     # These are used with crufty legacy ironicclient | 
| Vasyl Saienko | 64039ef | 2018-01-23 12:06:57 +0200 | [diff] [blame] | 56 |     iniset $NOVA_CONF ironic api_max_retries 300 | 
 | 57 |     iniset $NOVA_CONF ironic api_retry_interval 5 | 
| Eric Fried | e273c04 | 2019-08-13 14:28:24 -0500 | [diff] [blame] | 58 |     # These are used with shiny new openstacksdk | 
 | 59 |     iniset $NOVA_CONF ironic connect_retries 300 | 
 | 60 |     iniset $NOVA_CONF ironic connect_retry_delay 5 | 
 | 61 |     iniset $NOVA_CONF ironic status_code_retries 300 | 
 | 62 |     iniset $NOVA_CONF ironic status_code_retry_delay 5 | 
| Alexander Gordeev | 06fb29c | 2014-01-31 18:02:07 +0400 | [diff] [blame] | 63 | } | 
 | 64 |  | 
 | 65 | # install_nova_hypervisor() - Install external components | 
 | 66 | function install_nova_hypervisor { | 
| Adam Gandelman | de77c47 | 2015-03-11 17:15:42 -0700 | [diff] [blame] | 67 |     if is_ironic_hardware; then | 
| Zhongyue Luo | 37026f5 | 2014-12-16 10:56:54 +0800 | [diff] [blame] | 68 |         return | 
| Adam Gandelman | 6d27148 | 2014-08-05 18:12:29 -0700 | [diff] [blame] | 69 |     fi | 
| Adam Gandelman | ea86174 | 2014-03-17 16:23:01 -0700 | [diff] [blame] | 70 |     install_libvirt | 
| Adam Gandelman | 9eb8177 | 2014-11-21 09:41:45 -0800 | [diff] [blame] | 71 |     if [[ "$IRONIC_VM_LOG_CONSOLE" == "True" ]] && is_ubuntu; then | 
 | 72 |         # Ubuntu packaging+apparmor issue prevents libvirt from loading | 
 | 73 |         # the ROM from /usr/share/misc.  Workaround by installing it directly | 
 | 74 |         # to a directory that it can read from. (LP: #1393548) | 
 | 75 |         sudo rm -rf /usr/share/qemu/sgabios.bin | 
 | 76 |         sudo cp /usr/share/misc/sgabios.bin /usr/share/qemu/sgabios.bin | 
 | 77 |     fi | 
| Alexander Gordeev | 06fb29c | 2014-01-31 18:02:07 +0400 | [diff] [blame] | 78 | } | 
 | 79 |  | 
 | 80 | # start_nova_hypervisor - Start any required external services | 
 | 81 | function start_nova_hypervisor { | 
 | 82 |     # This function intentionally left blank | 
 | 83 |     : | 
 | 84 | } | 
 | 85 |  | 
 | 86 | # stop_nova_hypervisor - Stop any external services | 
 | 87 | function stop_nova_hypervisor { | 
 | 88 |     # This function intentionally left blank | 
 | 89 |     : | 
 | 90 | } | 
 | 91 |  | 
 | 92 |  | 
 | 93 | # Restore xtrace | 
| Ian Wienand | 523f488 | 2015-10-13 11:03:03 +1100 | [diff] [blame] | 94 | $_XTRACE_HYP_IRONIC | 
| Alexander Gordeev | 06fb29c | 2014-01-31 18:02:07 +0400 | [diff] [blame] | 95 |  | 
 | 96 | # Local variables: | 
 | 97 | # mode: shell-script | 
 | 98 | # End: |