You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2016/08/26 18:19:57 UTC

[1/4] git commit: updated refs/heads/master to 38259a9

Repository: cloudstack
Updated Branches:
  refs/heads/master 314970505 -> 38259a9a8


CLOUDSTACK-9462: Systemd support for Ubuntu 16.04

- systemd: Add a /etc/sysconfig/cloudstack-* file

  This allows users to easily override variables passed to Java when
  starting up.

  It also creates a foundation for sharing the systemd service profile
  between CentOS and Ubuntu since it only requires the environment file
  to be changed.

- deb: Add Ubuntu 16.04 support

  Ubuntu 16.04 differs from Ubuntu 14.04 in a few ways:
  - systemd instead of sysvinit / upstart
  - Java 8 support

  The packaging now detects on which distribution it is being
  build and based on that it installs different files in the
  packages, but it also changes the Dependencies.

  Packages for Ubuntu 16.04 will require Java 8 as a JRE

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/142772d5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/142772d5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/142772d5

Branch: refs/heads/master
Commit: 142772d524faf7e418eec43b2232633f21d773eb
Parents: d6e9045
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Thu Apr 28 20:59:30 2016 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Thu Aug 25 14:18:51 2016 +0530

----------------------------------------------------------------------
 debian/cloudstack-agent.dirs                 |   1 +
 debian/cloudstack-agent.install              |   2 +-
 debian/cloudstack-usage.dirs                 |   1 +
 debian/cloudstack-usage.install              |   2 +-
 debian/control                               |   6 +-
 debian/rules                                 |  31 +++-
 packaging/README.md                          |  39 +++++
 packaging/build-deb.sh                       |  53 +++++++
 packaging/centos7/cloud.spec                 |   4 +
 packaging/debian/cloudstack-agent.default    |  21 +++
 packaging/debian/cloudstack-agent.init       | 170 ++++++++++++++++++++++
 packaging/debian/cloudstack-agent.service    |  35 +++++
 packaging/debian/cloudstack-usage.default    |  21 +++
 packaging/debian/cloudstack-usage.init       | 154 ++++++++++++++++++++
 packaging/debian/cloudstack-usage.service    |  35 +++++
 packaging/debian/init/cloud-agent            | 170 ----------------------
 packaging/debian/init/cloud-usage            | 154 --------------------
 packaging/systemd/cloudstack-agent.service   |   5 +-
 packaging/systemd/cloudstack-agent.sysconfig |  21 +++
 packaging/systemd/cloudstack-usage.service   |   6 +-
 packaging/systemd/cloudstack-usage.sysconfig |  22 +++
 21 files changed, 610 insertions(+), 343 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/debian/cloudstack-agent.dirs
----------------------------------------------------------------------
diff --git a/debian/cloudstack-agent.dirs b/debian/cloudstack-agent.dirs
new file mode 100644
index 0000000..96c8719
--- /dev/null
+++ b/debian/cloudstack-agent.dirs
@@ -0,0 +1 @@
+/var/log/cloudstack/agent

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/debian/cloudstack-agent.install
----------------------------------------------------------------------
diff --git a/debian/cloudstack-agent.install b/debian/cloudstack-agent.install
index 82fce9f..184d922 100644
--- a/debian/cloudstack-agent.install
+++ b/debian/cloudstack-agent.install
@@ -18,12 +18,12 @@
 /etc/cloudstack/agent/agent.properties
 /etc/cloudstack/agent/environment.properties
 /etc/cloudstack/agent/log4j-cloud.xml
+/etc/default/cloudstack-agent
 /etc/profile.d/cloudstack-agent-profile.sh
 /etc/logrotate.d/cloudstack-agent
 /etc/init.d/cloudstack-agent
 /usr/bin/cloudstack-setup-agent
 /usr/bin/cloudstack-ssh
 /usr/bin/cloudstack-agent-upgrade
