Sort VM list by vmid for better readability
VM 목록을 vmid 순서로 정렬: - running_vms.sort(key=lambda x: x['vmid']) 추가 - 201, 202, 203 순서로 표시되도록 개선 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5fa7812009
commit
545ad63b50
@ -114,11 +114,13 @@ get_vm_list_from_api() {
|
||||
"https://${pve_host}:8006/api2/json/nodes/${node_name}/qemu" \
|
||||
--cookie "PVEAuthCookie=${ticket}")
|
||||
|
||||
# VM 목록 파싱 (running 상태만)
|
||||
# VM 목록 파싱 (running 상태만, vmid 순서로 정렬)
|
||||
VM_LIST=$(echo "$vms_response" | python3 -c "
|
||||
import sys, json
|
||||
vms = json.load(sys.stdin)['data']
|
||||
running_vms = [vm for vm in vms if vm.get('status') == 'running']
|
||||
# vmid 순서로 정렬
|
||||
running_vms.sort(key=lambda x: x['vmid'])
|
||||
for vm in running_vms:
|
||||
print(f\"{vm['vmid']}:{vm.get('name', 'VM-' + str(vm['vmid']))}\")
|
||||
" 2>/dev/null || echo "")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user