From 3111b99c5a21d6d40540b261aacb2f8ba38ba150 Mon Sep 17 00:00:00 2001
From: Thomas Goirand <thomas@goirand.fr>
Date: Sun, 7 Apr 2013 02:24:33 +0800
Subject: [PATCH] * Added missing cinder-backup binary package. * reduced
 differences with Ubuntu. * fixed watch file to use the github tag. * added
 missing (new) binaries in cinder-volume. * Fixed double-declaration of
 (build-)dependencies. * Reordered dependencies by alph order. * Fixed
 Sources: field.

Rewritten-From: 299810316717e8e9329936fc06a29b73abbd0569
---
 xenial/debian/cinder-backup.init       | 115 +++++++++++++++++++++++++
 xenial/debian/cinder-backup.install    |   1 +
 xenial/debian/cinder-backup.logrotate  |   7 ++
 xenial/debian/cinder-backup.upstart.in |  18 ++++
 xenial/debian/cinder-common.install    |   1 -
 xenial/debian/cinder-volume.install    |   3 +
 xenial/debian/cinder.conf              |   2 +-
 xenial/debian/control                  |  49 ++++++++---
 xenial/debian/copyright                |   2 +-
 xenial/debian/rules                    |   4 +-
 xenial/debian/watch                    |   3 +-
 11 files changed, 186 insertions(+), 19 deletions(-)
 create mode 100644 xenial/debian/cinder-backup.init
 create mode 100644 xenial/debian/cinder-backup.install
 create mode 100644 xenial/debian/cinder-backup.logrotate
 create mode 100644 xenial/debian/cinder-backup.upstart.in

diff --git a/xenial/debian/cinder-backup.init b/xenial/debian/cinder-backup.init
new file mode 100644
index 000000000..30e777496
--- /dev/null
+++ b/xenial/debian/cinder-backup.init
@@ -0,0 +1,115 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          cinder-backup
+# Required-Start:    $network $local_fs $remote_fs $syslog
+# Required-Stop:     $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Cinder Backup
+# Description:       Provides Cinder Backup
+### END INIT INFO
+
+# Author: Thomas Goirand <zigo@debian.org>
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+DESC="OpenStack Cinder Backup"
+NAME=cinder-backup
+DAEMON=/usr/bin/cinder-backup
+DAEMON_ARGS="--config-file=/etc/cinder/cinder.conf"
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+CINDER_USER=cinder
+LOCK_DIR=/var/lock/cinder/
+DEFAULTS_FILE=/etc/default/cinder-common
+
+# Exit if the package is not installed
+[ -x $DAEMON ] || exit 0
+
+mkdir -p ${LOCK_DIR}
+chown ${CINDER_USER} ${LOCK_DIR}
+
+. /lib/lsb/init-functions
+
+# Read configuration variable file if it is present
+if [ -s $DEFAULTS_FILE ]; then
+    . $DEFAULTS_FILE
+    case "x$CINDER_ENABLE" in
+        xtrue|xfalse)   ;;
+        *)              log_failure_msg "Value of CINDER_ENABLE in $DEFAULTS_FILE must be either 'true' or 'false';"
+                        log_failure_msg "not starting $NAME daemon."
+                        exit 1
+                        ;;
+    esac
+fi
+
+
+do_start()
+{
+	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON --test > /dev/null \
+		|| return 1
+	start-stop-daemon --start --quiet --background --chuid ${CINDER_USER}:cinder --make-pidfile --pidfile $PIDFILE --startas $DAEMON -- \
+		$DAEMON_ARGS \
+		|| return 2
+}
+
+do_stop()
+{
+	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE
+	RETVAL="$?"
+	rm -f $PIDFILE
+	return "$RETVAL"
+}
+
+case "$1" in
+  start)
+        if "$CINDER_ENABLE"; then
+            log_daemon_msg "Starting $DESC" "$NAME"
+            do_start
+            case "$?" in
+                0|1) log_end_msg 0 ;;
+                2) log_end_msg 1 ;;
+            esac
+        else
+            log_warning_msg "cinder daemons not enabled in $DEFAULTS_FILE, not starting..."
+        fi
+        ;;
+  stop)
+	log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) log_end_msg 0 ;;
+		2) log_end_msg 1 ;;
+	esac
+	;;
+  status)
+       status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
+       ;;
+  restart|force-reload)
+        if "$CINDER_ENABLE"; then
+            log_daemon_msg "Restarting $DESC" "$NAME"
+            do_stop
+            case "$?" in
+                0|1)
+                    do_start
+                    case "$?" in
+                        0) log_end_msg 0 ;;
+                        1) log_end_msg 1 ;; # Old process is still running
+                        *) log_end_msg 1 ;; # Failed to start
+                    esac
+                    ;;
+                *)
+                # Failed to stop
+                    log_end_msg 1
+                    ;;
+            esac
+        else
+            log_warning_msg "cinder daemons not enabled in $DEFAULTS_FILE, not starting..."
+        fi
+        ;;
+
+  *)
+	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
+	exit 3
+	;;
+esac
diff --git a/xenial/debian/cinder-backup.install b/xenial/debian/cinder-backup.install
new file mode 100644
index 000000000..b362ab5c5
--- /dev/null
+++ b/xenial/debian/cinder-backup.install
@@ -0,0 +1 @@
+usr/bin/cinder-backup
diff --git a/xenial/debian/cinder-backup.logrotate b/xenial/debian/cinder-backup.logrotate
new file mode 100644
index 000000000..fd6419de8
--- /dev/null
+++ b/xenial/debian/cinder-backup.logrotate
@@ -0,0 +1,7 @@
+/var/log/cinder/cinder-backup.log {
+    daily
+    missingok
+    compress
+    delaycompress
+    notifempty
+}
diff --git a/xenial/debian/cinder-backup.upstart.in b/xenial/debian/cinder-backup.upstart.in
new file mode 100644
index 000000000..a95de6fe8
--- /dev/null
+++ b/xenial/debian/cinder-backup.upstart.in
@@ -0,0 +1,18 @@
+description "Cinder backup server"
+author "Chuck Short <zulcss@ubuntu.com>"
+
+start on runlevel [2345]
+stop on runlevel [!2345]
+
+chdir /var/run
+
+pre-start script
+    mkdir -p /var/run/cinder
+    chown cinder:cinder /var/run/cinder
+
+    mkdir -p /var/lock/cinder
+    chown cinder:root /var/lock/cinder
+end script
+
+exec start-stop-daemon --start --chuid cinder --exec /usr/bin/cinder-backup \
+     -- --config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-backup.log
diff --git a/xenial/debian/cinder-common.install b/xenial/debian/cinder-common.install
index c0e2f1028..9f5b95cef 100644
--- a/xenial/debian/cinder-common.install
+++ b/xenial/debian/cinder-common.install
@@ -3,6 +3,5 @@ usr/bin/cinder-rootwrap
 etc/cinder/policy.json			/etc/cinder
 debian/logging.conf 			/etc/cinder
 etc/cinder/rootwrap.conf		/etc/cinder
