mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Summary: Fixup usage server for packaging
Make the start method work again with jsvc Move the usageApplicationContext to resources and add resources to the pom.xml Remove the old components file Add mysql-connector as a runtime dependency Rename the usage package and the files to cloudstack Change paths to the new proposed locations
This commit is contained in:
parent
195c6c15fe
commit
7ce03b4f8e
@ -32,10 +32,10 @@
|
||||
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
SHORTNAME="cloud-usage"
|
||||
SHORTNAME="cloudstack-usage"
|
||||
PIDFILE=/var/run/"$SHORTNAME".pid
|
||||
LOCKFILE=/var/lock/subsys/"$SHORTNAME"
|
||||
LOGFILE=/var/log/cloud/usage/usage.log
|
||||
LOGFILE=/var/log/cloudstack/usage/usage.log
|
||||
PROGNAME="CloudStack Usage Monitor"
|
||||
CLASS="com.cloud.usage.UsageServer"
|
||||
PROG="jsvc"
|
||||
@ -57,12 +57,12 @@ export JAVA_HOME
|
||||
|
||||
SCP=""
|
||||
DCP=""
|
||||
UCP=`ls /usr/share/cloud/usage/java/* | tr '\n' ':'`
|
||||
UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar`":"`ls /usr/share/cloudstack-usage/lib/* | tr '\n' ':'`
|
||||
JCP="/usr/share/java/commons-daemon.jar"
|
||||
|
||||
# We need to append the JSVC daemon JAR to the classpath
|
||||
# AgentShell implements the JSVC daemon methods
|
||||
export CLASSPATH="$SCP:$DCP:$UCP:$JCP:/etc/sysconfig
|
||||
export CLASSPATH="$SCP:$DCP:$UCP:$JCP:/etc/sysconfig"
|
||||
|
||||
start() {
|
||||
if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then
|
||||
|
||||
@ -240,10 +240,11 @@ install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-%{_maventa
|
||||
cp plugins/hypervisors/kvm/target/dependencies/* ${RPM_BUILD_ROOT}/usr/share/cloud/java
|
||||
|
||||
# Usage server
|
||||
install -D usage/target/cloud-usage-%{_maventag}.jar ${RPM_BUILD_ROOT}/usr/share/cloud/usage/java/cloud-usage-%{_maventag}.jar
|
||||
cp usage/target/dependencies/* ${RPM_BUILD_ROOT}/usr/share/cloud/usage/java
|
||||
install -D packaging/centos63/cloud-usage.rc ${RPM_BUILD_ROOT}/etc/init.d/cloud-usage
|
||||
mkdir -p ${RPM_BUILD_ROOT}/var/log/cloud/usage/
|
||||
mkdir -p ${RPM_BUILD_ROOT}/usr/share/%{name}-usage/lib
|
||||
install -D usage/target/cloud-usage-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/cloud-usage-%{_maventag}.jar
|
||||
cp usage/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/lib/
|
||||
install -D packaging/centos63/cloud-usage.rc ${RPM_BUILD_ROOT}/%{_sysconfdir}/init.d/%{name}-usage
|
||||
mkdir -p ${RPM_BUILD_ROOT}/var/log/%{name}/usage/
|
||||
|
||||
%clean
|
||||
[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT}
|
||||
@ -335,14 +336,15 @@ fi
|
||||
%doc NOTICE
|
||||
|
||||
%files common
|
||||
%attr(0755,root,root) /usr/share/cloudstack-scripts/
|
||||
%attr(0755,root,root) %{_datadir}/cloudstack-scripts/
|
||||
%doc LICENSE
|
||||
%doc NOTICE
|
||||
|
||||
%files usage
|
||||
%attr(0755,root,root) %{_sysconfdir}/init.d/cloud-usage
|
||||
%attr(0644,root,root) /usr/share/cloud/usage/java/*.jar
|
||||
%dir /var/log/cloud/usage
|
||||
%attr(0755,root,root) %{_sysconfdir}/init.d/%{name}-usage
|
||||
%attr(0644,root,root) %{_datadir}/%{name}-usage/*.jar
|
||||
%attr(0644,root,root) %{_datadir}/%{name}-usage/lib/*.jar
|
||||
%dir /var/log/%{name}/usage
|
||||
%doc LICENSE
|
||||
%doc NOTICE
|
||||
|
||||
|
||||
@ -1,80 +0,0 @@
|
||||
<?xml version="1.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.
|
||||
-->
|
||||
<!--
|
||||
usage-components.xml is the configuration file for the VM Ops
|
||||
usage servers.
|
||||
|
||||
Here are some places to look for information.
|
||||
- To find out the general functionality that each Manager
|
||||
or Adapter provide, look at the javadoc for the interface
|
||||
that it implements. The interface is usually the
|
||||
"key" attribute in the declaration.
|
||||
- To find specific implementation of each Manager or
|
||||
Adapter, look at the javadoc for the actual class. The
|
||||
class can be found in the <class> element.
|
||||
- To find out the configuration parameters for each Manager
|
||||
or Adapter, look at the javadoc for the actual implementation
|
||||
class. It should be documented in the description of the
|
||||
class.
|
||||
- To know more about the components.xml in general, look for
|
||||
the javadoc for ComponentLocator.java.
|
||||
|
||||
If you found that the Manager or Adapter are not properly
|
||||
documented, please contact the author.
|
||||
-->
|
||||
<components.xml>
|
||||
<usage-server>
|
||||
<system-integrity-checker class="com.cloud.utils.crypt.EncryptionSecretKeyChecker">
|
||||
<checker name="EncryptionSecretKeyChecker" class="com.cloud.utils.crypt.EncryptionSecretKeyChecker"/>
|
||||
</system-integrity-checker>
|
||||
<dao name="VM Instance" class="com.cloud.vm.dao.VMInstanceDaoImpl"/>
|
||||
<dao name="User VM" class="com.cloud.vm.dao.UserVmDaoImpl"/>
|
||||
<dao name="ServiceOffering" class="com.cloud.service.dao.ServiceOfferingDaoImpl">
|
||||
<param name="cache.size">50</param>
|
||||
<param name="cache.time.to.live">-1</param>
|
||||
</dao>
|
||||
<dao name="Events" class="com.cloud.event.dao.EventDaoImpl"/>
|
||||
<dao name="UserStats" class="com.cloud.user.dao.UserStatisticsDaoImpl"/>
|
||||
<dao name="IP Addresses" class="com.cloud.network.dao.IPAddressDaoImpl"/>
|
||||
<dao name="Usage" class="com.cloud.usage.dao.UsageDaoImpl"/>
|
||||
<dao name="Domain" class="com.cloud.domain.dao.DomainDaoImpl"/>
|
||||
<dao name="Account" class="com.cloud.user.dao.AccountDaoImpl"/>
|
||||
<dao name="UserAccount" class="com.cloud.user.dao.UserAccountDaoImpl"/>
|
||||
<dao name="Usage VmInstance" class="com.cloud.usage.dao.UsageVMInstanceDaoImpl"/>
|
||||
<dao name="Usage Network" class="com.cloud.usage.dao.UsageNetworkDaoImpl"/>
|
||||
<dao name="Usage IPAddress" class="com.cloud.usage.dao.UsageIPAddressDaoImpl"/>
|
||||
<dao name="Usage Volume" class="com.cloud.usage.dao.UsageVolumeDaoImpl"/>
|
||||
<dao name="Usage Storage" class="com.cloud.usage.dao.UsageStorageDaoImpl"/>
|
||||
<dao name="Usage Load Balancer Policy" class="com.cloud.usage.dao.UsageLoadBalancerPolicyDaoImpl"/>
|
||||
<dao name="Usage Port Forwarding Rule" class="com.cloud.usage.dao.UsagePortForwardingRuleDaoImpl"/>
|
||||
<dao name="Usage Network Offering" class="com.cloud.usage.dao.UsageNetworkOfferingDaoImpl"/>
|
||||
<dao name="Usage VPN User" class="com.cloud.usage.dao.UsageVPNUserDaoImpl"/>
|
||||
<dao name="Usage Security Group" class="com.cloud.usage.dao.UsageSecurityGroupDaoImpl"/>
|
||||
<dao name="Usage Job" class="com.cloud.usage.dao.UsageJobDaoImpl"/>
|
||||
<dao name="Configuration" class="com.cloud.configuration.dao.ConfigurationDaoImpl"/>
|
||||
<dao name="Alert" class="com.cloud.alert.dao.AlertDaoImpl"/>
|
||||
<dao name="Usage Event" class="com.cloud.event.dao.UsageEventDaoImpl"/>
|
||||
<manager name="usage manager" class="com.cloud.usage.UsageManagerImpl">
|
||||
<param name="period">DAILY</param> <!-- DAILY, WEEKLY, MONTHLY; how often it creates usage records -->
|
||||
</manager>
|
||||
<manager name="Alert Manager" class="com.cloud.usage.UsageAlertManagerImpl">
|
||||
</manager>
|
||||
</usage-server>
|
||||
</components.xml>
|
||||
@ -31,11 +31,22 @@
|
||||
<artifactId>cloud-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${cs.mysql.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test</testSourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>resources</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -102,7 +113,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@ -38,17 +38,17 @@ public class UsageServer {
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
initLog4j();
|
||||
ApplicationContext appContext = new ClassPathXmlApplicationContext("usageApplicationContext.xml");
|
||||
|
||||
UsageServer usage = new UsageServer();
|
||||
usage.init(args);
|
||||
usage.start(appContext);
|
||||
usage.start();
|
||||
}
|
||||
|
||||
public void init(String[] args) {
|
||||
}
|
||||
|
||||
public void start(ApplicationContext appContext) {
|
||||
public void start() {
|
||||
ApplicationContext appContext = new ClassPathXmlApplicationContext("usageApplicationContext.xml");
|
||||
|
||||
try {
|
||||
ComponentContext.initComponentsLifeCycle();
|
||||
} catch(Exception e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user