I can get a list of devices with qvm-block list, muck around with it in a bash script, and pass it to a python program. But there seems to be no way to get the size of the devices (unlike many other utilities there’s no way to specify what columns you want to see…or if there is, it’s totally undocumented; it doesn’t show up in the man page nor is it printed via --help). So this complete python noob is trying to figure out how to do this inside of python, since I’m just going to hand the list to a python script anyway.
So I am trying to call whatever classes, etc. to get a list of devices. I found /usr/lib/python3.11/site-packages/qubesadmin/devices.py m which looks like it MIGHT be something another python script can pull in to get information on all of the devices that exist. However, it seems to want to operate on an individual vm basis (and so I’d need to call it once for dom0 and once for sys-usb). The problem is this takes a VM object…and I can’t figure out where that comes from! Evidently, I’d have to import something else, declare an object, look up dom0 (or alternatively, loop through all vms) and then sys_usb, and pass those objects to DeviceManager in the hopes I can get a list out of it.
Part of my difficulty here is I am in the middle of a setup I don’t know, so my question might be incoherent to someone who actually does understand the system.