mirror of
https://github.com/RROrg/rr.git
synced 2025-12-08 21:19:43 +08:00
Improve VMID generation logic in pve.sh
Refactor VMID assignment logic to handle empty last VMID.
This commit is contained in:
parent
8e7f50c2e5
commit
2909e46732
@ -139,7 +139,14 @@ fi
|
|||||||
echo "Creating VM with RR ... "
|
echo "Creating VM with RR ... "
|
||||||
|
|
||||||
# 获取可用的 VMID
|
# 获取可用的 VMID
|
||||||
VMID="$(($(qm list | awk 'NR>1{print $1}' | sort -n | tail -1 2>/dev/null || echo 99) + 1))"
|
last_vmid=$(qm list | awk 'NR>1{print$1}' | sort -n | tail -1 2>/dev/null)
|
||||||
|
if [ -z "$last_vmid" ]; then
|
||||||
|
# 如果 last_vmid 是空字符串,说明没有VM,设置一个起始ID
|
||||||
|
VMID=100
|
||||||
|
else
|
||||||
|
# 否则,在最后一个ID的基础上加1
|
||||||
|
VMID=$((last_vmid + 1))
|
||||||
|
fi
|
||||||
ARGS=""
|
ARGS=""
|
||||||
SATAIDX=0
|
SATAIDX=0
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user