diff options
| author | Mihai Prica <prica.mihai@gmail.com> | 2013-07-25 17:02:46 +0300 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2013-08-28 18:41:59 -0400 |
| commit | ea62a12407366f890b1a83d439e15072f5f4734c (patch) | |
| tree | 3dd0bfc7bc1ebdfc808a3427181a4947eab77f61 | |
| parent | 46932003bb1e30ca0922262907b4f663cfd966f9 (diff) | |
| download | meta-cloud-services-ea62a12407366f890b1a83d439e15072f5f4734c.tar.gz | |
python-cinder: Update cinder-volume initscript and postinstall
Cinder-volume requires the cinder-volumes volume group created.
The backing file for this volume is created in the postinstall
with a size of 2G on the first boot and the volume group is
created at boot time in the cinder-volume initscript.
Signed-off-by: Mihai Prica <prica.mihai@gmail.com>
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-cinder/cinder-volume | 79 | ||||
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-cinder_2013.1.1.bb | 7 |
2 files changed, 84 insertions, 2 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume b/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume new file mode 100644 index 0000000..cdad401 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | ### BEGIN INIT INFO | ||
| 4 | # Provides: cinder-volume | ||
| 5 | # Required-Start: $remote_fs $syslog | ||
| 6 | # Required-Stop: $remote_fs $syslog | ||
| 7 | # Should-Start: postgresql rabbitmq-server | ||
| 8 | # Should-Stop: postgresql rabbitmq-server | ||
| 9 | # Default-Start: 3 5 | ||
| 10 | # Default-Stop: 0 1 2 6 | ||
| 11 | # Short-Description: OpenStack Block Storage (Cinder) - Volume | ||
| 12 | # Description: OpenStack Block Storage (Cinder) - Volume | ||
| 13 | ### END INIT INFO | ||
| 14 | |||
| 15 | DESC="cinder-volume" | ||
| 16 | DAEMON="/usr/bin/cinder-volume" | ||
| 17 | PIDFILE="/var/run/cinder-volume.pid" | ||
| 18 | |||
| 19 | start() | ||
| 20 | { | ||
| 21 | if [ -e $PIDFILE ]; then | ||
| 22 | PIDDIR=/proc/$(cat $PIDFILE) | ||
| 23 | if [ -d ${PIDDIR} ]; then | ||
| 24 | echo "$DESC already running." | ||
| 25 | exit 1 | ||
| 26 | else | ||
| 27 | echo "Removing stale PID file $PIDFILE" | ||
| 28 | rm -f $PIDFILE | ||
| 29 | fi | ||
| 30 | fi | ||
| 31 | |||
| 32 | #Load volume group | ||
| 33 | DEV=`losetup -f --show /etc/cinder/volumes-backing` | ||
| 34 | if ! vgs cinder-volumes &> /dev/null ; then | ||
| 35 | vgcreate cinder-volumes $DEV | ||
| 36 | fi | ||
| 37 | |||
| 38 | echo -n "Starting $DESC..." | ||
| 39 | |||
| 40 | start-stop-daemon --start --quiet --background \ | ||
| 41 | --pidfile ${PIDFILE} --make-pidfile --exec ${DAEMON} | ||
| 42 | |||
| 43 | if [ $? -eq 0 ]; then | ||
| 44 | echo "done." | ||
| 45 | else | ||
| 46 | echo "failed." | ||
| 47 | fi | ||
| 48 | } | ||
| 49 | |||
| 50 | stop() | ||
| 51 | { | ||
| 52 | echo -n "Stopping $DESC..." | ||
| 53 | start-stop-daemon --stop --quiet --pidfile $PIDFILE | ||
| 54 | if [ $? -eq 0 ]; then | ||
| 55 | echo "done." | ||
| 56 | else | ||
| 57 | echo "failed." | ||
| 58 | fi | ||
| 59 | rm -f $PIDFILE | ||
| 60 | } | ||
| 61 | |||
| 62 | case "$1" in | ||
| 63 | start) | ||
| 64 | start | ||
| 65 | ;; | ||
| 66 | stop) | ||
| 67 | stop | ||
| 68 | ;; | ||
| 69 | restart|force-reload) | ||
| 70 | stop | ||
| 71 | start | ||
| 72 | ;; | ||
| 73 | *) | ||
| 74 | echo "Usage: $0 {start|stop|force-reload|restart}" | ||
| 75 | exit 1 | ||
| 76 | ;; | ||
| 77 | esac | ||
| 78 | |||
| 79 | exit 0 | ||
diff --git a/meta-openstack/recipes-devtools/python/python-cinder_2013.1.1.bb b/meta-openstack/recipes-devtools/python/python-cinder_2013.1.1.bb index 95fa45b..83d583d 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder_2013.1.1.bb +++ b/meta-openstack/recipes-devtools/python/python-cinder_2013.1.1.bb | |||
| @@ -10,6 +10,7 @@ SRCNAME = "cinder" | |||
| 10 | SRC_URI = "https://launchpad.net/${SRCNAME}/grizzly/${PV}/+download/${SRCNAME}-${PV}.tar.gz \ | 10 | SRC_URI = "https://launchpad.net/${SRCNAME}/grizzly/${PV}/+download/${SRCNAME}-${PV}.tar.gz \ |
| 11 | file://cinder.conf \ | 11 | file://cinder.conf \ |
| 12 | file://cinder.init \ | 12 | file://cinder.init \ |
| 13 | file://cinder-volume \ | ||
| 13 | " | 14 | " |
| 14 | 15 | ||
| 15 | SRC_URI[md5sum] = "8fbfbd8aad5f1a6d5e2a239b7801966d" | 16 | SRC_URI[md5sum] = "8fbfbd8aad5f1a6d5e2a239b7801966d" |
| @@ -41,8 +42,7 @@ do_install_append() { | |||
| 41 | install -d ${D}${sysconfdir}/init.d | 42 | install -d ${D}${sysconfdir}/init.d |
| 42 | sed 's:@suffix@:api:' < ${WORKDIR}/cinder.init >${WORKDIR}/cinder-api.init.sh | 43 | sed 's:@suffix@:api:' < ${WORKDIR}/cinder.init >${WORKDIR}/cinder-api.init.sh |
| 43 | install -m 0755 ${WORKDIR}/cinder-api.init.sh ${D}${sysconfdir}/init.d/cinder-api | 44 | install -m 0755 ${WORKDIR}/cinder-api.init.sh ${D}${sysconfdir}/init.d/cinder-api |
| 44 | sed 's:@suffix@:volume:' < ${WORKDIR}/cinder.init >${WORKDIR}/cinder-volume.init.sh | 45 | install -m 0755 ${WORKDIR}/cinder-volume ${D}${sysconfdir}/init.d/cinder-volume |
| 45 | install -m 0755 ${WORKDIR}/cinder-volume.init.sh ${D}${sysconfdir}/init.d/cinder-volume | ||
| 46 | fi | 46 | fi |
| 47 | } | 47 | } |
| 48 | 48 | ||
| @@ -61,6 +61,9 @@ pkg_postinst_${SRCNAME} () { | |||
| 61 | 61 | ||
| 62 | sudo -u postgres createdb cinder | 62 | sudo -u postgres createdb cinder |
| 63 | cinder-manage db sync | 63 | cinder-manage db sync |
| 64 | |||
| 65 | #Create cinder volume group backing file | ||
| 66 | [[ -f /etc/cinder/volumes-backing ]] || truncate -s 2G /etc/cinder/volumes-backing | ||
| 64 | echo "include /etc/cinder/data/volumes/*" >> /etc/tgt/targets.conf | 67 | echo "include /etc/cinder/data/volumes/*" >> /etc/tgt/targets.conf |
| 65 | } | 68 | } |
| 66 | 69 | ||
