move volumes
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
7d3db06f27
commit
0be259f2a9
2 changed files with 32 additions and 18 deletions
19
agent.sh
19
agent.sh
|
|
@ -12,6 +12,7 @@
|
||||||
. ./lib/colors.sh
|
. ./lib/colors.sh
|
||||||
. ./lib/qemu.sh
|
. ./lib/qemu.sh
|
||||||
. ./lib/metadata.sh
|
. ./lib/metadata.sh
|
||||||
|
. ./lib/prime/volumes.sh
|
||||||
|
|
||||||
DRY_RUN="1"
|
DRY_RUN="1"
|
||||||
SIMULATION="1"
|
SIMULATION="1"
|
||||||
|
|
@ -75,31 +76,13 @@ 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 $?
|
FLAGS "$@" || exit $?
|
||||||
eval set -- "${FLAGS_ARGV}"
|
eval set -- "${FLAGS_ARGV}"
|
||||||
|
|
||||||
rm -rf "${FLAGS_backind_volume}"
|
rm -rf "${FLAGS_backind_volume}"
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function main {
|
function main {
|
||||||
fonction="${1}"
|
fonction="${1}"
|
||||||
|
|
|
||||||
31
lib/prime/volumes.sh
Normal file
31
lib/prime/volumes.sh
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function create_volume {
|
||||||
|
[[ -f ./libs/shflags ]] && . ./libs/shflags || eval "$(curl --silent https://git.g3e.fr/H6N/tools/raw/branch/main/libs/shflags)"
|
||||||
|
|
||||||
|
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 {
|
||||||
|
[[ -f ./libs/shflags ]] && . ./libs/shflags || eval "$(curl --silent https://git.g3e.fr/H6N/tools/raw/branch/main/libs/shflags)"
|
||||||
|
|
||||||
|
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}"
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue