Ajout : fonctions pour manipuler des images disque dans qemush

This commit is contained in:
Hippolyte Chauvin 2023-10-15 12:08:45 +02:00
parent 7db32e1bbf
commit c115dbd144

View file

@ -28,6 +28,9 @@ ${name}: usage:
${name} active - (default behaviour) list active VMs ${name} active - (default behaviour) list active VMs
${name} list - list available VMs ${name} list - list available VMs
${name} help - show this help ${name} help - show this help
${name} diskls - list available disk images
${name} diskadd <disk name> <size> - create a disk image
${name} diskrm <disk name> - delete disk image
EOF EOF
} }
@ -57,6 +60,23 @@ public_list() {
ls --color=auto bin ls --color=auto bin
} }
diskpath() {
printf 'images/%s.qcow2' "$1"
}
public_diskadd() {
qemu-img create -f qcow2 "$(diskpath "$1")" "$2"
}
public_diskrm() {
rm -vi -- "$(diskpath "$1")"
}
public_diskls() {
echo "Available disks:"
ls --color=auto images
}
function="$1" function="$1"
shift shift