Changeset 175 for trunk/packages


Ignore:
Timestamp:
Oct 10, 2007, 1:50:54 AM (17 years ago)
Author:
ecprice
Message:

Fix errors on lvresize to equal or smaller value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/usr/sbin/sipb-xen-lvm

    r174 r175  
    33import sys
    44import os.path
    5 from subprocess import call, PIPE
     5from subprocess import call, PIPE, Popen
    66
    77def check(b):
     
    1616def ensureoff(machine):
    1717    # Make sure the machine is off, but we don't care about errors if it is already off.
    18     rv = call(["/usr/sbin/xm", "destroy", prefix + machine], stderr=PIPE)
     18    rv = call(["/usr/sbin/xm", "destroy", prefix + machine],
     19              stderr=PIPE)
    1920
    2021if subcommand == "lvcreate-all":
     
    4849    size = sys.argv[4]
    4950    ensureoff(machine)
    50     rv = call(["/sbin/lvresize", "-L", size + "M", lvpath])
    51     if rv != 0:
    52         print >>sys.stderr, "Error resizing LV %s\n" %(lvname,)
     51    p = Popen(["/sbin/lvresize", "-L", size + "M", lvpath],
     52              stdin=PIPE, stderr=PIPE)
     53    print >> p.stdin, 'y'
     54    err = p.stderr.read()
     55    if p.wait() != 0 and 'matches existing size' not in err:
     56        print >> sys.stderr, "Error resizing LV %s:\n" %(lvname,)
     57        print >> sys.stderr, err
    5358        sys.exit(1)
     59    print >> sys.stderr, err
    5460elif subcommand == "lvrename":
    5561    newmachine = sys.argv[4]
Note: See TracChangeset for help on using the changeset viewer.