-etc/cinder/rootwrap.d/volume.filters	/etc/cinder/rootwrap.d
 debian/cinder.conf			/usr/share/cinder-common
 etc/cinder/api-paste.ini		/usr/share/cinder-common
diff --git a/xenial/debian/cinder-volume.install b/xenial/debian/cinder-volume.install
index 267af421f..d3bad5c4f 100644
--- a/xenial/debian/cinder-volume.install
+++ b/xenial/debian/cinder-volume.install
@@ -1,2 +1,5 @@
 usr/bin/cinder-volume
 debian/cinder_tgt.conf etc/tgt/conf.d
+etc/cinder/rootwrap.d/volume.filters    /etc/cinder/rootwrap.d
+usr/bin/cinder-volume-usage-audit
+usr/bin/cinder-clear-rabbit-queues
diff --git a/xenial/debian/cinder.conf b/xenial/debian/cinder.conf
index a116a7e20..d57e2be5b 100644
--- a/xenial/debian/cinder.conf
+++ b/xenial/debian/cinder.conf
@@ -1,6 +1,6 @@
 [DEFAULT]
 rootwrap_config = /etc/cinder/rootwrap.conf
-sql_connection = sqlite:////var/lib/cinder/cinder.sqlite
+sql_connection = sqlite:////var/lib/cinder/cinderdb
 api_paste_confg = /etc/cinder/api-paste.ini
 iscsi_helper = tgtadm
 volume_name_template = volume-%s
diff --git a/xenial/debian/control b/xenial/debian/control
index b6604704b..1b55d7b58 100644
--- a/xenial/debian/control
+++ b/xenial/debian/control
@@ -30,6 +30,7 @@ Build-Depends-Indep: pep8 (>= 1.3.3),
  python-lockfile,
  python-lxml,
  python-migrate,
+ python-mock,
  python-mox,
  python-mysqldb,
  python-netaddr,
@@ -49,10 +50,10 @@ Build-Depends-Indep: pep8 (>= 1.3.3),
  python-suds,
  python-swiftclient,
  python-webob (>= 1.2.3),
-Standards-Version: 3.9.3
-Homepage: http://cinder.openstack.org/
+Standards-Version: 3.9.4
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=openstack/cinder.git;a=summary
 Vcs-Git: git://anonscm.debian.org/openstack/cinder.git
+Homepage: http://cinder.openstack.org/
 
 Package: python-cinder
 Section: python
@@ -63,14 +64,14 @@ Depends: ${python:Depends},
  python-anyjson,
  python-argparse,
  python-babel,
- python-cheetah, 
- python-daemon,  
+ python-cheetah,
+ python-daemon,
  python-eventlet (>= 0.9.17),
  python-glanceclient (>= 1:0.5.0),
  python-greenlet,
  python-iso8601,
  python-keystoneclient (>= 1:0.2.0),
