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

Clean-up suggestions from price. Whitespace fixes.

Location:
trunk/packages/invirt-remote/host/usr/sbin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.