add volume gestion
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
e29d75ab60
commit
0dfc8b2e7e
1 changed files with 35 additions and 0 deletions
35
agent.sh
35
agent.sh
|
|
@ -80,6 +80,32 @@ function stop_vm {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_volume {
|
||||||
|
DEFINE_string 'volume_name' '-' 'Volume Name' 'v'
|
||||||
|
DEFINE_string 'backind_volume' '-' 'Volume Back' 'b'
|
||||||
|
DEFINE_string 'volume_size' '-' 'Volume Size' 's'
|
||||||
|
DEFINE_boolean 'dryrun' false 'Enable dry-run mode' 'd'
|
||||||
|
|
||||||
|
FLAGS "$@" || exit $?
|
||||||
|
eval set -- "${FLAGS_ARGV}"
|
||||||
|
|
||||||
|
qemu-img create \
|
||||||
|
-f qcow2 -b "${FLAGS_backind_volume}" \
|
||||||
|
-F qcow2 "${FLAGS_volume_name}" \
|
||||||
|
"${FLAGS_volume_size}"
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_volume {
|
||||||
|
DEFINE_string 'volume_name' '-' 'Volume Name' 'v'
|
||||||
|
DEFINE_boolean 'dryrun' false 'Enable dry-run mode' 'd'
|
||||||
|
|
||||||
|
FLAGS "$@" || exit $?
|
||||||
|
eval set -- "${FLAGS_ARGV}"
|
||||||
|
|
||||||
|
rm -rf "${FLAGS_backind_volume}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function main {
|
function main {
|
||||||
fonction="${1}"
|
fonction="${1}"
|
||||||
shift 1
|
shift 1
|
||||||
|
|
@ -91,10 +117,19 @@ function main {
|
||||||
"StopVm")
|
"StopVm")
|
||||||
stop_vm "$@"
|
stop_vm "$@"
|
||||||
;;
|
;;
|
||||||
|
"CreateVolume")
|
||||||
|
create_volume "$@"
|
||||||
|
;;
|
||||||
|
"DeleteVolume")
|
||||||
|
delete_volume "$@"
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
echo "action : ${fonction} not known !"
|
echo "action : ${fonction} not known !"
|
||||||
echo "avalable action :"
|
echo "avalable action :"
|
||||||
echo " -> StartVm"
|
echo " -> StartVm"
|
||||||
|
echo " -> StopVm"
|
||||||
|
echo " -> CreateVolume"
|
||||||
|
echo " -> DeleteVolume"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue