| Dean Troyer | 8c032d1 | 2013-09-23 13:53:13 -0500 | [diff] [blame] | 1 | # lib/nova_plugins/hypervisor-baremetal | 
|  | 2 | # Configure the baremetal hypervisor | 
|  | 3 |  | 
|  | 4 | # Enable with: | 
|  | 5 | # VIRT_DRIVER=baremetal | 
|  | 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 | 
|  | 18 | MY_XTRACE=$(set +o | grep xtrace) | 
|  | 19 | set +o xtrace | 
|  | 20 |  | 
|  | 21 |  | 
|  | 22 | # Defaults | 
|  | 23 | # -------- | 
|  | 24 |  | 
|  | 25 | NETWORK_MANAGER=${NETWORK_MANAGER:-FlatManager} | 
|  | 26 | PUBLIC_INTERFACE_DEFAULT=eth0 | 
|  | 27 | FLAT_INTERFACE=${FLAT_INTERFACE:-eth0} | 
|  | 28 | FLAT_NETWORK_BRIDGE_DEFAULT=br100 | 
|  | 29 | STUB_NETWORK=${STUB_NETWORK:-False} | 
|  | 30 |  | 
|  | 31 |  | 
|  | 32 | # Entry Points | 
|  | 33 | # ------------ | 
|  | 34 |  | 
|  | 35 | # clean_nova_hypervisor - Clean up an installation | 
|  | 36 | function cleanup_nova_hypervisor() { | 
|  | 37 | # This function intentionally left blank | 
|  | 38 | : | 
|  | 39 | } | 
|  | 40 |  | 
|  | 41 | # configure_nova_hypervisor - Set config files, create data dirs, etc | 
|  | 42 | function configure_nova_hypervisor() { | 
|  | 43 | configure_baremetal_nova_dirs | 
|  | 44 |  | 
|  | 45 | iniset $NOVA_CONF baremetal sql_connection `database_connection_url nova_bm` | 
|  | 46 | LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"} | 
|  | 47 | iniset $NOVA_CONF DEFAULT compute_driver nova.virt.baremetal.driver.BareMetalDriver | 
|  | 48 | iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER | 
|  | 49 | iniset $NOVA_CONF DEFAULT scheduler_host_manager nova.scheduler.baremetal_host_manager.BaremetalHostManager | 
|  | 50 | iniset $NOVA_CONF DEFAULT ram_allocation_ratio 1.0 | 
|  | 51 | iniset $NOVA_CONF DEFAULT reserved_host_memory_mb 0 | 
|  | 52 | iniset $NOVA_CONF baremetal instance_type_extra_specs cpu_arch:$BM_CPU_ARCH | 
|  | 53 | iniset $NOVA_CONF baremetal driver $BM_DRIVER | 
|  | 54 | iniset $NOVA_CONF baremetal power_manager $BM_POWER_MANAGER | 
|  | 55 | iniset $NOVA_CONF baremetal tftp_root /tftpboot | 
|  | 56 | if [[ "$BM_DNSMASQ_FROM_NOVA_NETWORK" = "True" ]]; then | 
|  | 57 | BM_DNSMASQ_CONF=$NOVA_CONF_DIR/dnsmasq-for-baremetal-from-nova-network.conf | 
|  | 58 | sudo cp "$FILES/dnsmasq-for-baremetal-from-nova-network.conf" "$BM_DNSMASQ_CONF" | 
|  | 59 | iniset $NOVA_CONF DEFAULT dnsmasq_config_file "$BM_DNSMASQ_CONF" | 
|  | 60 | fi | 
|  | 61 |  | 
|  | 62 | # Define extra baremetal nova conf flags by defining the array ``EXTRA_BAREMETAL_OPTS``. | 
|  | 63 | for I in "${EXTRA_BAREMETAL_OPTS[@]}"; do | 
| Sean Dague | 101b424 | 2013-10-22 08:47:11 -0400 | [diff] [blame] | 64 | # Attempt to convert flags to options | 
|  | 65 | iniset $NOVA_CONF baremetal ${I/=/ } | 
| Dean Troyer | 8c032d1 | 2013-09-23 13:53:13 -0500 | [diff] [blame] | 66 | done | 
|  | 67 | } | 
|  | 68 |  | 
|  | 69 | # install_nova_hypervisor() - Install external components | 
|  | 70 | function install_nova_hypervisor() { | 
|  | 71 | # This function intentionally left blank | 
|  | 72 | : | 
|  | 73 | } | 
|  | 74 |  | 
|  | 75 | # start_nova_hypervisor - Start any required external services | 
|  | 76 | function start_nova_hypervisor() { | 
|  | 77 | # This function intentionally left blank | 
|  | 78 | : | 
|  | 79 | } | 
|  | 80 |  | 
|  | 81 | # stop_nova_hypervisor - Stop any external services | 
|  | 82 | function stop_nova_hypervisor() { | 
|  | 83 | # This function intentionally left blank | 
|  | 84 | : | 
|  | 85 | } | 
|  | 86 |  | 
|  | 87 |  | 
|  | 88 | # Restore xtrace | 
|  | 89 | $MY_XTRACE | 
|  | 90 |  | 
|  | 91 | # Local variables: | 
|  | 92 | # mode: shell-script | 
|  | 93 | # End: |