Sunday, June 26, 2011

one-liner to get useful info on OpenNebula VMs

I've been playing with OpenNebula. I've got a few dozen VMs which are being provided with context dynamically. It would be handy to list all the machines MAC and IP addresses, along with their names. For this purpose, I use the following one-liner:

 for ID in `sqlite3 /var/lib/one/one.db 'select oid from vm_pool where state = 3 order by name;'` ; do onevm show $ID | grep "NAME\|IP\|MAC" | grep -v VIRTUAL | grep -v ' : ' | sed 's/REQUIREMENTS=/  /'; done