-/var/log/cloudstack/agent
 /usr/share/cloudstack-agent/lib/*
 /usr/share/cloudstack-agent/plugins

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/debian/cloudstack-usage.dirs
----------------------------------------------------------------------
diff --git a/debian/cloudstack-usage.dirs b/debian/cloudstack-usage.dirs
new file mode 100644
index 0000000..3f64b79
--- /dev/null
+++ b/debian/cloudstack-usage.dirs
@@ -0,0 +1 @@
+/var/log/cloudstack/usage

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/debian/cloudstack-usage.install
----------------------------------------------------------------------
diff --git a/debian/cloudstack-usage.install b/debian/cloudstack-usage.install
index 4722e68..c0cc95a 100644
--- a/debian/cloudstack-usage.install
+++ b/debian/cloudstack-usage.install
@@ -18,5 +18,5 @@
 /usr/share/cloudstack-usage/lib/*
 /usr/share/cloudstack-usage/plugins
 /etc/init.d/cloudstack-usage
-/var/log/cloudstack/usage
 /etc/cloudstack/usage/*
+/etc/default/cloudstack-usage

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/debian/control
----------------------------------------------------------------------
diff --git a/debian/control b/debian/control
index 0cf7a11..d7c7928 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: libs
 Priority: extra
 Maintainer: Wido den Hollander <wi...@widodh.nl>
 Build-Depends: debhelper (>= 9), openjdk-8-jdk | openjdk-7-jdk, genisoimage,
- python-mysql.connector, maven (>= 3) | maven3, python (>= 2.7)
+ python-mysql.connector, maven (>= 3) | maven3, python (>= 2.7), lsb-release, dh-systemd
 Standards-Version: 3.8.1
 Homepage: http://www.cloudstack.org/
 
@@ -22,7 +22,7 @@ Description: CloudStack server library
 
 Package: cloudstack-agent
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, openjdk-8-jre-headless | openjdk-7-jre-headless, cloudstack-common (= ${source:Version}), lsb-base (>= 4.0), libcommons-daemon-java, openssh-client, qemu-kvm (>= 1.0), libvirt-bin (>= 0.9.8), uuid-runtime, iproute, ebtables, vlan, jsvc, ipset, python-libvirt, ethtool, iptables, lsb-release
+Depends: ${misc:Depends}, ${python:Depends}, ${jre:Depends}, cloudstack-common (= ${source:Version}), lsb-base (>= 4.0), libcommons-daemon-java, openssh-client, qemu-kvm (>= 1.0), libvirt-bin (>= 0.9.8), uuid-runtime, iproute, ebtables, vlan, ${init:Depends}, ipset, python-libvirt, ethtool, iptables, lsb-release
 Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
 Description: CloudStack agent
  The CloudStack agent is in charge of managing shared computing resources in
@@ -31,7 +31,7 @@ Description: CloudStack agent
 
 Package: cloudstack-usage
 Architecture: all
-Depends: ${misc:Depends}, openjdk-8-jre-headless | openjdk-7-jre-headless, cloudstack-common (= ${source:Version}), jsvc, libmysql-java
+Depends: ${misc:Depends}, ${jre:Depends}, cloudstack-common (= ${source:Version}), jsvc, libmysql-java
 Description: CloudStack usage monitor
  The CloudStack usage monitor provides usage accounting across the entire cloud for
  cloud operators to charge based on usage parameters.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/debian/rules
----------------------------------------------------------------------
diff --git a/debian/rules b/debian/rules
index f996699..32216ff 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,8 +5,17 @@ PACKAGE = $(shell dh_listpackages|head -n 1|cut -d '-' -f 1)
 SYSCONFDIR = "/etc"
 DESTDIR = "debian/tmp"
 
+ifeq ($(shell lsb_release -sr), 14.04)
+        SUBSTVARS = -Vjre:Depends="openjdk-7-jre-headless" -Vjdk:Depends="openjdk-7-jdk" -Vinit:"Depends:jsvc"
+else
+        SUBSTVARS = -Vjre:Depends="openjdk-8-jre-headless" -Vjdk:Depends="openjdk-8-jdk" -Vinit:"Depends:systemd"
+endif
+
 %:
-	dh $@ --with python2
+	dh $@ --with python2,systemd
+
+override_dh_gencontrol:
+	dh_gencontrol -- $(SUBSTVARS)
 
 override_dh_auto_configure:
 	cp packaging/debian/replace.properties replace.properties.tmp
@@ -26,6 +35,8 @@ override_dh_auto_install:
 	# Common packages
 	mkdir -p $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)
 	mkdir -p $(DESTDIR)/$(SYSCONFDIR)/init.d
+	mkdir -p $(DESTDIR)/$(SYSCONFDIR)/default
+
 	mkdir -p $(DESTDIR)/var/cache/$(PACKAGE)
 	mkdir -p $(DESTDIR)/var/log/$(PACKAGE)
 	mkdir -p $(DESTDIR)/var/lib/$(PACKAGE)
@@ -35,13 +46,17 @@ override_dh_auto_install:
 	# cloudstack-agent
 	mkdir $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/agent
 	mkdir $(DESTDIR)/$(SYSCONFDIR)/profile.d
-	mkdir $(DESTDIR)/var/log/$(PACKAGE)/agent
 	mkdir $(DESTDIR)/usr/share/$(PACKAGE)-agent
 	mkdir $(DESTDIR)/usr/share/$(PACKAGE)-agent/plugins
 	install -D agent/target/cloud-agent-$(VERSION).jar $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/$(PACKAGE)-agent.jar
 	install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-$(VERSION).jar $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
 	install -D plugins/hypervisors/kvm/target/dependencies/* $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
-	install -D packaging/debian/init/cloud-agent $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-agent
+
+	install -m0755 packaging/debian/$(PACKAGE)-agent.init $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-agent
+	install -d -m0755 debian/$(PACKAGE)-agent/lib/systemd/system
+	install -m0644 packaging/debian/$(PACKAGE)-agent.service debian/$(PACKAGE)-agent/lib/systemd/system/$(PACKAGE)-agent.service
+	install -m0644 packaging/debian/$(PACKAGE)-agent.default $(DESTDIR)/$(SYSCONFDIR)/default/$(PACKAGE)-agent
+
 	install -D agent/target/transformed/cloud-setup-agent $(DESTDIR)/usr/bin/cloudstack-setup-agent
 	install -D agent/target/transformed/cloud-ssh $(DESTDIR)/usr/bin/cloudstack-ssh
 	install -D agent/target/transformed/cloudstack-agent-profile.sh $(DESTDIR)/$(SYSCONFDIR)/profile.d/cloudstack-agent-profile.sh
@@ -116,14 +131,17 @@ override_dh_auto_install:
 
 	# cloudstack-usage
 	mkdir $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage
-	mkdir $(DESTDIR)/var/log/$(PACKAGE)/usage
 	mkdir $(DESTDIR)/usr/share/$(PACKAGE)-usage
 	mkdir $(DESTDIR)/usr/share/$(PACKAGE)-usage/plugins
 	install -D usage/target/cloud-usage-$(VERSION).jar $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/$(PACKAGE)-usage.jar
 	install -D usage/target/dependencies/* $(DESTDIR)/usr/share/$(PACKAGE)-usage/lib/
 	cp usage/target/transformed/db.properties $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/
 	cp usage/target/transformed/log4j-cloud_usage.xml $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/usage/log4j-cloud.xml
-	install -D packaging/debian/init/cloud-usage $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-usage
+
+	install -D -m0755 packaging/debian/$(PACKAGE)-usage.init $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-usage
+	install -d -m0755 debian/$(PACKAGE)-usage/lib/systemd/system
+	install -m0644 packaging/debian/$(PACKAGE)-usage.service debian/$(PACKAGE)-usage/lib/systemd/system/$(PACKAGE)-usage.service
+	install -m0644 packaging/debian/$(PACKAGE)-usage.default $(DESTDIR)/$(SYSCONFDIR)/default/$(PACKAGE)-usage
 
 	# cloudstack-marvin
 	mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-marvin
@@ -136,5 +154,8 @@ override_dh_auto_install:
 override_dh_installinit:
 	dh_installinit -pcloudstack-management -pcloudstack-agent -pcloudstack-usage --onlyscripts --no-start
 
+override_dh_systemd_enable:
+	dh_systemd_enable -pcloudstack-agent -pcloudstack-usage
+
 override_dh_installdocs:
 	dh_installdocs -A tools/whisker/LICENSE tools/whisker/NOTICE INSTALL.md

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/README.md
----------------------------------------------------------------------
diff --git a/packaging/README.md b/packaging/README.md
new file mode 100644
index 0000000..abfd420
--- /dev/null
+++ b/packaging/README.md
@@ -0,0 +1,39 @@
+# CloudStack RPM and DEB packaging
+This directory contains all the required scripts and tools needed to build RPM and DEB packages for Apache CloudStack.
+
+These scripts are also used by the CloudStack team to build packages for the official release of CloudStack.
+
+# Requirements
+The RPM and DEB packages have dependencies on versions of specific libraries. Due to these dependencies the following distributions and their versions are supported by the packages.
+
+* CentOS / RHEL: 6 and 7
+* Debian 7 (Wheezy) and 8 (Jessy) (untested!)
+* Ubuntu: 14.04 (Trusty) and 16.04 (Xenial)
+
+# Building
+Using the scripts in the *packaging* directory the RPM and DEB packages can be build.
+
+## DEB
+If you simply want to build packages go to the root directory of your CloudStack source code and run:
+
+``dpkg-buildpackage``
+
+This will build packages for the current distribution version you are running. If you run this on a Ubuntu 16.04 system the packages will be tailored for Ubuntu 16.04 and will not install on Ubuntu 14.04.
+
+### Building cross-distribution
+If you want to build packages for a different distribution run the *build-deb.sh* script. This will build packages with the current distribution as a suffix to the package names. E.g. *cloudstack-agent_4.9.0~xenial_all.deb*
+
+Using a Docker image you can build packages for a distribution you are not running.
+
+The following commands assume that the CloudStack source is present in **/tmp/cloudstack** on the system you are running these commands on.
+
+``docker run -ti -v /tmp:/src ubuntu:16.04 /bin/bash -c "apt-get update && apt-get install -y dpkg-dev python debhelper openjdk-8-jdk genisoimage python-mysql.connector maven lsb-release devscripts && /src/cloudstack/packaging/build-deb.sh"``
+
+``docker run -ti -v /tmp:/src ubuntu:14.04 /bin/bash -c "apt-get update && apt-get install -y dpkg-dev python debhelper openjdk-7-jdk genisoimage python-mysql.connector maven lsb-release devscripts && /src/cloudstack/packaging/build-deb.sh"``
+
+The commands above will generate Ubuntu 14.04 and 16.04 packages which you will find in */tmp* on your system after the build succeeds.
+
+## RPM
+The *package.sh* script can be used to build RPM packages for CloudStack. In the *packaging* script you can run the following command:
+
+``./package.sh --pack oss --distribution centos7``

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/build-deb.sh
----------------------------------------------------------------------
diff --git a/packaging/build-deb.sh b/packaging/build-deb.sh
new file mode 100755
index 0000000..aa17dc5
--- /dev/null
+++ b/packaging/build-deb.sh
@@ -0,0 +1,53 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -e
+
+#
+# This script builds Debian packages for CloudStack and does
+# so by altering the debian/changelog file and add the Ubuntu
+# version as a suffix, for example: 4.9.0~xenial
+#
+# To build packages for Ubuntu 14.04 run this script on a
+# 14.04 system. The same goes for Ubuntu 16.04
+#
+# The biggest difference between those two versions is the
+# sysvinit vs systemd and Java 7 vs Java 8
+#
+# These packages can be build using Docker for example:
+#
+# Assume that the cloudstack source is present in /tmp/cloudstack
+#
+# Ubuntu 16.04
+# docker run -ti -v /tmp:/src ubuntu:16.04 /bin/bash -c "apt-get update && apt-get install -y dpkg-dev python debhelper openjdk-8-jdk genisoimage python-mysql.connector maven lsb-release devscripts && /src/cloudstack/packaging/build-deb.sh"
+#
+# Ubuntu 14.04
+# docker run -ti -v /tmp:/src ubuntu:14.04 /bin/bash -c "apt-get update && apt-get install -y dpkg-dev python debhelper openjdk-7-jdk genisoimage python-mysql.connector maven lsb-release devscripts && /src/cloudstack/packaging/build-deb.sh"
+#
+
+cd `dirname $0`
+cd ..
+
+dpkg-checkbuilddeps
+
+VERSION=$(grep '^  <version>' pom.xml| cut -d'>' -f2 |cut -d'<' -f1)
+DISTCODE=$(lsb_release -sc)
+
+dch -b -v "${VERSION}~${DISTCODE}" -u low -m "Apache CloudStack Release ${VERSION}"
+
+dpkg-buildpackage -j2 -b -uc -us

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/centos7/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec
index 658d8da..04315f8 100644
--- a/packaging/centos7/cloud.spec
+++ b/packaging/centos7/cloud.spec
@@ -309,6 +309,7 @@ mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/agent
 mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib
 mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/plugins
 install -D packaging/systemd/cloudstack-agent.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-agent.service
+install -D packaging/systemd/cloudstack-agent.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}-agent
 install -D agent/target/transformed/agent.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/agent.properties
 install -D agent/target/transformed/environment.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/environment.properties
 install -D agent/target/transformed/log4j-cloud.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/log4j-cloud.xml
@@ -329,6 +330,7 @@ install -D usage/target/transformed/db.properties ${RPM_BUILD_ROOT}%{_sysconfdir
 install -D usage/target/transformed/log4j-cloud_usage.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/usage/log4j-cloud.xml
 cp usage/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/lib/
 install -D packaging/systemd/cloudstack-usage.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-usage.service
+install -D packaging/systemd/cloudstack-usage.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}-usage
 mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/usage/
 
 # CLI
@@ -533,6 +535,7 @@ pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
 %attr(0755,root,root) %{_bindir}/%{name}-agent-upgrade
 %attr(0755,root,root) %{_bindir}/%{name}-ssh
 %attr(0644,root,root) %{_unitdir}/%{name}-agent.service
+%attr(0644,root,root) %{_sysconfdir}/sysconfig/%{name}-agent
 %attr(0644,root,root) %{_sysconfdir}/profile.d/%{name}-agent-profile.sh
 %attr(0644,root,root) %{_sysconfdir}/logrotate.d/%{name}-agent
 %attr(0755,root,root) %{_datadir}/%{name}-common/scripts/network/cisco
@@ -559,6 +562,7 @@ pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
 
 %files usage
 %attr(0644,root,root) %{_unitdir}/%{name}-usage.service
