X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-remote.git/blobdiff_plain/ccdd1009d00397d0f81fa9a95aa96faf448b9e94..b250c7823eb3f186d2632047d7857f0e7d9dc52b:/host/usr/sbin/invirt-listvms diff --git a/host/usr/sbin/invirt-listvms b/host/usr/sbin/invirt-listvms index 890931a..0f9d5dc 100755 --- a/host/usr/sbin/invirt-listvms +++ b/host/usr/sbin/invirt-listvms @@ -17,7 +17,7 @@ def live_vms(): name, data = get_dom(int(domid)) except (xs.Error, TypeError): continue # went down since we started - if name.startswith('d_'): + if name is not None and name.startswith('d_'): name = name[2:] vms[name] = data return vms @@ -32,6 +32,12 @@ def get_dom(domid): data['vm'] = xsc.read('', '/local/domain/%d/vm' % domid) data['start_time'] = float(xsc.read('', '%s/start_time' % data['vm'])) data['uptime'] = time.time()-data['start_time'] + # CD, if there is one + vbds = xsc.ls('', '/local/domain/%d/device/vbd' % domid) + for vbd in vbds: + dev = '/local/domain/%d/device/vbd/%s' % (domid, vbd) + if xsc.read('', '%s/device-type' % dev) == 'cdrom': + data['cdrom'] = xsc.read('', '%s/params' % xsc.read('', '%s/backend' % dev)) return name, data