Reuse existing libvirt setup functions for Ironic

When deploying Ironic, make use of the existing libvirt installation
and configuration used by the Nova libvirt driver. Ensures a functional
libvirt setup across distributions.

Change-Id: I904ae2bdd4e8299827270c351eb60b833f90ae75
This commit is contained in:
Adam Gandelman 2014-03-17 16:23:01 -07:00
parent 9f59782a36
commit ea861741d8
2 changed files with 3 additions and 10 deletions

View File

@ -284,20 +284,12 @@ function configure_ironic_dirs {
mkdir -p $IRONIC_TFTPBOOT_DIR/pxelinux.cfg
}
function ironic_ensure_libvirt_group {
groups $STACK_USER | grep -q $LIBVIRT_GROUP || adduser $STACK_USER $LIBVIRT_GROUP
}
function create_bridge_and_vms {
ironic_ensure_libvirt_group
# Call libvirt setup scripts in a new shell to ensure any new group membership
sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/setup-network"
sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/create-nodes \
$IRONIC_VM_SPECS_CPU $IRONIC_VM_SPECS_RAM $IRONIC_VM_SPECS_DISK \
amd64 $IRONIC_VM_COUNT $IRONIC_VM_NETWORK_BRIDGE $IRONIC_VM_EMULATOR" >> $IRONIC_VM_MACS_CSV_FILE
}
function enroll_vms {

View File

@ -18,6 +18,7 @@
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
source $TOP_DIR/lib/nova_plugins/functions-libvirt
# Defaults
# --------
@ -33,6 +34,7 @@ function cleanup_nova_hypervisor {
# configure_nova_hypervisor - Set config files, create data dirs, etc
function configure_nova_hypervisor {
configure_libvirt
iniset $NOVA_CONF ironic sql_connection `database_connection_url nova_bm`
LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"}
iniset $NOVA_CONF DEFAULT compute_driver ironic.nova.virt.ironic.IronicDriver
@ -50,8 +52,7 @@ function configure_nova_hypervisor {
# install_nova_hypervisor() - Install external components
function install_nova_hypervisor {
# This function intentionally left blank
:
install_libvirt
}
# start_nova_hypervisor - Start any required external services