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
diff --git a/lib/ironic b/lib/ironic
index c6fa563..9b4f668 100644
--- a/lib/ironic
+++ b/lib/ironic
@@ -284,20 +284,12 @@
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 {
diff --git a/lib/nova_plugins/hypervisor-ironic b/lib/nova_plugins/hypervisor-ironic
index 5af7c0b..4887db7 100644
--- a/lib/nova_plugins/hypervisor-ironic
+++ b/lib/nova_plugins/hypervisor-ironic
@@ -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 @@
# 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 @@
# 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