diff --git a/hooks/cinder_hooks.py b/hooks/cinder_hooks.py index 78217774..543a120d 100755 --- a/hooks/cinder_hooks.py +++ b/hooks/cinder_hooks.py @@ -91,6 +91,7 @@ from charmhelpers.fetch import ( from charmhelpers.core.host import ( lsb_release, service_reload, + service_start, umount, ) @@ -182,6 +183,11 @@ def install(): 'cinder', restart_handler=lambda: service_restart('cinder-api')) + # Make sure iscsid has a unique InitiatorName by starting iscsid + # and invoking /lib/open-iscsi/startup-checks.sh indirectly as + # ExecStartPre script of it + service_start('iscsid') + @hooks.hook('config-changed') @restart_on_change(restart_map(), stopstart=True) @@ -621,6 +627,11 @@ def upgrade_charm(): 'cinder', restart_handler=lambda: service_restart('cinder-api')) + # Make sure iscsid has a unique InitiatorName by starting iscsid + # and invoking /lib/open-iscsi/startup-checks.sh indirectly as + # ExecStartPre script of it + service_start('iscsid') + @hooks.hook('storage-backend-relation-changed') @hooks.hook('storage-backend-relation-broken') diff --git a/unit_tests/test_cinder_hooks.py b/unit_tests/test_cinder_hooks.py index 228cc78f..2a64ef01 100644 --- a/unit_tests/test_cinder_hooks.py +++ b/unit_tests/test_cinder_hooks.py @@ -77,6 +77,7 @@ TO_PATCH = [ 'filter_installed_packages', 'service_reload', 'service_restart', + 'service_start', # charmhelpers.contrib.openstack.openstack_utils 'configure_installation_source', 'openstack_upgrade_available',