Add vm control scripts

This commit is contained in:
Thales Maciel 2026-01-29 14:36:16 -03:00
parent 6aa191663a
commit 75f03aeb04
No known key found for this signature in database
GPG key ID: 33112E6833C34679
6 changed files with 270 additions and 16 deletions

6
run.sh
View file

@ -36,7 +36,9 @@ CIDR="24"
DEFAULT_VCPU=2
DEFAULT_RAM=1024
MIN_VCPU=1
MAX_VCPU=16
MIN_RAM=256
MAX_RAM=32768
MAX_DISK_BYTES=$((128 * 1024 * 1024 * 1024))
@ -108,7 +110,7 @@ if ! [[ "$VCPU_COUNT" =~ ^[0-9]+$ ]]; then
log "invalid --vcpu value: $VCPU_COUNT"
exit 1
fi
if (( VCPU_COUNT < 1 || VCPU_COUNT > MAX_VCPU )); then
if (( VCPU_COUNT < MIN_VCPU || VCPU_COUNT > MAX_VCPU )); then
log "vcpu must be between 1 and $MAX_VCPU"
exit 1
fi
@ -117,7 +119,7 @@ if ! [[ "$RAM_MIB" =~ ^[0-9]+$ ]]; then
log "invalid --ram value: $RAM_MIB"
exit 1
fi
if (( RAM_MIB < 256 || RAM_MIB > MAX_RAM )); then
if (( RAM_MIB < MIN_RAM || RAM_MIB > MAX_RAM )); then
log "ram must be between 256 and $MAX_RAM MiB"
exit 1
fi