mirror of
https://github.com/ceph/ceph
synced 2024-12-25 21:03:31 +00:00
3aae5ca6fd
/bin/bash is a Linuxism. Other operating systems install bash to different paths. Use /usr/bin/env in shebangs to find bash. Signed-off-by: Alan Somers <asomers@gmail.com>
24 lines
986 B
Bash
Executable File
24 lines
986 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -fv
|
|
|
|
#
|
|
# Create a glance image, a corresponding cinder volume, a nova instance, attach, the cinder volume to the
|
|
# nova instance, and create a backup.
|
|
#
|
|
image_name=${1}X
|
|
file_name=${2-rhel-server-7.2-x86_64-boot.iso}
|
|
source ./keystonerc_admin
|
|
glance image-create --name $image_name --disk-format iso --container-format bare --file $file_name
|
|
glance_id=`glance image-list | grep ${image_name} | sed 's/^| //' | sed 's/ |.*//'`
|
|
cinder create --image-id ${glance_id} --display-name ${image_name}-volume 8
|
|
nova boot --image ${image_name} --flavor 1 ${image_name}-inst
|
|
cinder_id=`cinder list | grep ${image_name} | sed 's/^| //' | sed 's/ |.*//'`
|
|
chkr=`cinder list | grep ${image_name}-volume | grep available`
|
|
while [ -z "$chkr" ]; do
|
|
sleep 30
|
|
chkr=`cinder list | grep ${image_name}-volume | grep available`
|
|
done
|
|
nova volume-attach ${image_name}-inst ${cinder_id} auto
|
|
sleep 30
|
|
cinder backup-create --name ${image_name}-backup ${image_name}-volume --force
|