+%attr(0644,root,root) %{_sysconfdir}/sysconfig/%{name}-usage
 %attr(0644,root,root) %{_datadir}/%{name}-usage/*.jar
 %attr(0644,root,root) %{_datadir}/%{name}-usage/lib/*.jar
 %dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/usage

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/debian/cloudstack-agent.default
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-agent.default b/packaging/debian/cloudstack-agent.default
new file mode 100644
index 0000000..16a0306
--- /dev/null
+++ b/packaging/debian/cloudstack-agent.default
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
+JAVA_HEAP_INITIAL=256m
+JAVA_HEAP_MAX=2048m
+JAVA_CLASS=com.cloud.agent.AgentShell

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/debian/cloudstack-agent.init
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-agent.init b/packaging/debian/cloudstack-agent.init
new file mode 100755
index 0000000..a3f2ae9
--- /dev/null
+++ b/packaging/debian/cloudstack-agent.init
@@ -0,0 +1,170 @@
+#!/bin/bash
+
+### BEGIN INIT INFO
+# Provides:          cloudstack-agent
+# Required-Start:    $network $local_fs
+# Required-Stop:     $network $local_fs
+# Default-Start:     3 4 5
+# Default-Stop:      0 1 2 6
+# Short-Description: Start/stop Apache CloudStack Agent
+# Description: This scripts Starts/Stops the Apache CloudStack agent
+##  The CloudStack Agent is a part of the Apache CloudStack project and is used
+##  for managing KVM-based Hypervisors and performing secondary storage tasks inside
+##  the Secondary Storage System Virtual Machine.
+## JSVC (Java daemonizing) is used for starting and stopping the agent
+### END INIT INFO
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+. /lib/lsb/init-functions
+
+SHORTNAME="cloudstack-agent"
+PIDFILE=/var/run/"$SHORTNAME".pid
+LOCKFILE=/var/lock/subsys/"$SHORTNAME"
+PROGNAME="CloudStack Agent"
+CLASS="com.cloud.agent.AgentShell"
+PROG="jsvc"
+DAEMON="/usr/bin/jsvc"
+SHUTDOWN_WAIT="30"
+
+unset OPTIONS
+[ -r /etc/default/"$SHORTNAME" ] && source /etc/default/"$SHORTNAME"
+
+# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT)
+JDK_DIRS="/usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-7-openjdk-i386 /usr/lib/jvm/java-7-oracle /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-openjdk-i386 /usr/lib/jvm/java-6-openjdk-amd64 /usr/lib/jvm/java-6-sun"
+
+for jdir in $JDK_DIRS; do
+    if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
+        JAVA_HOME="$jdir"
+    fi
+done
+export JAVA_HOME
+
+ACP=`ls /usr/share/cloudstack-agent/lib/*.jar | tr '\n' ':' | sed s'/.$//'`
+PCP=`ls /usr/share/cloudstack-agent/plugins/*.jar 2>/dev/null | tr '\n' ':' | sed s'/.$//'`
+
+# We need to append the JSVC daemon JAR to the classpath
+# AgentShell implements the JSVC daemon methods
+export CLASSPATH="/usr/share/java/commons-daemon.jar:$ACP:$PCP:/etc/cloudstack/agent"
+
+wait_for_network() {
+    i=1
+    while [ $i -lt 10 ]
+    do
+        # Under Ubuntu and Debian libvirt by default creates a bridge called virbr0.
+        # That's why we want more then 3 lines back from brctl, so that there is a manually created bridge
+        if [ "$(brctl show|wc -l)" -gt 2 ]; then
+            break
+        else
+            sleep 1
+            let i=$i+1
+            continue
+        fi
+    done
+}
+
+start() {
+    if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
+        log_daemon_msg "$PROGNAME apparently already running"
+        log_end_msg 0
+        exit 0
+    fi
+
+    log_daemon_msg "Starting $PROGNAME" "$SHORTNAME"
+    if hostname --fqdn >/dev/null 2>&1 ; then
+        true
+    else
+        log_failure_msg "The host name does not resolve properly to an IP address. Cannot start $PROGNAME"
+        log_end_msg 1
+        exit 1
+    fi
+
+    wait_for_network
+
+    if start_daemon -p $PIDFILE $DAEMON -Xms256m -Xmx2048m -cp "$CLASSPATH" -Djna.nosys=true -pidfile "$PIDFILE" -errfile SYSLOG $CLASS
+        RETVAL=$?
+    then
+        rc=0
+        sleep 1
+        if ! kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
+            log_failure_msg "$PROG failed to start"
+            rc=1
+        fi
+    else
+        rc=1
+    fi
+
+    if [ $rc -eq 0 ]; then
+        log_end_msg 0
+    else
+        log_end_msg 1
+        rm -f "$PIDFILE"
+    fi
+}
+
+stop() {
+    count="0"
+
+    log_daemon_msg "Stopping $PROGNAME" "$SHORTNAME"
+    killproc -p $PIDFILE $DAEMON
+
+    until [ "$count" -gt "$SHUTDOWN_WAIT" ]
+    do
+        agentPid=$(ps aux|grep [j]svc|grep $SHORTNAME)
+        if [ "$?" -gt "0" ];then
+            break
+        fi
+        sleep 1
+        let count="${count}+1"
+    done
+
+    agentPid=$(ps aux|grep [j]svc|grep $SHORTNAME)
+    if [ "$?" -eq "0" ]; then
+        agentPid=$(ps aux|grep [j]svc|awk '{print $2}')
+        if [ "$agentPid" != "" ]; then
+            log_warning_msg "$PROG still running, forcing kill"
+            kill -9 $agentPid
+        fi
+    fi
+
+    log_end_msg $?
+    rm -f "$PIDFILE"
+}
+
+case "$1" in
+    start)
+        start
+        ;;
+    stop)
+        stop
+        ;;
+    status)
+        status_of_proc -p "$PIDFILE" "$PROG" "$SHORTNAME"
+        RETVAL=$?
+        ;;
+    restart | force-reload)
+        stop
+        sleep 3
+        start
+        ;;
+    *)
+    echo "Usage: $0 {start|stop|restart|force-reload|status}"
+    RETVAL=3
+esac
+
+exit $RETVAL

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/debian/cloudstack-agent.service
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-agent.service b/packaging/debian/cloudstack-agent.service
new file mode 100644
index 0000000..d3080c7
--- /dev/null
+++ b/packaging/debian/cloudstack-agent.service
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+[Unit]
+Description=CloudStack Agent
+Documentation=http://www.cloudstack.org/
+Requires=libvirt-bin.service
+After=libvirt-bin.service
+
+[Service]
+Type=simple
+EnvironmentFile=-/etc/default/cloudstack-agent
+ExecStart=/bin/sh -ec '\
+    export ACP=`ls /usr/share/cloudstack-agent/lib/*.jar /usr/share/cloudstack-agent/plugins/*.jar 2>/dev/null|tr "\\n" ":"`; \
+    export CLASSPATH="$ACP:/etc/cloudstack/agent:/usr/share/cloudstack-common/scripts"; \
+    ${JAVA_HOME}/bin/java -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
+Restart=always
+RestartSec=10s
+
+[Install]
+WantedBy=multi-user.target

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/debian/cloudstack-usage.default
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-usage.default b/packaging/debian/cloudstack-usage.default
new file mode 100644
index 0000000..1fa328c
--- /dev/null
+++ b/packaging/debian/cloudstack-usage.default
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
+JAVA_HEAP_INITIAL=256m
+JAVA_HEAP_MAX=2048m
+JAVA_CLASS=com.cloud.usage.UsageServer

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/debian/cloudstack-usage.init
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-usage.init b/packaging/debian/cloudstack-usage.init
new file mode 100755
index 0000000..e6129c2
--- /dev/null
+++ b/packaging/debian/cloudstack-usage.init
@@ -0,0 +1,154 @@
+#!/bin/bash
+
+### BEGIN INIT INFO
+# Provides:          cloudstack-usage
+# Required-Start:    $network $local_fs
+# Required-Stop:     $network $local_fs
+# Default-Start:     3 4 5
+# Default-Stop:      0 1 2 6
+# Short-Description: Start/stop Apache CloudStack Usage Monitor
+# Description: This scripts Starts/Stops the Apache CloudStack Usage Monitor
+##  The CloudStack Usage Monitor is a part of the Apache CloudStack project and is used
+##  for storing usage statistics from instances.
+## JSVC (Java daemonizing) is used for starting and stopping the usage monitor.
+### END INIT INFO
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+. /lib/lsb/init-functions
+
+SHORTNAME="cloudstack-usage"
+PIDFILE=/var/run/"$SHORTNAME".pid
+PROGNAME="CloudStack Usage Monitor"
+CLASS="com.cloud.usage.UsageServer"
+PROG="jsvc"
+DAEMON="/usr/bin/jsvc"
+
+unset OPTIONS
+[ -r /etc/default/"$SHORTNAME" ] && source /etc/default/"$SHORTNAME"
+
+setJavaHome() {
+  # use $JAVA_HOME if defined
+  if [ -n "$JAVA_HOME" ] ; then
+    return
+  fi
+
+  # try java first
+  java=$(which java 2>/dev/null || :)
+
+  # try javac if java is not found
+  if [ -z "$java" ] ; then
+    java=$(which javac 2>/dev/null || :)
+  fi
+
+  if [ -n "$java" ] ; then
+    JAVA_HOME=$(dirname $(dirname $(readlink -e $java)))
+    export JAVA_HOME
+    return
+  fi
+
+  # If everything has failed, try hardcoded paths
+  # The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT)
+  JDK_DIRS="/usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-7-openjdk-i386 /usr/lib/jvm/java-7-oracle /usr/lib/jvm/java-7-openjdk /usr/lib/jvm/java-7-sun"
+  for jdir in $JDK_DIRS; do
+    if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
+      JAVA_HOME="$jdir"
+      export JAVA_HOME
+      return
+    fi
+  done
+
+  # didnt find java home. exiting with error
+  exit 1
+}
+
+setJavaHome
+
+UCP=`ls /usr/share/cloudstack-usage/lib/*.jar | tr '\n' ':' | sed s'/.$//'`
+PCP=`ls /usr/share/cloudstack-usage/plugins/*.jar 2>/dev/null | tr '\n' ':' | sed s'/.$//'`
+
+# We need to append the JSVC daemon JAR to the classpath
+# AgentShell implements the JSVC daemon methods
+export CLASSPATH="/usr/share/java/commons-daemon.jar:/usr/share/java/mysql-connector-java.jar:$UCP:$PCP:/etc/cloudstack/usage"
+
+start() {
+    if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
+        log_daemon_msg "$PROGNAME apparently already running"
+        log_end_msg 0
+        exit 0
+    fi
+
+    log_daemon_msg "Starting $PROGNAME" "$SHORTNAME"
+    if hostname --fqdn >/dev/null 2>&1 ; then
+        true
+    else
+        log_failure_msg "The host name does not resolve properly to an IP address. Cannot start $PROGNAME"
+        log_end_msg 1
+        exit 1
+    fi
+
+    if start_daemon -p $PIDFILE $DAEMON -home "$JAVA_HOME" -cp "$CLASSPATH" -pidfile "$PIDFILE" -outfile SYSLOG -errfile SYSLOG -Dpid=$$ $CLASS
+        RETVAL=$?
+    then
+        rc=0
+        sleep 1
+        if ! kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
+            log_failure_msg "$PROG failed to start"
+            rc=1
+        fi
+    else
+        rc=1
+    fi
+
+    if [ $rc -eq 0 ]; then
+        log_end_msg 0
+    else
+        log_end_msg 1
+        rm -f "$PIDFILE"
+    fi
+}
+
+stop() {
+    log_daemon_msg "Stopping $PROGNAME" "$SHORTNAME"
+    killproc -p $PIDFILE $DAEMON
+    log_end_msg $?
+    rm -f "$PIDFILE"
+}
+
+case "$1" in
+    start)
+        start
+        ;;
+    stop)
+        stop
+        ;;
+    status)
+        status_of_proc -p "$PIDFILE" "$PROG" "$SHORTNAME"
+        RETVAL=$?
+        ;;
+    restart | force-reload)
+        stop
+        sleep 3
+        start
+        ;;
+    *)
+    echo "Usage: $0 {start|stop|restart|force-reload|status}"
+    RETVAL=3
+esac
+
+exit $RETVAL

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/debian/cloudstack-usage.service
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-usage.service b/packaging/debian/cloudstack-usage.service
new file mode 100644
index 0000000..c36224e
--- /dev/null
+++ b/packaging/debian/cloudstack-usage.service
@@ -0,0 +1,35 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+[Unit]
+Description=CloudStack Usage Server
+Documentation=http://www.cloudstack.org/
+Wants=network.target network-online.target
+After=network.target network-online.target
+
+[Service]
+Type=simple
+EnvironmentFile=-/etc/default/cloudstack-usage
+ExecStart=/bin/sh -ec '\
+    export UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar /usr/share/cloudstack-usage/lib/*.jar | tr "\\n" ":"`; \
+    export CLASSPATH="$UCP:/etc/cloudstack/usage:/usr/share/java/mysql-connector-java.jar"; \
+    ${JAVA_HOME}/bin/java -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
+Restart=always
+RestartSec=10s
+
+[Install]
+WantedBy=multi-user.target

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/debian/init/cloud-agent
----------------------------------------------------------------------
diff --git a/packaging/debian/init/cloud-agent b/packaging/debian/init/cloud-agent
deleted file mode 100755
index a3f2ae9..0000000
--- a/packaging/debian/init/cloud-agent
+++ /dev/null
@@ -1,170 +0,0 @@
-#!/bin/bash
-
-### BEGIN INIT INFO
-# Provides:          cloudstack-agent
-# Required-Start:    $network $local_fs
-# Required-Stop:     $network $local_fs
-# Default-Start:     3 4 5
-# Default-Stop:      0 1 2 6
-# Short-Description: Start/stop Apache CloudStack Agent
-# Description: This scripts Starts/Stops the Apache CloudStack agent
-##  The CloudStack Agent is a part of the Apache CloudStack project and is used
-##  for managing KVM-based Hypervisors and performing secondary storage tasks inside
-##  the Secondary Storage System Virtual Machine.
-## JSVC (Java daemonizing) is used for starting and stopping the agent
-### END INIT INFO
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. /lib/lsb/init-functions
-
-SHORTNAME="cloudstack-agent"
-PIDFILE=/var/run/"$SHORTNAME".pid
-LOCKFILE=/var/lock/subsys/"$SHORTNAME"
-PROGNAME="CloudStack Agent"
-CLASS="com.cloud.agent.AgentShell"
-PROG="jsvc"
-DAEMON="/usr/bin/jsvc"
-SHUTDOWN_WAIT="30"
-
-unset OPTIONS
-[ -r /etc/default/"$SHORTNAME" ] && source /etc/default/"$SHORTNAME"
-
-# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT)
-JDK_DIRS="/usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-7-openjdk-i386 /usr/lib/jvm/java-7-oracle /usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-openjdk-i386 /usr/lib/jvm/java-6-openjdk-amd64 /usr/lib/jvm/java-6-sun"
-
-for jdir in $JDK_DIRS; do
-    if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
-        JAVA_HOME="$jdir"
-    fi
-done
-export JAVA_HOME
-
-ACP=`ls /usr/share/cloudstack-agent/lib/*.jar | tr '\n' ':' | sed s'/.$//'`
-PCP=`ls /usr/share/cloudstack-agent/plugins/*.jar 2>/dev/null | tr '\n' ':' | sed s'/.$//'`
-
-# We need to append the JSVC daemon JAR to the classpath
-# AgentShell implements the JSVC daemon methods
-export CLASSPATH="/usr/share/java/commons-daemon.jar:$ACP:$PCP:/etc/cloudstack/agent"
-
-wait_for_network() {
-    i=1
-    while [ $i -lt 10 ]
-    do
-        # Under Ubuntu and Debian libvirt by default creates a bridge called virbr0.
-        # That's why we want more then 3 lines back from brctl, so that there is a manually created bridge
-        if [ "$(brctl show|wc -l)" -gt 2 ]; then
-            break
-        else
-            sleep 1
-            let i=$i+1
-            continue
-        fi
-    done
-}
-
-start() {
-    if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
-        log_daemon_msg "$PROGNAME apparently already running"
-        log_end_msg 0
-        exit 0
-    fi
-
-    log_daemon_msg "Starting $PROGNAME" "$SHORTNAME"
-    if hostname --fqdn >/dev/null 2>&1 ; then
-        true
-    else
-        log_failure_msg "The host name does not resolve properly to an IP address. Cannot start $PROGNAME"
-        log_end_msg 1
-        exit 1
-    fi
-
-    wait_for_network
-
-    if start_daemon -p $PIDFILE $DAEMON -Xms256m -Xmx2048m -cp "$CLASSPATH" -Djna.nosys=true -pidfile "$PIDFILE" -errfile SYSLOG $CLASS
-        RETVAL=$?
-    then
-        rc=0
-        sleep 1
-        if ! kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
-            log_failure_msg "$PROG failed to start"
-            rc=1
-        fi
-    else
-        rc=1
-    fi
-
-    if [ $rc -eq 0 ]; then
-        log_end_msg 0
-    else
-        log_end_msg 1
-        rm -f "$PIDFILE"
-    fi
-}
-
-stop() {
-    count="0"
-
-    log_daemon_msg "Stopping $PROGNAME" "$SHORTNAME"
-    killproc -p $PIDFILE $DAEMON
-
-    until [ "$count" -gt "$SHUTDOWN_WAIT" ]
-    do
-        agentPid=$(ps aux|grep [j]svc|grep $SHORTNAME)
-        if [ "$?" -gt "0" ];then
-            break
-        fi
-        sleep 1
-        let count="${count}+1"
-    done
-
-    agentPid=$(ps aux|grep [j]svc|grep $SHORTNAME)
-    if [ "$?" -eq "0" ]; then
-        agentPid=$(ps aux|grep [j]svc|awk '{print $2}')
-        if [ "$agentPid" != "" ]; then
-            log_warning_msg "$PROG still running, forcing kill"
-            kill -9 $agentPid
-        fi
-    fi
-
-    log_end_msg $?
-    rm -f "$PIDFILE"
-}
-
-case "$1" in
-    start)
-        start
-        ;;
-    stop)
-        stop
-        ;;
-    status)
-        status_of_proc -p "$PIDFILE" "$PROG" "$SHORTNAME"
-        RETVAL=$?
-        ;;
-    restart | force-reload)
-        stop
-        sleep 3
-        start
-        ;;
-    *)
-    echo "Usage: $0 {start|stop|restart|force-reload|status}"
-    RETVAL=3
-esac
-
-exit $RETVAL

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/debian/init/cloud-usage
----------------------------------------------------------------------
diff --git a/packaging/debian/init/cloud-usage b/packaging/debian/init/cloud-usage
deleted file mode 100755
index e6129c2..0000000
--- a/packaging/debian/init/cloud-usage
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/bin/bash
-
-### BEGIN INIT INFO
-# Provides:          cloudstack-usage
-# Required-Start:    $network $local_fs
-# Required-Stop:     $network $local_fs
-# Default-Start:     3 4 5
-# Default-Stop:      0 1 2 6
-# Short-Description: Start/stop Apache CloudStack Usage Monitor
-# Description: This scripts Starts/Stops the Apache CloudStack Usage Monitor
-##  The CloudStack Usage Monitor is a part of the Apache CloudStack project and is used
-##  for storing usage statistics from instances.
-## JSVC (Java daemonizing) is used for starting and stopping the usage monitor.
-### END INIT INFO
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. /lib/lsb/init-functions
-
-SHORTNAME="cloudstack-usage"
-PIDFILE=/var/run/"$SHORTNAME".pid
-PROGNAME="CloudStack Usage Monitor"
-CLASS="com.cloud.usage.UsageServer"
-PROG="jsvc"
-DAEMON="/usr/bin/jsvc"
-
-unset OPTIONS
-[ -r /etc/default/"$SHORTNAME" ] && source /etc/default/"$SHORTNAME"
-
-setJavaHome() {
-  # use $JAVA_HOME if defined
-  if [ -n "$JAVA_HOME" ] ; then
-    return
-  fi
-
-  # try java first
-  java=$(which java 2>/dev/null || :)
-
-  # try javac if java is not found
-  if [ -z "$java" ] ; then
-    java=$(which javac 2>/dev/null || :)
-  fi
-
-  if [ -n "$java" ] ; then
-    JAVA_HOME=$(dirname $(dirname $(readlink -e $java)))
-    export JAVA_HOME
-    return
-  fi
-
-  # If everything has failed, try hardcoded paths
-  # The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT)
-  JDK_DIRS="/usr/lib/jvm/java-7-openjdk-amd64 /usr/lib/jvm/java-7-openjdk-i386 /usr/lib/jvm/java-7-oracle /usr/lib/jvm/java-7-openjdk /usr/lib/jvm/java-7-sun"
-  for jdir in $JDK_DIRS; do
-    if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
-      JAVA_HOME="$jdir"
-      export JAVA_HOME
-      return
-    fi
-  done
-
-  # didnt find java home. exiting with error
-  exit 1
-}
-
-setJavaHome
-
-UCP=`ls /usr/share/cloudstack-usage/lib/*.jar | tr '\n' ':' | sed s'/.$//'`
-PCP=`ls /usr/share/cloudstack-usage/plugins/*.jar 2>/dev/null | tr '\n' ':' | sed s'/.$//'`
-
-# We need to append the JSVC daemon JAR to the classpath
-# AgentShell implements the JSVC daemon methods
-export CLASSPATH="/usr/share/java/commons-daemon.jar:/usr/share/java/mysql-connector-java.jar:$UCP:$PCP:/etc/cloudstack/usage"
-
-start() {
-    if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
-        log_daemon_msg "$PROGNAME apparently already running"
-        log_end_msg 0
-        exit 0
-    fi
-
-    log_daemon_msg "Starting $PROGNAME" "$SHORTNAME"
-    if hostname --fqdn >/dev/null 2>&1 ; then
-        true
-    else
-        log_failure_msg "The host name does not resolve properly to an IP address. Cannot start $PROGNAME"
-        log_end_msg 1
-        exit 1
-    fi
-
-    if start_daemon -p $PIDFILE $DAEMON -home "$JAVA_HOME" -cp "$CLASSPATH" -pidfile "$PIDFILE" -outfile SYSLOG -errfile SYSLOG -Dpid=$$ $CLASS
-        RETVAL=$?
-    then
-        rc=0
-        sleep 1
-        if ! kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
-            log_failure_msg "$PROG failed to start"
-            rc=1
-        fi
-    else
-        rc=1
-    fi
-
-    if [ $rc -eq 0 ]; then
-        log_end_msg 0
-    else
-        log_end_msg 1
-        rm -f "$PIDFILE"
-    fi
-}
-
-stop() {
-    log_daemon_msg "Stopping $PROGNAME" "$SHORTNAME"
-    killproc -p $PIDFILE $DAEMON
-    log_end_msg $?
-    rm -f "$PIDFILE"
-}
-
-case "$1" in
-    start)
-        start
-        ;;
-    stop)
-        stop
-        ;;
-    status)
-        status_of_proc -p "$PIDFILE" "$PROG" "$SHORTNAME"
-        RETVAL=$?
-        ;;
-    restart | force-reload)
-        stop
-        sleep 3
-        start
-        ;;
-    *)
-    echo "Usage: $0 {start|stop|restart|force-reload|status}"
-    RETVAL=3
-esac
-
-exit $RETVAL

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/systemd/cloudstack-agent.service
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-agent.service b/packaging/systemd/cloudstack-agent.service
index 00411f1..31d0246 100644
--- a/packaging/systemd/cloudstack-agent.service
+++ b/packaging/systemd/cloudstack-agent.service
@@ -23,10 +23,7 @@ After=libvirtd.service
 
 [Service]
 Type=simple
-Environment=JAVA_HOME=/usr/lib/jvm/jre
-Environment=JAVA_HEAP_INITIAL=256m
-Environment=JAVA_HEAP_MAX=2048m
-Environment=JAVA_CLASS=com.cloud.agent.AgentShell
+EnvironmentFile=-/etc/sysconfig/cloudstack-agent
 ExecStart=/bin/sh -ec '\
     export ACP=`ls /usr/share/cloudstack-agent/lib/*.jar /usr/share/cloudstack-agent/plugins/*.jar 2>/dev/null|tr "\\n" ":"`; \
     export CLASSPATH="$ACP:/etc/cloudstack/agent:/usr/share/cloudstack-common/scripts"; \

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/systemd/cloudstack-agent.sysconfig
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-agent.sysconfig b/packaging/systemd/cloudstack-agent.sysconfig
new file mode 100644
index 0000000..9b4750f
--- /dev/null
+++ b/packaging/systemd/cloudstack-agent.sysconfig
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+JAVA_HOME=/usr/lib/jvm/jre
+JAVA_HEAP_INITIAL=256m
+JAVA_HEAP_MAX=2048m
+JAVA_CLASS=com.cloud.agent.AgentShell

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/systemd/cloudstack-usage.service
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-usage.service b/packaging/systemd/cloudstack-usage.service
index 641d125..a59f41d 100644
--- a/packaging/systemd/cloudstack-usage.service
+++ b/packaging/systemd/cloudstack-usage.service
@@ -23,11 +23,7 @@ After=network.target network-online.target
 
 [Service]
 Type=simple
-Environment=JAVA_HOME=/usr/lib/jvm/jre
-Environment=JAVA_HEAP_INITIAL=256m
-Environment=JAVA_HEAP_MAX=2048m
-Environment=JAVA_CLASS=com.cloud.usage.UsageServer
-Environment=JAVA_PID=$$
+EnvironmentFile=-/etc/sysconfig/cloudstack-usage
 ExecStart=/bin/sh -ec '\
     export UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar /usr/share/cloudstack-usage/lib/*.jar /usr/share/cloudstack-mysql-ha/lib/*.jar | tr "\\n" ":"`; \
     export CLASSPATH="$UCP:/etc/cloudstack/usage:/usr/share/java/mysql-connector-java.jar"; \

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/142772d5/packaging/systemd/cloudstack-usage.sysconfig
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-usage.sysconfig b/packaging/systemd/cloudstack-usage.sysconfig
new file mode 100644
index 0000000..dcf746a
--- /dev/null
+++ b/packaging/systemd/cloudstack-usage.sysconfig
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+JAVA_HOME=/usr/lib/jvm/jre
+JAVA_HEAP_INITIAL=256m
+JAVA_HEAP_MAX=2048m
+JAVA_CLASS=com.cloud.usage.UsageServer
+JAVA_PID=$$


[4/4] git commit: updated refs/heads/master to 38259a9

Posted by bh...@apache.org.
Merge branch '4.9'


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/38259a9a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/38259a9a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/38259a9a

Branch: refs/heads/master
Commit: 38259a9a8c511e99f959a7c3567b7b1806c3ecd5
Parents: 3149705 f7d6fea
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Fri Aug 26 23:49:35 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Aug 26 23:49:35 2016 +0530

----------------------------------------------------------------------
 debian/cloudstack-agent.dirs                    |   1 +
 debian/cloudstack-agent.install                 |   2 +-
 debian/cloudstack-usage.dirs                    |   1 +
 debian/cloudstack-usage.install                 |   2 +-
 debian/control                                  |  10 +-
 debian/rules                                    |  25 ++-
 packaging/README.md                             |  39 +++++
 packaging/build-deb.sh                          |  53 ++++++
 packaging/centos7/cloud-management.service      |  40 -----
 packaging/centos7/cloud-management.sysconfig    |  49 ------
 packaging/centos7/cloud.spec                    |  18 +-
 packaging/debian/cloudstack-agent.init          | 170 +++++++++++++++++++
 packaging/debian/cloudstack-usage.init          | 154 +++++++++++++++++
 packaging/debian/init/cloud-agent               | 170 -------------------
 packaging/debian/init/cloud-usage               | 154 -----------------
 packaging/systemd/cloudstack-agent.default      |  21 +++
 packaging/systemd/cloudstack-agent.service      |   7 +-
 packaging/systemd/cloudstack-management.default |  49 ++++++
 packaging/systemd/cloudstack-management.service |  40 +++++
 packaging/systemd/cloudstack-usage.default      |  22 +++
 packaging/systemd/cloudstack-usage.service      |   8 +-
 pom.xml                                         |   2 +
 22 files changed, 597 insertions(+), 440 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/38259a9a/pom.xml
----------------------------------------------------------------------


[2/4] git commit: updated refs/heads/master to 38259a9

Posted by bh...@apache.org.
CLOUDSTACK-9462: Refactor systemd scripts

Refactors and unifies usage of systemd script and default files across
CentOS and Ubuntu/Debian packaging system.

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c8a52c94
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c8a52c94
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c8a52c94

Branch: refs/heads/master
Commit: c8a52c94d2f34f0204404707c04148f5ee4f3f2e
Parents: 142772d
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Wed Aug 24 13:36:07 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Aug 26 15:19:58 2016 +0530

----------------------------------------------------------------------
 debian/control                                  |  8 ++--
 debian/rules                                    | 20 +++-----
 packaging/centos7/cloud-management.service      | 40 ----------------
 packaging/centos7/cloud-management.sysconfig    | 49 --------------------
 packaging/centos7/cloud.spec                    | 22 +++++----
 packaging/debian/cloudstack-agent.default       | 21 ---------
 packaging/debian/cloudstack-agent.service       | 35 --------------
 packaging/debian/cloudstack-usage.default       | 21 ---------
 packaging/debian/cloudstack-usage.service       | 35 --------------
 packaging/systemd/cloudstack-agent.default      | 21 +++++++++
 packaging/systemd/cloudstack-agent.service      |  4 +-
 packaging/systemd/cloudstack-agent.sysconfig    | 21 ---------
 packaging/systemd/cloudstack-management.default | 49 ++++++++++++++++++++
 packaging/systemd/cloudstack-management.service | 40 ++++++++++++++++
 packaging/systemd/cloudstack-usage.default      | 22 +++++++++
 packaging/systemd/cloudstack-usage.service      |  4 +-
 packaging/systemd/cloudstack-usage.sysconfig    | 22 ---------
 pom.xml                                         |  2 +
 18 files changed, 163 insertions(+), 273 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/debian/control
----------------------------------------------------------------------
diff --git a/debian/control b/debian/control
index d7c7928..9855bed 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: cloudstack
 Section: libs
 Priority: extra
 Maintainer: Wido den Hollander <wi...@widodh.nl>
-Build-Depends: debhelper (>= 9), openjdk-8-jdk | openjdk-7-jdk, genisoimage,
+Build-Depends: debhelper (>= 9), openjdk-8-jdk | java8-sdk | java8-jdk | openjdk-7-jdk, genisoimage,
  python-mysql.connector, maven (>= 3) | maven3, python (>= 2.7), lsb-release, dh-systemd
 Standards-Version: 3.8.1
 Homepage: http://www.cloudstack.org/
@@ -22,7 +22,8 @@ Description: CloudStack server library
 
 Package: cloudstack-agent
 Architecture: all
-Depends: ${misc:Depends}, ${python:Depends}, ${jre:Depends}, cloudstack-common (= ${source:Version}), lsb-base (>= 4.0), libcommons-daemon-java, openssh-client, qemu-kvm (>= 1.0), libvirt-bin (>= 0.9.8), uuid-runtime, iproute, ebtables, vlan, ${init:Depends}, ipset, python-libvirt, ethtool, iptables, lsb-release
+Depends: ${python:Depends}, openjdk-8-jre-headless | java8-runtime-headless | java8-runtime | openjdk-7-jre-headless, cloudstack-common (= ${source:Version}), lsb-base (>= 4.0), libcommons-daemon-java, openssh-client, qemu-kvm (>= 1.0), libvirt-bin (>= 0.9.8), uuid-runtime, iproute, ebtables, vlan, jsvc, ipset, python-libvirt, ethtool, iptables, lsb-release
+Recommends: init-system-helpers
 Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
 Description: CloudStack agent
  The CloudStack agent is in charge of managing shared computing resources in
@@ -31,7 +32,8 @@ Description: CloudStack agent
 
 Package: cloudstack-usage
 Architecture: all
-Depends: ${misc:Depends}, ${jre:Depends}, cloudstack-common (= ${source:Version}), jsvc, libmysql-java
+Depends: openjdk-8-jre-headless | java8-runtime-headless | java8-runtime | openjdk-7-jre-headless, cloudstack-common (= ${source:Version}), jsvc, libmysql-java
+Recommends: init-system-helpers
 Description: CloudStack usage monitor
  The CloudStack usage monitor provides usage accounting across the entire cloud for
  cloud operators to charge based on usage parameters.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/debian/rules
----------------------------------------------------------------------
diff --git a/debian/rules b/debian/rules
index 32216ff..cfe7514 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,18 +5,9 @@ PACKAGE = $(shell dh_listpackages|head -n 1|cut -d '-' -f 1)
 SYSCONFDIR = "/etc"
 DESTDIR = "debian/tmp"
 
-ifeq ($(shell lsb_release -sr), 14.04)
-        SUBSTVARS = -Vjre:Depends="openjdk-7-jre-headless" -Vjdk:Depends="openjdk-7-jdk" -Vinit:"Depends:jsvc"
-else
-        SUBSTVARS = -Vjre:Depends="openjdk-8-jre-headless" -Vjdk:Depends="openjdk-8-jdk" -Vinit:"Depends:systemd"
-endif
-
 %:
 	dh $@ --with python2,systemd
 
-override_dh_gencontrol:
-	dh_gencontrol -- $(SUBSTVARS)
-
 override_dh_auto_configure:
 	cp packaging/debian/replace.properties replace.properties.tmp
 	echo VERSION=${VERSION} >> replace.properties.tmp
@@ -54,8 +45,11 @@ override_dh_auto_install:
 
 	install -m0755 packaging/debian/$(PACKAGE)-agent.init $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-agent
 	install -d -m0755 debian/$(PACKAGE)-agent/lib/systemd/system
-	install -m0644 packaging/debian/$(PACKAGE)-agent.service debian/$(PACKAGE)-agent/lib/systemd/system/$(PACKAGE)-agent.service
-	install -m0644 packaging/debian/$(PACKAGE)-agent.default $(DESTDIR)/$(SYSCONFDIR)/default/$(PACKAGE)-agent
+	# Fix libvirt service name for Debian/Ubuntu
+	sed -i 's/Requires=libvirtd.service/Requires=libvirt-bin.service/g' packaging/systemd/$(PACKAGE)-agent.service
+	sed -i 's/After=libvirtd.service/After=libvirt-bin.service/g' packaging/systemd/$(PACKAGE)-agent.service
+	install -m0644 packaging/systemd/$(PACKAGE)-agent.service debian/$(PACKAGE)-agent/lib/systemd/system/$(PACKAGE)-agent.service
+	install -m0644 packaging/systemd/$(PACKAGE)-agent.default $(DESTDIR)/$(SYSCONFDIR)/default/$(PACKAGE)-agent
 
 	install -D agent/target/transformed/cloud-setup-agent $(DESTDIR)/usr/bin/cloudstack-setup-agent
 	install -D agent/target/transformed/cloud-ssh $(DESTDIR)/usr/bin/cloudstack-ssh
@@ -140,8 +134,8 @@ override_dh_auto_install:
 
 	install -D -m0755 packaging/debian/$(PACKAGE)-usage.init $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-usage
 	install -d -m0755 debian/$(PACKAGE)-usage/lib/systemd/system
-	install -m0644 packaging/debian/$(PACKAGE)-usage.service debian/$(PACKAGE)-usage/lib/systemd/system/$(PACKAGE)-usage.service
-	install -m0644 packaging/debian/$(PACKAGE)-usage.default $(DESTDIR)/$(SYSCONFDIR)/default/$(PACKAGE)-usage
+	install -m0644 packaging/systemd/$(PACKAGE)-usage.service debian/$(PACKAGE)-usage/lib/systemd/system/$(PACKAGE)-usage.service
+	install -m0644 packaging/systemd/$(PACKAGE)-usage.default $(DESTDIR)/$(SYSCONFDIR)/default/$(PACKAGE)-usage
 
 	# cloudstack-marvin
 	mkdir -p $(DESTDIR)/usr/share/$(PACKAGE)-marvin

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/centos7/cloud-management.service
----------------------------------------------------------------------
diff --git a/packaging/centos7/cloud-management.service b/packaging/centos7/cloud-management.service
deleted file mode 100644
index db52dcf..0000000
--- a/packaging/centos7/cloud-management.service
+++ /dev/null
@@ -1,40 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Systemd unit file for CloudStack Management server
-# 
-# clone tomcat service, see /usr/lib/systemd/system/tomcat.service
-
-[Unit]
-Description=CloudStack Management Server
-After=syslog.target network.target
-
-[Service]
-UMask=0022
-Type=simple
-EnvironmentFile=/etc/tomcat/tomcat.conf
-Environment="NAME=cloudstack-management"
-EnvironmentFile=-/etc/sysconfig/cloudstack-management
-ExecStart=/usr/libexec/tomcat/server start
-ExecStop=/usr/libexec/tomcat/server stop
-SuccessExitStatus=143
-User=cloud
-Group=cloud
-
-[Install]
-WantedBy=multi-user.target
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/centos7/cloud-management.sysconfig
----------------------------------------------------------------------
diff --git a/packaging/centos7/cloud-management.sysconfig b/packaging/centos7/cloud-management.sysconfig
deleted file mode 100644
index 6e5fcf9..0000000
--- a/packaging/centos7/cloud-management.sysconfig
+++ /dev/null
@@ -1,49 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Required for a tocmat cloned service
-SERVICE_NAME=cloudstack-management
-
-# Where your java installation lives
-#JAVA_HOME="/usr/lib/jvm/java"
-
-# Where your cloudstack-management installation lives
-CATALINA_BASE="/usr/share/cloudstack-management"
-CATALINA_HOME="/usr/share/cloudstack-management"
-JASPER_HOME="/usr/share/cloudstack-management"
-CATALINA_TMPDIR="/usr/share/cloudstack-management/temp"
-
-
-if [ -r "/etc/cloudstack/management/cloudmanagementserver.keystore" ] ; then
-  JAVA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote=false -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/cloudstack/management/ -XX:PermSize=512M -XX:MaxPermSize=800m -Djavax.net.ssl.trustStore=/etc/cloudstack/management/cloudmanagementserver.keystore -Djavax.net.ssl.trustStorePassword=vmops.com "
-else
-  JAVA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote=false -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/cloudstack/management/ -XX:PermSize=512M -XX:MaxPermSize=800m"
-fi
-
-TOMCAT_USER="cloud"
-
-SECURITY_MANAGER="false"
-
-SHUTDOWN_WAIT="30"
-
-SHUTDOWN_VERBOSE="false"
-
-# Set the TOMCAT_PID location
-CATALINA_PID="/var/run/cloudstack-management.pid"
-
-CLASSPATH=/etc/cloudstack/management:/usr/share/cloudstack-common:/usr/share/cloudstack-management/setup
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/centos7/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec
index 04315f8..15ad8de 100644
--- a/packaging/centos7/cloud.spec
+++ b/packaging/centos7/cloud.spec
@@ -210,7 +210,7 @@ mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}/management/temp
 mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/mnt
 mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/management
 mkdir -p ${RPM_BUILD_ROOT}%{_initrddir}
-mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
+mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/default
 mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/profile.d
 mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sudoers.d
 
@@ -285,10 +285,10 @@ install python/bindir/cloud-external-ipallocator.py ${RPM_BUILD_ROOT}%{_bindir}/
 install -D client/target/pythonlibs/jasypt-1.9.2.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/lib/jasypt-1.9.2.jar
 
 install -D packaging/centos7/cloud-ipallocator.rc ${RPM_BUILD_ROOT}%{_initrddir}/%{name}-ipallocator
-install -D packaging/centos7/cloud-management.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}-management
-install -D server/target/conf/cloudstack-sudoers ${RPM_BUILD_ROOT}%{_sysconfdir}/sudoers.d/%{name}-management
-install -D packaging/centos7/cloud-management.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-management.service
 install -D packaging/centos7/cloud.limits ${RPM_BUILD_ROOT}%{_sysconfdir}/security/limits.d/cloud
+install -D packaging/systemd/cloudstack-management.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-management.service
+install -D packaging/systemd/cloudstack-management.default ${RPM_BUILD_ROOT}%{_sysconfdir}/default/%{name}-management
+install -D server/target/conf/cloudstack-sudoers ${RPM_BUILD_ROOT}%{_sysconfdir}/sudoers.d/%{name}-management
 touch ${RPM_BUILD_ROOT}%{_localstatedir}/run/%{name}-management.pid
 install -D server/target/conf/cloudstack-catalina.logrotate ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}-catalina
 
@@ -309,7 +309,7 @@ mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/agent
 mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib
 mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/plugins
 install -D packaging/systemd/cloudstack-agent.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-agent.service
-install -D packaging/systemd/cloudstack-agent.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}-agent
+install -D packaging/systemd/cloudstack-agent.default ${RPM_BUILD_ROOT}%{_sysconfdir}/default/%{name}-agent
 install -D agent/target/transformed/agent.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/agent.properties
 install -D agent/target/transformed/environment.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/environment.properties
 install -D agent/target/transformed/log4j-cloud.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/log4j-cloud.xml
@@ -330,7 +330,7 @@ install -D usage/target/transformed/db.properties ${RPM_BUILD_ROOT}%{_sysconfdir
 install -D usage/target/transformed/log4j-cloud_usage.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/usage/log4j-cloud.xml
 cp usage/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/lib/
 install -D packaging/systemd/cloudstack-usage.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-usage.service
-install -D packaging/systemd/cloudstack-usage.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}-usage
+install -D packaging/systemd/cloudstack-usage.default ${RPM_BUILD_ROOT}%{_sysconfdir}/default/%{name}-usage
 mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/usage/
 
 # CLI
@@ -405,6 +405,10 @@ if [ ! -f %{_datadir}/cloudstack-common/scripts/vm/hypervisor/xenserver/vhd-util
     echo %{_datadir}/cloudstack-common/scripts/vm/hypervisor/xenserver/
 fi
 
+if [ -f %{_sysconfdir}/sysconfig/%{name}-management ] ; then
+    mv %{_sysconfdir}/sysconfig/%{name}-management  %{_sysconfdir}/default/%{name}-management
+fi
+
 %preun agent
 /sbin/service cloudstack-agent stop || true
 if [ "$1" == "0" ] ; then
@@ -484,7 +488,7 @@ pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
 %dir %attr(0770,root,cloud) %{_localstatedir}/cache/%{name}/management/work
 %dir %attr(0770,root,cloud) %{_localstatedir}/cache/%{name}/management/temp
 %dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/management
-%config(noreplace) %{_sysconfdir}/sysconfig/%{name}-management
+%config(noreplace) %{_sysconfdir}/default/%{name}-management
 %config(noreplace) %{_sysconfdir}/sudoers.d/%{name}-management
 %config(noreplace) %{_sysconfdir}/security/limits.d/cloud
 %config(noreplace) %attr(0640,root,cloud) %{_sysconfdir}/%{name}/management/db.properties
@@ -535,7 +539,7 @@ pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
 %attr(0755,root,root) %{_bindir}/%{name}-agent-upgrade
 %attr(0755,root,root) %{_bindir}/%{name}-ssh
 %attr(0644,root,root) %{_unitdir}/%{name}-agent.service
-%attr(0644,root,root) %{_sysconfdir}/sysconfig/%{name}-agent
+%config(noreplace) %{_sysconfdir}/default/%{name}-agent
 %attr(0644,root,root) %{_sysconfdir}/profile.d/%{name}-agent-profile.sh
 %attr(0644,root,root) %{_sysconfdir}/logrotate.d/%{name}-agent
 %attr(0755,root,root) %{_datadir}/%{name}-common/scripts/network/cisco
@@ -562,7 +566,7 @@ pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz
 
 %files usage
 %attr(0644,root,root) %{_unitdir}/%{name}-usage.service
-%attr(0644,root,root) %{_sysconfdir}/sysconfig/%{name}-usage
+%config(noreplace) %{_sysconfdir}/default/%{name}-usage
 %attr(0644,root,root) %{_datadir}/%{name}-usage/*.jar
 %attr(0644,root,root) %{_datadir}/%{name}-usage/lib/*.jar
 %dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/usage

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/debian/cloudstack-agent.default
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-agent.default b/packaging/debian/cloudstack-agent.default
deleted file mode 100644
index 16a0306..0000000
--- a/packaging/debian/cloudstack-agent.default
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
-JAVA_HEAP_INITIAL=256m
-JAVA_HEAP_MAX=2048m
-JAVA_CLASS=com.cloud.agent.AgentShell

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/debian/cloudstack-agent.service
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-agent.service b/packaging/debian/cloudstack-agent.service
deleted file mode 100644
index d3080c7..0000000
--- a/packaging/debian/cloudstack-agent.service
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-[Unit]
-Description=CloudStack Agent
-Documentation=http://www.cloudstack.org/
-Requires=libvirt-bin.service
-After=libvirt-bin.service
-
-[Service]
-Type=simple
-EnvironmentFile=-/etc/default/cloudstack-agent
-ExecStart=/bin/sh -ec '\
-    export ACP=`ls /usr/share/cloudstack-agent/lib/*.jar /usr/share/cloudstack-agent/plugins/*.jar 2>/dev/null|tr "\\n" ":"`; \
-    export CLASSPATH="$ACP:/etc/cloudstack/agent:/usr/share/cloudstack-common/scripts"; \
-    ${JAVA_HOME}/bin/java -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
-Restart=always
-RestartSec=10s
-
-[Install]
-WantedBy=multi-user.target

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/debian/cloudstack-usage.default
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-usage.default b/packaging/debian/cloudstack-usage.default
deleted file mode 100644
index 1fa328c..0000000
--- a/packaging/debian/cloudstack-usage.default
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
-JAVA_HEAP_INITIAL=256m
-JAVA_HEAP_MAX=2048m
-JAVA_CLASS=com.cloud.usage.UsageServer

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/debian/cloudstack-usage.service
----------------------------------------------------------------------
diff --git a/packaging/debian/cloudstack-usage.service b/packaging/debian/cloudstack-usage.service
deleted file mode 100644
index c36224e..0000000
--- a/packaging/debian/cloudstack-usage.service
+++ /dev/null
@@ -1,35 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-[Unit]
-Description=CloudStack Usage Server
-Documentation=http://www.cloudstack.org/
-Wants=network.target network-online.target
-After=network.target network-online.target
-
-[Service]
-Type=simple
-EnvironmentFile=-/etc/default/cloudstack-usage
-ExecStart=/bin/sh -ec '\
-    export UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar /usr/share/cloudstack-usage/lib/*.jar | tr "\\n" ":"`; \
-    export CLASSPATH="$UCP:/etc/cloudstack/usage:/usr/share/java/mysql-connector-java.jar"; \
-    ${JAVA_HOME}/bin/java -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
-Restart=always
-RestartSec=10s
-
-[Install]
-WantedBy=multi-user.target

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/systemd/cloudstack-agent.default
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-agent.default b/packaging/systemd/cloudstack-agent.default
new file mode 100644
index 0000000..659d715
--- /dev/null
+++ b/packaging/systemd/cloudstack-agent.default
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+JAVA=/usr/bin/java
+JAVA_HEAP_INITIAL=256m
+JAVA_HEAP_MAX=2048m
+JAVA_CLASS=com.cloud.agent.AgentShell

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/systemd/cloudstack-agent.service
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-agent.service b/packaging/systemd/cloudstack-agent.service
index 31d0246..dd1560c 100644
--- a/packaging/systemd/cloudstack-agent.service
+++ b/packaging/systemd/cloudstack-agent.service
@@ -23,11 +23,11 @@ After=libvirtd.service
 
 [Service]
 Type=simple
-EnvironmentFile=-/etc/sysconfig/cloudstack-agent
+EnvironmentFile=-/etc/default/cloudstack-agent
 ExecStart=/bin/sh -ec '\
     export ACP=`ls /usr/share/cloudstack-agent/lib/*.jar /usr/share/cloudstack-agent/plugins/*.jar 2>/dev/null|tr "\\n" ":"`; \
     export CLASSPATH="$ACP:/etc/cloudstack/agent:/usr/share/cloudstack-common/scripts"; \
-    ${JAVA_HOME}/bin/java -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
+    ${JAVA} -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
 Restart=always
 RestartSec=10s
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/systemd/cloudstack-agent.sysconfig
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-agent.sysconfig b/packaging/systemd/cloudstack-agent.sysconfig
deleted file mode 100644
index 9b4750f..0000000
--- a/packaging/systemd/cloudstack-agent.sysconfig
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-JAVA_HOME=/usr/lib/jvm/jre
-JAVA_HEAP_INITIAL=256m
-JAVA_HEAP_MAX=2048m
-JAVA_CLASS=com.cloud.agent.AgentShell

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/systemd/cloudstack-management.default
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-management.default b/packaging/systemd/cloudstack-management.default
new file mode 100644
index 0000000..6e5fcf9
--- /dev/null
+++ b/packaging/systemd/cloudstack-management.default
@@ -0,0 +1,49 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Required for a tocmat cloned service
+SERVICE_NAME=cloudstack-management
+
+# Where your java installation lives
+#JAVA_HOME="/usr/lib/jvm/java"
+
+# Where your cloudstack-management installation lives
+CATALINA_BASE="/usr/share/cloudstack-management"
+CATALINA_HOME="/usr/share/cloudstack-management"
+JASPER_HOME="/usr/share/cloudstack-management"
+CATALINA_TMPDIR="/usr/share/cloudstack-management/temp"
+
+
+if [ -r "/etc/cloudstack/management/cloudmanagementserver.keystore" ] ; then
+  JAVA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote=false -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/cloudstack/management/ -XX:PermSize=512M -XX:MaxPermSize=800m -Djavax.net.ssl.trustStore=/etc/cloudstack/management/cloudmanagementserver.keystore -Djavax.net.ssl.trustStorePassword=vmops.com "
+else
+  JAVA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote=false -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/cloudstack/management/ -XX:PermSize=512M -XX:MaxPermSize=800m"
+fi
+
+TOMCAT_USER="cloud"
+
+SECURITY_MANAGER="false"
+
+SHUTDOWN_WAIT="30"
+
+SHUTDOWN_VERBOSE="false"
+
+# Set the TOMCAT_PID location
+CATALINA_PID="/var/run/cloudstack-management.pid"
+
+CLASSPATH=/etc/cloudstack/management:/usr/share/cloudstack-common:/usr/share/cloudstack-management/setup
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/systemd/cloudstack-management.service
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-management.service b/packaging/systemd/cloudstack-management.service
new file mode 100644
index 0000000..c1ede4b
--- /dev/null
+++ b/packaging/systemd/cloudstack-management.service
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Systemd unit file for CloudStack Management server
+# 
+# clone tomcat service, see /usr/lib/systemd/system/tomcat.service
+
+[Unit]
+Description=CloudStack Management Server
+After=syslog.target network.target
+
+[Service]
+UMask=0022
+Type=simple
+EnvironmentFile=/etc/tomcat/tomcat.conf
+Environment="NAME=cloudstack-management"
+EnvironmentFile=-/etc/default/cloudstack-management
+ExecStart=/usr/libexec/tomcat/server start
+ExecStop=/usr/libexec/tomcat/server stop
+SuccessExitStatus=143
+User=cloud
+Group=cloud
+
+[Install]
+WantedBy=multi-user.target
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/systemd/cloudstack-usage.default
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-usage.default b/packaging/systemd/cloudstack-usage.default
new file mode 100644
index 0000000..84de943
--- /dev/null
+++ b/packaging/systemd/cloudstack-usage.default
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+JAVA=/usr/bin/java
+JAVA_HEAP_INITIAL=256m
+JAVA_HEAP_MAX=2048m
+JAVA_CLASS=com.cloud.usage.UsageServer
+JAVA_PID=$$

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/systemd/cloudstack-usage.service
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-usage.service b/packaging/systemd/cloudstack-usage.service
index a59f41d..424a455 100644
--- a/packaging/systemd/cloudstack-usage.service
+++ b/packaging/systemd/cloudstack-usage.service
@@ -23,11 +23,11 @@ After=network.target network-online.target
 
 [Service]
 Type=simple
-EnvironmentFile=-/etc/sysconfig/cloudstack-usage
+EnvironmentFile=-/etc/default/cloudstack-usage
 ExecStart=/bin/sh -ec '\
     export UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar /usr/share/cloudstack-usage/lib/*.jar /usr/share/cloudstack-mysql-ha/lib/*.jar | tr "\\n" ":"`; \
     export CLASSPATH="$UCP:/etc/cloudstack/usage:/usr/share/java/mysql-connector-java.jar"; \
-    ${JAVA_HOME}/bin/java -Dpid=${JAVA_PID} -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
+    ${JAVA} -Dpid=${JAVA_PID} -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
 Restart=always
 RestartSec=10s
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/packaging/systemd/cloudstack-usage.sysconfig
----------------------------------------------------------------------
diff --git a/packaging/systemd/cloudstack-usage.sysconfig b/packaging/systemd/cloudstack-usage.sysconfig
deleted file mode 100644
index dcf746a..0000000
--- a/packaging/systemd/cloudstack-usage.sysconfig
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-JAVA_HOME=/usr/lib/jvm/jre
-JAVA_HEAP_INITIAL=256m
-JAVA_HEAP_MAX=2048m
-JAVA_CLASS=com.cloud.usage.UsageServer
-JAVA_PID=$$

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a52c94/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 92e9209..b365714 100644
--- a/pom.xml
+++ b/pom.xml
@@ -832,6 +832,8 @@
               <exclude>**/*.json</exclude>
               <exclude>build/build.number</exclude>
               <exclude>services/console-proxy/server/js/jquery.js</exclude>
