source: package_tags/sipb-xen-database/6/sipb-xen-database/client/usr/bin/sipb-xen-lvcreate

Last change on this file was 102, checked in by nelhage, 17 years ago

v6, with a script to autocreate any new logical volumes

  • Property svn:executable set to *
File size: 609 bytes
Line 
1#!/usr/bin/env python
2
3from sipb_xen_database import *
4import sys
5import os.path
6from subprocess import call
7
8connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
9
10vg = "xenvg"
11for d in Disk.select():
12    machine = Machine.get(d.machine_id)
13    lvname = machine.name + "_" + d.guest_device_name
14    if not os.path.exists("/dev/%s/%s" % (vg, lvname)):
15        # LV doesn't exist
16        print >>sys.stderr, "Creating LV %s..." % (lvname,)
17        rv = call(["lvcreate", "-L", str(d.size) + "M", "-n", lvname, vg])
18        if rv != 0:
19            print >>sys.stderr, "Error creating LV %s\n" %(lvname,)
Note: See TracBrowser for help on using the repository browser.