From 3aabefce360f04ad551f7f839624c32e844f3e86 Mon Sep 17 00:00:00 2001 From: Nelson Elhage Date: Sat, 22 Sep 2007 14:00:10 -0400 Subject: [PATCH] v6, with a script to autocreate any new logical volumes svn path=/trunk/packages/sipb-xen-database/sipb-xen-database/; revision=102 --- client/usr/bin/sipb-xen-lvcreate | 19 +++++++++++++++++++ debian/changelog | 6 ++++++ 2 files changed, 25 insertions(+) create mode 100755 client/usr/bin/sipb-xen-lvcreate diff --git a/client/usr/bin/sipb-xen-lvcreate b/client/usr/bin/sipb-xen-lvcreate new file mode 100755 index 0000000..25c5942 --- /dev/null +++ b/client/usr/bin/sipb-xen-lvcreate @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +from sipb_xen_database import * +import sys +import os.path +from subprocess import call + +connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen') + +vg = "xenvg" +for d in Disk.select(): + machine = Machine.get(d.machine_id) + lvname = machine.name + "_" + d.guest_device_name + if not os.path.exists("/dev/%s/%s" % (vg, lvname)): + # LV doesn't exist + print >>sys.stderr, "Creating LV %s..." % (lvname,) + rv = call(["lvcreate", "-L", str(d.size) + "M", "-n", lvname, vg]) + if rv != 0: + print >>sys.stderr, "Error creating LV %s\n" %(lvname,) diff --git a/debian/changelog b/debian/changelog index 4109170..0040868 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sipb-xen-database (6) unstable; urgency=low + + * Adding a script to create lvm volumes + + -- Nelson Elhage Sat, 22 Sep 2007 13:59:36 -0400 + sipb-xen-database (5) unstable; urgency=low * Change the host from sipb-vm-1 to sipb-xen-dev -- 1.7.9.5