You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2013/02/03 17:56:34 UTC

git commit: refs/heads/master - Summary: Fixup usage server for packaging

Updated Branches:
  refs/heads/master 195c6c15f -> 7ce03b4f8


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


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

Branch: refs/heads/master
Commit: 7ce03b4f8ea116ee666dc2f0d8d23546415c5f04
Parents: 195c6c1
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Sun Feb 3 17:49:18 2013 +0100
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Sun Feb 3 17:49:18 2013 +0100

----------------------------------------------------------------------
 packaging/centos63/cloud-usage.rc           |    8 +-
 packaging/centos63/cloud.spec               |   18 +++--
 usage/conf/usage-components.xml.in          |   80 ----------------------
 usage/conf/usageApplicationContext.xml.in   |   53 --------------
 usage/pom.xml                               |   12 +++-
 usage/resources/usageApplicationContext.xml |   53 ++++++++++++++
 usage/src/com/cloud/usage/UsageServer.java  |    8 +-
 7 files changed, 82 insertions(+), 150 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7ce03b4f/packaging/centos63/cloud-usage.rc
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud-usage.rc b/packaging/centos63/cloud-usage.rc
index 9aa01ea..8bee5ae 100755
--- a/packaging/centos63/cloud-usage.rc
+++ b/packaging/centos63/cloud-usage.rc
@@ -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

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7ce03b4f/packaging/centos63/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec
index 8587bf7..2b029e3 100644
--- a/packaging/centos63/cloud.spec
+++ b/packaging/centos63/cloud.spec
@@ -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
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7ce03b4f/usage/conf/usage-components.xml.in
----------------------------------------------------------------------
diff --git a/usage/conf/usage-components.xml.in b/usage/conf/usage-components.xml.in
deleted file mode 100644
index d9e2221..0000000
--- a/usage/conf/usage-components.xml.in
+++ /dev/null
@@ -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>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7ce03b4f/usage/conf/usageApplicationContext.xml.in
----------------------------------------------------------------------
diff --git a/usage/conf/usageApplicationContext.xml.in b/usage/conf/usageApplicationContext.xml.in
deleted file mode 100644
index 32da93e..0000000
--- a/usage/conf/usageApplicationContext.xml.in
+++ /dev/null
@@ -1,53 +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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-  xmlns:context="http://www.springframework.org/schema/context"
-  xmlns:tx="http://www.springframework.org/schema/tx" 
-  xmlns:aop="http://www.springframework.org/schema/aop"
-  xsi:schemaLocation="http://www.springframework.org/schema/beans
-                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
-                      http://www.springframework.org/schema/tx 
-                      http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
-                      http://www.springframework.org/schema/aop
-                      http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
-                      http://www.springframework.org/schema/context
-                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">                     
-
-  <context:annotation-config />
-  <context:component-scan base-package="com.cloud.usage" />
-  
-  <!--
-    @DB support
-  -->
-  <aop:config proxy-target-class="true">
-    <aop:aspect id="dbContextBuilder" ref="transactionContextBuilder">
-        <aop:pointcut id="captureAnyMethod"
-            expression="execution(* *(..))" 
-        />
-        <aop:around pointcut-ref="captureAnyMethod" method="AroundAnyMethod"/> 
-    </aop:aspect>
-
-  </aop:config>
-  
-  <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" />
-  <bean id="ComponentContext" class="com.cloud.utils.component.ComponentContext" />
-  <bean id="UsageServerConfig" class="com.cloud.usage.UsageServerComponentConfig" />
- 
-</beans>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7ce03b4f/usage/pom.xml
----------------------------------------------------------------------
diff --git a/usage/pom.xml b/usage/pom.xml
index 9ecd6e1..bbd0d45 100644
--- a/usage/pom.xml
+++ b/usage/pom.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>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7ce03b4f/usage/resources/usageApplicationContext.xml
----------------------------------------------------------------------
diff --git a/usage/resources/usageApplicationContext.xml b/usage/resources/usageApplicationContext.xml
new file mode 100644
index 0000000..32da93e
--- /dev/null
+++ b/usage/resources/usageApplicationContext.xml
@@ -0,0 +1,53 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xmlns:context="http://www.springframework.org/schema/context"
+  xmlns:tx="http://www.springframework.org/schema/tx" 
+  xmlns:aop="http://www.springframework.org/schema/aop"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/tx 
+                      http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+                      http://www.springframework.org/schema/aop
+                      http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">                     
+
+  <context:annotation-config />
+  <context:component-scan base-package="com.cloud.usage" />
+  
+  <!--
+    @DB support
+  -->
+  <aop:config proxy-target-class="true">
+    <aop:aspect id="dbContextBuilder" ref="transactionContextBuilder">
+        <aop:pointcut id="captureAnyMethod"
+            expression="execution(* *(..))" 
+        />
+        <aop:around pointcut-ref="captureAnyMethod" method="AroundAnyMethod"/> 
+    </aop:aspect>
+
+  </aop:config>
+  
+  <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" />
+  <bean id="ComponentContext" class="com.cloud.utils.component.ComponentContext" />
+  <bean id="UsageServerConfig" class="com.cloud.usage.UsageServerComponentConfig" />
+ 
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7ce03b4f/usage/src/com/cloud/usage/UsageServer.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/UsageServer.java b/usage/src/com/cloud/usage/UsageServer.java
index ce87b88..881962f 100644
--- a/usage/src/com/cloud/usage/UsageServer.java
+++ b/usage/src/com/cloud/usage/UsageServer.java
@@ -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) {