From 3d2e49bcfce6c2e97cfea85e3ae4ef5cb3ed28f3 Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Fri, 26 Jul 2013 20:35:24 -0700 Subject: [PATCH] Changed the log4j config files to log org.apache.cloudstack in debug and change the layout format --- client/tomcatconf/log4j-cloud.xml.in | 14 ++- framework/db/pom.xml | 14 ++- plugins/hypervisors/kvm/pom.xml | 19 +-- .../resource/LibvirtComputingResource.java | 29 ++--- pom.xml | 117 +++++++++++++++++- server/conf/log4j-cloud.xml.in | 12 +- utils/pom.xml | 44 +------ .../cloud/utils/storage/encoding/Decoder.java | 2 +- .../com/cloud/utils/xmlobject/XmlObject.java | 5 +- 9 files changed, 173 insertions(+), 83 deletions(-) diff --git a/client/tomcatconf/log4j-cloud.xml.in b/client/tomcatconf/log4j-cloud.xml.in index 503ba8e76a1..1207aa7a8f3 100755 --- a/client/tomcatconf/log4j-cloud.xml.in +++ b/client/tomcatconf/log4j-cloud.xml.in @@ -35,7 +35,7 @@ under the License. - + @@ -47,7 +47,7 @@ under the License. - + @@ -59,7 +59,7 @@ under the License. - + @@ -71,7 +71,7 @@ under the License. - + @@ -111,7 +111,7 @@ under the License. - + @@ -123,6 +123,10 @@ under the License. + + + + diff --git a/framework/db/pom.xml b/framework/db/pom.xml index c23f96fc2c4..12e2078bda0 100644 --- a/framework/db/pom.xml +++ b/framework/db/pom.xml @@ -22,12 +22,22 @@ javax.ejb ejb-api - ${cs.ejb.version} + + + net.sf.ehcache + ehcache org.eclipse.persistence javax.persistence - ${cs.jpa.version} + + + commons-dbcp + commons-dbcp + + + commons-pool + commons-pool org.apache.cloudstack diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml index 1babe7cbf56..19e5458b618 100644 --- a/plugins/hypervisors/kvm/pom.xml +++ b/plugins/hypervisors/kvm/pom.xml @@ -1,13 +1,12 @@ + 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. --> 4.0.0 @@ -30,6 +29,10 @@ + + commons-io + commons-io + org.apache.cloudstack cloud-agent diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 571bcc8cd7e..bfa0b7ecd72 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -50,21 +50,12 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.ejb.Local; import javax.naming.ConfigurationException; -import org.apache.cloudstack.storage.command.StorageSubSystemCommand; -import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; -import org.apache.cloudstack.storage.to.VolumeObjectTO; -import org.apache.cloudstack.utils.qemu.QemuImg; -import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; -import org.apache.cloudstack.utils.qemu.QemuImgException; -import org.apache.cloudstack.utils.qemu.QemuImgFile; -import org.apache.log4j.Logger; import org.apache.commons.io.FileUtils; +import org.apache.log4j.Logger; import org.libvirt.Connect; import org.libvirt.Domain; import org.libvirt.DomainBlockStats; @@ -74,6 +65,14 @@ import org.libvirt.DomainSnapshot; import org.libvirt.LibvirtException; import org.libvirt.NodeInfo; +import org.apache.cloudstack.storage.command.StorageSubSystemCommand; +import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; +import org.apache.cloudstack.storage.to.VolumeObjectTO; +import org.apache.cloudstack.utils.qemu.QemuImg; +import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat; +import org.apache.cloudstack.utils.qemu.QemuImgException; +import org.apache.cloudstack.utils.qemu.QemuImgFile; + import com.cloud.agent.api.Answer; import com.cloud.agent.api.AttachIsoCommand; import com.cloud.agent.api.AttachVolumeAnswer; @@ -202,7 +201,6 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GuestDef; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GuestResourceDef; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InputDef; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef; -import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.hostNicType; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.VirtioSerialDef; @@ -240,7 +238,6 @@ import com.cloud.utils.script.Script; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.State; -import com.cloud.vm.VirtualMachineName; /** * LibvirtComputingResource execute requests on the computing/routing host using @@ -843,7 +840,7 @@ ServerResource { configureVifDrivers(params); - KVMStorageProcessor storageProcessor = new KVMStorageProcessor(this._storagePoolMgr, this); + KVMStorageProcessor storageProcessor = new KVMStorageProcessor(_storagePoolMgr, this); storageProcessor.configure(name, params); storageHandler = new StorageSubsystemCommandHandlerBase(storageProcessor); @@ -1254,7 +1251,7 @@ ServerResource { } else if (cmd instanceof NetworkRulesVmSecondaryIpCommand) { return execute((NetworkRulesVmSecondaryIpCommand) cmd); } else if (cmd instanceof StorageSubSystemCommand) { - return this.storageHandler.handleStorageCommands((StorageSubSystemCommand)cmd); + return storageHandler.handleStorageCommands((StorageSubSystemCommand)cmd); } else if (cmd instanceof PvlanSetupCommand) { return execute((PvlanSetupCommand) cmd); } else { @@ -3179,8 +3176,8 @@ ServerResource { if (vmTO.getMinRam() != vmTO.getMaxRam()){ grd.setMemBalloning(true); - grd.setCurrentMem((long)vmTO.getMinRam()/1024); - grd.setMemorySize((long)vmTO.getMaxRam()/1024); + grd.setCurrentMem(vmTO.getMinRam()/1024); + grd.setMemorySize(vmTO.getMaxRam()/1024); } else{ grd.setMemorySize(vmTO.getMaxRam() / 1024); diff --git a/pom.xml b/pom.xml index 6296f378cd0..60dd9f79c7d 100644 --- a/pom.xml +++ b/pom.xml @@ -187,6 +187,121 @@ log4j ${cs.log4j.version} + + org.springframework + spring-context + ${org.springframework.version} + + + cglib + cglib-nodep + ${cs.cglib.version} + + + commons-dbcp + commons-dbcp + ${cs.dbcp.version} + + + commons-pool + commons-pool + + + + + net.sf.ehcache + ehcache + ${cs.ehcache.version} + + + commons-pool + commons-pool + ${cs.pool.version} + + + commons-codec + commons-codec + ${cs.codec.version} + + + org.bouncycastle + bcprov-jdk16 + ${cs.bcprov.version} + + + com.jcraft + jsch + ${cs.jsch.version} + + + org.jasypt + jasypt + ${cs.jasypt.version} + + + com.trilead + trilead-ssh2 + ${cs.trilead.version} + + + com.amazonaws + aws-java-sdk + ${cs.aws.sdk.version} + + + log4j + apache-log4j-extras + ${cs.log4j.extras.version} + + + log4j + log4j + + + + + javax.ejb + ejb-api + ${cs.ejb.version} + + + com.googlecode.java-ipv6 + java-ipv6 + ${cs.java-ipv6.version} + + + commons-configuration + commons-configuration + ${cs.configuration.version} + + + + mysql + mysql-connector-java + ${cs.mysql.version} + test + + + commons-io + commons-io + ${cs.commons-io.version} + provided + + + org.reflections + reflections + ${cs.reflections.version} + + + org.owasp.esapi + esapi + 2.0.1 + + + org.eclipse.persistence + javax.persistence + ${cs.jpa.version} + @@ -245,7 +360,7 @@ true - target + ${cs.target.dir} **/* diff --git a/server/conf/log4j-cloud.xml.in b/server/conf/log4j-cloud.xml.in index 939b46d7488..3b4bff106d1 100755 --- a/server/conf/log4j-cloud.xml.in +++ b/server/conf/log4j-cloud.xml.in @@ -34,7 +34,7 @@ under the License. - + @@ -46,7 +46,7 @@ under the License. - + @@ -59,7 +59,7 @@ under the License. - + @@ -71,7 +71,7 @@ under the License. - + @@ -83,6 +83,10 @@ under the License. + + + diff --git a/utils/pom.xml b/utils/pom.xml index cb18fc226a1..06a0518e80b 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -30,7 +30,6 @@ org.springframework spring-context - ${org.springframework.version} log4j @@ -39,107 +38,66 @@ cglib cglib-nodep - ${cs.cglib.version} - - - commons-dbcp - commons-dbcp - ${cs.dbcp.version} - - - commons-pool - commons-pool - - - - - net.sf.ehcache - ehcache - ${cs.ehcache.version} - - - commons-pool - commons-pool - ${cs.pool.version} commons-codec commons-codec - ${cs.codec.version} org.bouncycastle bcprov-jdk16 - ${cs.bcprov.version} com.jcraft jsch - ${cs.jsch.version} org.jasypt jasypt - ${cs.jasypt.version} com.trilead trilead-ssh2 - ${cs.trilead.version} com.amazonaws aws-java-sdk - ${cs.aws.sdk.version} log4j apache-log4j-extras - ${cs.log4j.extras.version} - - - log4j - log4j - - + runtime javax.ejb ejb-api - ${cs.ejb.version} com.googlecode.java-ipv6 java-ipv6 - ${cs.java-ipv6.version} commons-configuration commons-configuration - ${cs.configuration.version} mysql mysql-connector-java - ${cs.mysql.version} test commons-io commons-io - ${cs.commons-io.version} provided org.reflections reflections - ${cs.reflections.version} org.owasp.esapi esapi - 2.0.1 diff --git a/utils/src/com/cloud/utils/storage/encoding/Decoder.java b/utils/src/com/cloud/utils/storage/encoding/Decoder.java index fe74a04022b..8519287ae53 100644 --- a/utils/src/com/cloud/utils/storage/encoding/Decoder.java +++ b/utils/src/com/cloud/utils/storage/encoding/Decoder.java @@ -20,11 +20,11 @@ package com.cloud.utils.storage.encoding; import java.net.URI; import java.net.URISyntaxException; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; -import edu.emory.mathcs.backport.java.util.Arrays; public class Decoder { private static Map getParameters(URI uri) { diff --git a/utils/src/com/cloud/utils/xmlobject/XmlObject.java b/utils/src/com/cloud/utils/xmlobject/XmlObject.java index 789a74dbb8e..b67eb9ca2c8 100755 --- a/utils/src/com/cloud/utils/xmlobject/XmlObject.java +++ b/utils/src/com/cloud/utils/xmlobject/XmlObject.java @@ -19,6 +19,7 @@ package com.cloud.utils.xmlobject; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -26,10 +27,8 @@ import java.util.Map; import com.cloud.utils.exception.CloudRuntimeException; -import edu.emory.mathcs.backport.java.util.Collections; - public class XmlObject { - private Map elements = new HashMap(); + private final Map elements = new HashMap(); private String text; private String tag;