- python-kombu,  
+ python-kombu,
  python-lockfile,
  python-lxml,
  python-migrate,
@@ -80,13 +81,11 @@ Depends: ${python:Depends},
  python-paramiko,
  python-paste,
  python-pastedeploy,
- python-migrate,
- python-netaddr,
- python-rtslib,
  python-routes,
- python-suds,
+ python-rtslib,
  python-sqlalchemy,
  python-stevedore (>= 0.7),
+ python-suds,
  python-swiftclient,
  python-webob (>= 1.2.3),
  ${misc:Depends}
@@ -102,7 +101,13 @@ Description: Openstack block storage as a service - Python libraries
 Package: cinder-common
 Architecture: all
 Pre-Depends: dpkg (>= 1.15.6~)
-Depends: python-cinder (= ${binary:Version}), ${python:Depends}, ${misc:Depends}, adduser, debconf, dbconfig-common
+Depends:
+ adduser,
+ python-cinder (= ${binary:Version}),
+ debconf,
+ dbconfig-common,
+ ${misc:Depends},
+ ${python:Depends}
 Provides: ${python:Provides}
 Description: Openstack block storage as a service - common files
  Cinder is a block storage as service system for the Openstack cloud computing
@@ -130,8 +135,15 @@ Description: Openstack block storage as a service - API server
 Package: cinder-volume
 Architecture: all
 Pre-Depends: dpkg (>= 1.15.6~)
-Depends: ${ostack-lsb-base}, cinder-common (= ${binary:Version}), ${python:Depends}, ${misc:Depends},
- lvm2, tgt, adduser
+Depends:
+ adduser,
+ ${ostack-lsb-base},
+ cinder-common (= ${binary:Version}),
+ lvm2,
+ tgt,
+ ${misc:Depends},
+ ${python:Depends}
+Suggests: ceph-common
 Description: Openstack block storage as a service - Volume server
  Cinder is a block storage as service system for the Openstack cloud computing
  software suite. It is a direct replacement for nova-volume as a separate
@@ -153,3 +165,16 @@ Description: Openstack block storage as a service - Scheduler server
  running on Nova.
  .
  This package contains the Scheduler server.
+
+Package: cinder-backup
+Architecture: all
+Pre-Depends: dpkg (>= 1.15.6~)
+Depends: adduser, ${ostack-lsb-base}, cinder-common (= ${binary:Version}), ${misc:Depends}, ${python:Depends}
+Description: Openstack block storage as a service - Backup server
+ Cinder is a block storage as service system for the Openstack cloud computing
+ software suite. It is a direct replacement for nova-volume as a separate
+ project. Cinder users LVM partitions of your volume servers in order to
+ provide iSCSI permanent block storage devices for your virtual machines
+ running on Nova.
+ .
+ This package contains the Cinder backup service.
diff --git a/xenial/debian/copyright b/xenial/debian/copyright
index 4b57f0805..01bbb0ece 100644
--- a/xenial/debian/copyright
+++ b/xenial/debian/copyright
@@ -1,6 +1,6 @@
 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: cinder
-Source: https://code.launchpad.net/cinder
+Source: git://github.com/openstack/cinder.git
 
 Files: *
 Copyright: (c) 2010 United States Government as represented
diff --git a/xenial/debian/rules b/xenial/debian/rules
index 0f3d99f66..212b3b692 100755
--- a/xenial/debian/rules
+++ b/xenial/debian/rules
@@ -9,7 +9,7 @@ export OSLO_PACKAGE_VERSION=$(VERSION)
 
 ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
 override_dh_auto_test:
-	./run_tests.sh -N -P || true
+	PYTHONPATH=$(CURDIR) bash run_tests.sh -N -P || true
 endif
 
 override_dh_clean:
@@ -18,7 +18,7 @@ override_dh_clean:
 	rm -rf setuptools_git-*-py*.egg/
 
 override_dh_install:
-	dh_install
+	dh_install --fail-missing -Xbin/cinder-all
 	install -D -m 0440 debian/cinder-common.sudoers $(CURDIR)/debian/cinder-common/etc/sudoers.d/cinder-common
 
 override_dh_fixperms:
diff --git a/xenial/debian/watch b/xenial/debian/watch
index 2f1457415..fdb4071c8 100644
--- a/xenial/debian/watch
+++ b/xenial/debian/watch
@@ -1,3 +1,2 @@
 version=3
-opts="uversionmangle=s/%7E/~/" https://launchpad.net/cinder/+download https://launchpad.net/cinder/.*/.*/.*/cinder-(.*)\.tar\.gz
-http://tarballs.openstack.org/cinder/ cinder-(\d.*).tar.gz
+https://github.com/openstack/nova/tags .*/(\d[\d\.]+)\.tar\.gz
-- 
2.45.2