- Timestamp:
- Feb 12, 2009, 11:26:48 PM (16 years ago)
- Location:
- trunk/packages/invirt-remote
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-remote/debian/changelog
r2106 r2107 2 2 3 3 * added remctl web availability to calculate memory available to new VMs 4 5 -- Peter A. Iannucci <iannucci@mit.edu> Thu, 12 Feb 2009 23:10:31 -0500 4 * removed remctl web info 5 6 -- Peter A. Iannucci <iannucci@mit.edu> Thu, 12 Feb 2009 23:26:24 -0500 6 7 7 8 invirt-remote (0.3.2) unstable; urgency=low -
trunk/packages/invirt-remote/host/usr/sbin/invirt-availability
r2104 r2107 14 14 15 15 def main(argv): 16 """ 17 Calculate the amount of memory available for new VMs 18 The numbers returned by xm info and xm info -c are in MB 19 The numbers in /proc/xen/balloon have nice units 20 All math is done in kilobytes for consistency 21 Output is in MB 22 """ 16 23 p = Popen(['/usr/sbin/xm', 'info'], stdout=PIPE) 17 24 output = p.communicate()[0] 18 25 if p.returncode != 0: 19 26 raise RuntimeError("Command '%s' returned non-zero exit status %d" 20 % (' invirt-availability', p.returncode))27 % ('/usr/sbin/xm info', p.returncode)) 21 28 xminfo = yaml.load(output, yaml.CSafeLoader) 22 29 23 # In kilobytes24 30 free_memory = int(xminfo['free_memory']) * 1024 25 31 26 f = open('/proc/xen/balloon', 'r') 27 ballooninfo = yaml.load(f.read()) 28 f.close() 32 ballooninfo = yaml.load(open('/proc/xen/balloon', 'r').read()) 29 33 currentallocation = parseUnits(ballooninfo['Current allocation']) 30 34 minimumtarget = parseUnits(ballooninfo['Minimum target']) … … 34 38 if p.returncode != 0: 35 39 raise RuntimeError("Command '%s' returned non-zero exit status %d" 36 % (' invirt-availability', p.returncode))40 % ('/usr/sbin/xm info -c', p.returncode)) 37 41 xminfoc = yaml.load(output, yaml.CSafeLoader) 38 42 -
trunk/packages/invirt-remote/host/usr/sbin/invirt-remote
r2104 r2107 12 12 # $SERVICE is hostname 13 13 COMMAND=/usr/sbin/invirt-vmcontrol 14 14 ;; 15 15 web) 16 16 case "$SERVICE" in 17 17 lvcreate|lvremove|lvrename|lvresize) 18 18 COMMAND=/usr/sbin/invirt-lvm 19 19 ;; 20 20 listvms) 21 21 COMMAND=/usr/sbin/invirt-listvms 22 ;;23 info)24 COMMAND=/usr/sbin/xm25 22 ;; 26 23 availability) … … 35 32 ;; 36 33 esac 37 34 ;; 38 35 *) 39 36 echo "ERROR: invalid command"
Note: See TracChangeset
for help on using the changeset viewer.