+              <exclude>debian/cloudstack-usage.dirs</exclude>
+              <exclude>debian/cloudstack-agent.dirs</exclude>
               <exclude>debian/compat</exclude>
               <exclude>debian/control</exclude>
               <exclude>debian/dirs</exclude>


[3/4] git commit: updated refs/heads/master to 38259a9

Posted by bh...@apache.org.
Merge pull request #1647 from apache/4.9-systemdubuntupkging

[lts] CLOUDSTACK-9462: Systemd support for Ubuntu 16.04Created this based on @wido 's origin PR #1541 .

Requesting for review and testing -- @jburwell @karuturi @wido @vincentbernat
@wido I think this change only brings systemd support to agent and usage packages, or does cloudstack-management pkg has systemd support too?

@blueorangutan package

- systemd: Add a /etc/sysconfig/cloudstack-* file

  This allows users to easily override variables passed to Java when
  starting up.

  It also creates a foundation for sharing the systemd service profile
  between CentOS and Ubuntu since it only requires the environment file
  to be changed.

- deb: Add Ubuntu 16.04 support

  Ubuntu 16.04 differs from Ubuntu 14.04 in a few ways:
  - systemd instead of sysvinit / upstart
  - Java 8 support

  The packaging now detects on which distribution it is being
  build and based on that it installs different files in the
  packages, but it also changes the Dependencies.

