+ de hardware pour les VM du pool profs
This commit is contained in:
parent
24a364bfcb
commit
41aa4168af
@ -1,6 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
TEMPLATE_VM_ID=202404001
|
TEMPLATE_VM_ID=202404001
|
||||||
|
|
||||||
|
PROFS_CPU_CORES_MULTIPLIER=4
|
||||||
|
PROFS_RAM_MULTIPLIER=2
|
||||||
|
|
||||||
INPUT_FILE=$1
|
INPUT_FILE=$1
|
||||||
POOL_NAME=$2
|
POOL_NAME=$2
|
||||||
NEXT_VM_ID=$3
|
NEXT_VM_ID=$3
|
||||||
@ -33,6 +36,15 @@ while read -r username; do
|
|||||||
echo "Creating VM for $username in $POOL_NAME"
|
echo "Creating VM for $username in $POOL_NAME"
|
||||||
qm clone $TEMPLATE_VM_ID $NEXT_VM_ID --name "$username" --full false --pool $POOL_NAME
|
qm clone $TEMPLATE_VM_ID $NEXT_VM_ID --name "$username" --full false --pool $POOL_NAME
|
||||||
qm set $NEXT_VM_ID --args "-fw_cfg name=\"opt/fr.iut-fbleau/hostname\",string=\"vm-$username\" -fw_cfg name=\"opt/fr.iut-fbleau/domainname\",string=\"vm.iut-fbleau.fr\""
|
qm set $NEXT_VM_ID --args "-fw_cfg name=\"opt/fr.iut-fbleau/hostname\",string=\"vm-$username\" -fw_cfg name=\"opt/fr.iut-fbleau/domainname\",string=\"vm.iut-fbleau.fr\""
|
||||||
pvesh set /access/acl --path /vms/$NEXT_VM_ID --roles PVEVMUser --users "$username@arda.lan"
|
|
||||||
|
if [ "$POOL_NAME" == "profs" ]; then
|
||||||
|
CURRENT_CORES=$(qm config $NEXT_VM_ID | grep "^cores" | awk '{print $2}')
|
||||||
|
CURRENT_RAM=$(qm config $NEXT_VM_ID | grep "^memory" | awk '{print $2}')
|
||||||
|
NEW_CORES=$((CURRENT_CORES * PROFS_CPU_CORES_MULTIPLIER))
|
||||||
|
NEW_RAM=$((CURRENT_RAM * PROFS_RAM_MULTIPLIER))
|
||||||
|
qm set $NEXT_VM_ID --cores $NEW_CORES --memory $NEW_RAM
|
||||||
|
fi
|
||||||
|
|
||||||
|
pvesh set /access/acl --path /vms/$NEXT_VM_ID --roles etu --users "$username@arda.lan"
|
||||||
((NEXT_VM_ID++))
|
((NEXT_VM_ID++))
|
||||||
done < "$INPUT_FILE"
|
done < "$INPUT_FILE"
|
||||||
|
Loading…
Reference in New Issue
Block a user