#!/bin/bash
#
# Use the EVMS CLI to create a Snapshot feature-object.

readonly=$1

if [ "$readonly" = "-ro" ]; then
	writeable="false"
	shift
else
	writeable="true"
fi

child=$1
name=$2
origin=$3
chunksize=$4

if [ -z $origin ]; then
	echo "USAGE: `basename $0` [-ro] object snapshot_name origin_volume [chunk_size]"
	exit 1
fi

if [ -n $chunksize ]; then
	chunksize=64
fi

evms -s << EOF > /dev/null
create:object,Snapshot={snapshot=${name},original=${origin},chunksize=${chunksize}KB,writeable=${writeable}},$child
EOF

