Changeset 2107 for trunk/packages


Ignore:
Timestamp:
Feb 12, 2009, 11:26:48 PM (15 years ago)
Author:
iannucci
Message:

Clean-up suggestions from price. Whitespace fixes.

Location:
trunk/packages/invirt-remote
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-remote/debian/changelog

    r2106 r2107  
    22
    33  * 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
    67
    78invirt-remote (0.3.2) unstable; urgency=low
  • trunk/packages/invirt-remote/host/usr/sbin/invirt-availability

    r2104 r2107  
    1414
    1515def 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    """
    1623    p = Popen(['/usr/sbin/xm', 'info'], stdout=PIPE)
    1724    output = p.communicate()[0]
    1825    if p.returncode != 0:
    1926        raise RuntimeError("Command '%s' returned non-zero exit status %d"
    20                            % ('invirt-availability', p.returncode))
     27                           % ('/usr/sbin/xm info', p.returncode))
    2128    xminfo = yaml.load(output, yaml.CSafeLoader)
    2229
    23     # In kilobytes
    2430    free_memory = int(xminfo['free_memory']) * 1024
    2531
    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())
    2933    currentallocation = parseUnits(ballooninfo['Current allocation'])
    3034    minimumtarget = parseUnits(ballooninfo['Minimum target'])
     
    3438    if p.returncode != 0:
    3539        raise RuntimeError("Command '%s' returned non-zero exit status %d"
    36                            % ('invirt-availability', p.returncode))
     40                           % ('/usr/sbin/xm info -c', p.returncode))
    3741    xminfoc = yaml.load(output, yaml.CSafeLoader)
    3842
  • trunk/packages/invirt-remote/host/usr/sbin/invirt-remote

    r2104 r2107  
    1212        # $SERVICE is hostname
    1313        COMMAND=/usr/sbin/invirt-vmcontrol
    14         ;;
     14    ;;
    1515    web)
    1616        case "$SERVICE" in
    1717            lvcreate|lvremove|lvrename|lvresize)
    1818                COMMAND=/usr/sbin/invirt-lvm
    19                 ;;
     19            ;;
    2020            listvms)
    2121                COMMAND=/usr/sbin/invirt-listvms
    22                 ;;
    23                 info)
    24                 COMMAND=/usr/sbin/xm
    2522            ;;
    2623            availability)
     
    3532                ;;
    3633        esac
    37         ;;
     34    ;;
    3835    *)
    3936        echo "ERROR: invalid command"
Note: See TracChangeset for help on using the changeset viewer.