48 lines
966 B
Plaintext
48 lines
966 B
Plaintext
#!/bin/sh
|
|
<%= node["openstack"]["block-storage"]["custom_template_banner"] %>
|
|
#
|
|
# cinder volume group active script
|
|
#
|
|
# only support start action
|
|
# chkconfig: - 98 02
|
|
#
|
|
### BEGIN INIT INFO
|
|
# Required-Start: $remote_fs $network $syslog
|
|
# Required-Stop: $remote_fs $syslog
|
|
# Default-Start: 2 3 4 5
|
|
# Default-Stop: 0 1 6
|
|
# Short-Description: cinder volume group active script
|
|
### END INIT INFO
|
|
|
|
<% if %w{rhel}.include? node.platform_family %>
|
|
. /etc/rc.d/init.d/functions
|
|
<% end %>
|
|
|
|
start()
|
|
{
|
|
vgs <%= @volume_name %> > /dev/null 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
echo -n "Activating cinder volume group ..."
|
|
vgcreate <%= @volume_name %> $(losetup --show -f <%= @volume_file %>)
|
|
<% if %w{rhel}.include? node.platform_family %>
|
|
success
|
|
echo
|
|
<% elsif %w{debian}.include? node.platform_family %>
|
|
echo "SUCCESS"
|
|
<% end %>
|
|
fi
|
|
}
|
|
|
|
RETVAL=0
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start}"
|
|
RETVAL=1
|
|
esac
|
|
|
|
exit $RETVAL
|