-
Notifications
You must be signed in to change notification settings - Fork 0
Linux Virtual
Ethan Block edited this page Sep 16, 2015
·
8 revisions
-
View All Virtuals Storage Type from cli..
Uses:
The qm commandsqm listandqm showcmdand parses them..
Options:
Update print command to not use function TYPE(f), rather just f to see full details of file string
COMMAND:
awk 'function TYPE(U){U2="";if(U~/raw/)U2="raw";if(U~/iso/)U2="iso";if(U~/qcow/)U2="qcow";if(U~/ceph/)U2="ceph";if(!U2)U2="UNKNOWN";return U2}function pulldisk(L){for(c=1;c<=split(L,s,/ */);c++){y=s[c];if(y~/-drive/){n=s[c+1];f="";i="";for(c2=1;c2<=split(n,s2,",");c2++){y2=s2[c2];if(y2~/file=/)f=substr(y2,6);if(y2~/id=/)i=substr(y2,4)};printf("%-20s %-5s %-20s %s\n",NAME,ID,i,TYPE(f))}}}BEGIN{C="qm list";while(C|getline>0){if($0~/VMID/)continue;NAME=$2;ID=$1;C2="qm showcmd "ID;while(C2|getline LINE >0){pulldisk(LINE)};close(C2)};close(C)}'