* pr/1647:
  CLOUDSTACK-9462: Refactor systemd scripts
  CLOUDSTACK-9462: Systemd support for Ubuntu 16.04

Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f7d6fea8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f7d6fea8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f7d6fea8

Branch: refs/heads/master
Commit: f7d6fea821ee6b69ff3fd6ed6c007f8851fee012
Parents: d6e9045 c8a52c9
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Fri Aug 26 23:44:58 2016 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri Aug 26 23:47:44 2016 +0530

----------------------------------------------------------------------
 debian/cloudstack-agent.dirs                    |   1 +
 debian/cloudstack-agent.install                 |   2 +-
 debian/cloudstack-usage.dirs                    |   1 +
 debian/cloudstack-usage.install                 |   2 +-
 debian/control                                  |  10 +-
 debian/rules                                    |  25 ++-
 packaging/README.md                             |  39 +++++
 packaging/build-deb.sh                          |  53 ++++++
 packaging/centos7/cloud-management.service      |  40 -----
 packaging/centos7/cloud-management.sysconfig    |  49 ------
 packaging/centos7/cloud.spec                    |  18 +-
 packaging/debian/cloudstack-agent.init          | 170 +++++++++++++++++++
 packaging/debian/cloudstack-usage.init          | 154 +++++++++++++++++
 packaging/debian/init/cloud-agent               | 170 -------------------
 packaging/debian/init/cloud-usage               | 154 -----------------
 packaging/systemd/cloudstack-agent.default      |  21 +++
 packaging/systemd/cloudstack-agent.service      |   7 +-
 packaging/systemd/cloudstack-management.default |  49 ++++++
 packaging/systemd/cloudstack-management.service |  40 +++++
 packaging/systemd/cloudstack-usage.default      |  22 +++
 packaging/systemd/cloudstack-usage.service      |   8 +-
 pom.xml                                         |   2 +
 22 files changed, 597 insertions(+), 440 deletions(-)
----------------------------------------------------------------------