AHV - count how many vCPU use in one node

count how many vCPU used with power on VM in one node
vCPU used = vCPU * core
(the result do not containt CVM core)

_________________________________________

#!/bin/bash

total="0"
VM=(`virsh list | gawk -F' ' '{printf("%s\n",$2);}'|awk 'NR>3{print p}{p=$0}'`)

for i in ${VM[@]};
do
        vmcore="$(acli vm.get $i |grep "num_cores_per_vcpu" | cut -d":" -f 2)"
        vmcpu="$(acli vm.get $i |grep "num_vcpus" | cut -d":" -f 2)"
        vmcpu=$((vmcore * vmcpu))

        total=$((total + vmcpu))
done

echo $total
_________________________________________

留言

這個網誌中的熱門文章

Easy way for Try out o365 E3 - Step2 - Install Azure AD connect sync AD account to o365

AHV - migrate all VM on one node to other node

Win7 RSAT & 2003R2 ADWS