Browse code

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

Adam Gandelman authored on 2014/03/18 08:23:01
Showing 2 changed files
... ...
@@ -284,20 +284,12 @@ function configure_ironic_dirs {
284 284
     mkdir -p $IRONIC_TFTPBOOT_DIR/pxelinux.cfg
285 285
 }
286 286
 
287
-function ironic_ensure_libvirt_group {
288
-    groups $STACK_USER | grep -q $LIBVIRT_GROUP || adduser $STACK_USER $LIBVIRT_GROUP
289
-}
290
-
291 287
 function create_bridge_and_vms {
292
-    ironic_ensure_libvirt_group
293
-
294 288
     # Call libvirt setup scripts in a new shell to ensure any new group membership
295 289
     sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/setup-network"
296
-
297 290
     sudo su $STACK_USER -c "$IRONIC_SCRIPTS_DIR/create-nodes \
298 291
         $IRONIC_VM_SPECS_CPU $IRONIC_VM_SPECS_RAM $IRONIC_VM_SPECS_DISK \
299 292
         amd64 $IRONIC_VM_COUNT $IRONIC_VM_NETWORK_BRIDGE $IRONIC_VM_EMULATOR" >> $IRONIC_VM_MACS_CSV_FILE
300
-
301 293
 }
302 294
 
303 295
 function enroll_vms {
... ...
@@ -18,6 +18,7 @@
18 18
 MY_XTRACE=$(set +o | grep xtrace)
19 19
 set +o xtrace
20 20
 
21
+source $TOP_DIR/lib/nova_plugins/functions-libvirt
21 22
 
22 23
 # Defaults
23 24
 # --------
... ...
@@ -33,6 +34,7 @@ function cleanup_nova_hypervisor {
33 33
 
34 34
 # configure_nova_hypervisor - Set config files, create data dirs, etc
35 35
 function configure_nova_hypervisor {
36
+    configure_libvirt
36 37
     iniset $NOVA_CONF ironic sql_connection `database_connection_url nova_bm`
37 38
     LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"}
38 39
     iniset $NOVA_CONF DEFAULT compute_driver ironic.nova.virt.ironic.IronicDriver
... ...
@@ -50,8 +52,7 @@ function configure_nova_hypervisor {
50 50
 
51 51
 # install_nova_hypervisor() - Install external components
52 52
 function install_nova_hypervisor {
53
-    # This function intentionally left blank
54
-    :
53
+    install_libvirt
55 54
 }
56 55
 
57 56
 # start_nova_hypervisor - Start any required external services