mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
Removed schema from the dependency of many components
This commit is contained in:
parent
399c37345d
commit
a4cea4ebf2
@ -20,8 +20,15 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.cloud.utils.component.Adapter;
|
||||
import com.cloud.vm.ConsoleProxyVO;
|
||||
import com.cloud.vm.ConsoleProxy;
|
||||
|
||||
public interface ConsoleProxyAllocator extends Adapter {
|
||||
public ConsoleProxyVO allocProxy(List<ConsoleProxyVO> candidates, Map<Long, Integer> loadInfo, long dataCenterId);
|
||||
/**
|
||||
* Finds the least loaded console proxy.
|
||||
* @param candidates
|
||||
* @param loadInfo
|
||||
* @param dataCenterId
|
||||
* @return id of the console proxy to use or null if none.
|
||||
*/
|
||||
public Long allocProxy(List<? extends ConsoleProxy> candidates, Map<Long, Integer> loadInfo, long dataCenterId);
|
||||
}
|
||||
@ -71,7 +71,7 @@ under the License.
|
||||
<param name="SyslogHost" value="localhost"/>
|
||||
<param name="Facility" value="LOCAL6"/>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p [%c{1.}] (%t:%x) %m%n"/>
|
||||
<param name="ConversionPattern" value="%-5p [%c{3}] (%t:%x) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
@ -110,7 +110,7 @@ under the License.
|
||||
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Target" value="System.out"/>
|
||||
<param name="Threshold" value="INFO"/>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<layout class="org.apache.log4j.EnhancedPatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p [%c{1.}] (%t:%x) %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
19
core/pom.xml
19
core/pom.xml
@ -35,30 +35,17 @@
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-schema</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>${cs.httpclient.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<groupId>commons-codec</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>${cs.codec.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@ -20,17 +20,18 @@ import java.nio.ByteBuffer;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.cloudstack.storage.command.DownloadCommand;
|
||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Assert;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.apache.cloudstack.storage.command.DownloadCommand;
|
||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.GetHostStatsCommand;
|
||||
import com.cloud.agent.api.SecStorageFirewallCfgCommand;
|
||||
import com.cloud.agent.api.SecStorageSetupCommand;
|
||||
import com.cloud.agent.api.UpdateHostPasswordCommand;
|
||||
import com.cloud.agent.api.storage.DownloadAnswer;
|
||||
import com.cloud.agent.api.storage.ListTemplateCommand;
|
||||
@ -38,11 +39,11 @@ import com.cloud.agent.api.to.NfsTO;
|
||||
import com.cloud.exception.UnsupportedVersionException;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.serializer.GsonHelper;
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.storage.Storage.TemplateType;
|
||||
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.template.VirtualMachineTemplate;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -165,8 +166,15 @@ public class RequestTest extends TestCase {
|
||||
|
||||
public void testDownload() {
|
||||
s_logger.info("Testing Download answer");
|
||||
VMTemplateVO template = new VMTemplateVO(1, "templatename", ImageFormat.QCOW2, true, true, true, TemplateType.USER, "url", true, 32, 1, "chksum", "displayText", true, 30, true,
|
||||
HypervisorType.KVM, null);
|
||||
VirtualMachineTemplate template = Mockito.mock(VirtualMachineTemplate.class);
|
||||
Mockito.when(template.getId()).thenReturn(1L);
|
||||
Mockito.when(template.getFormat()).thenReturn(ImageFormat.QCOW2);
|
||||
Mockito.when(template.getName()).thenReturn("templatename");
|
||||
Mockito.when(template.getTemplateType()).thenReturn(TemplateType.USER);
|
||||
Mockito.when(template.getDisplayText()).thenReturn("displayText");
|
||||
Mockito.when(template.getHypervisorType()).thenReturn(HypervisorType.KVM);
|
||||
Mockito.when(template.getUrl()).thenReturn("url");
|
||||
|
||||
NfsTO nfs = new NfsTO("secUrl", DataStoreRole.Image);
|
||||
TemplateObjectTO to = new TemplateObjectTO(template);
|
||||
to.setImageDataStore(nfs);
|
||||
|
||||
20
engine/storage/cache/pom.xml
vendored
20
engine/storage/cache/pom.xml
vendored
@ -1,13 +1,12 @@
|
||||
<!-- 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. -->
|
||||
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. -->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
@ -20,6 +19,11 @@
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-schema</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-storage</artifactId>
|
||||
|
||||
18
pom.xml
18
pom.xml
@ -180,7 +180,7 @@
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${cs.mysql.version}</version>
|
||||
<scope>provided</scope>
|
||||
<scope>provided,test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
@ -275,12 +275,6 @@
|
||||
<version>${cs.configuration.version}</version>
|
||||
</dependency>
|
||||
<!-- Test dependency in mysql for db tests -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${cs.mysql.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
@ -297,11 +291,11 @@
|
||||
<artifactId>esapi</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.persistence</groupId>
|
||||
<artifactId>javax.persistence</artifactId>
|
||||
<version>${cs.jpa.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.persistence</groupId>
|
||||
<artifactId>javax.persistence</artifactId>
|
||||
<version>${cs.jpa.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
@ -101,6 +101,11 @@
|
||||
<artifactId>cloud-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-schema</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-ipc</artifactId>
|
||||
|
||||
@ -26,7 +26,7 @@ import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
import com.cloud.vm.ConsoleProxyVO;
|
||||
import com.cloud.vm.ConsoleProxy;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
@ -36,40 +36,32 @@ public class ConsoleProxyBalanceAllocator extends AdapterBase implements Console
|
||||
private final Random _rand = new Random(System.currentTimeMillis());
|
||||
|
||||
@Override
|
||||
public ConsoleProxyVO allocProxy(List<ConsoleProxyVO> candidates, final Map<Long, Integer> loadInfo, long dataCenterId) {
|
||||
if(candidates != null) {
|
||||
public Long allocProxy(List<? extends ConsoleProxy> candidates, final Map<Long, Integer> loadInfo, long dataCenterId) {
|
||||
List<ConsoleProxy> allocationList = new ArrayList<ConsoleProxy>(candidates);
|
||||
|
||||
List<ConsoleProxyVO> allocationList = new ArrayList<ConsoleProxyVO>();
|
||||
for(ConsoleProxyVO proxy : candidates) {
|
||||
allocationList.add(proxy);
|
||||
}
|
||||
Collections.sort(candidates, new Comparator<ConsoleProxy>() {
|
||||
@Override
|
||||
public int compare(ConsoleProxy x, ConsoleProxy y) {
|
||||
Integer loadOfX = loadInfo.get(x.getId());
|
||||
Integer loadOfY = loadInfo.get(y.getId());
|
||||
|
||||
Collections.sort(candidates, new Comparator<ConsoleProxyVO> () {
|
||||
@Override
|
||||
public int compare(ConsoleProxyVO x, ConsoleProxyVO y) {
|
||||
Integer loadOfX = loadInfo.get(x.getId());
|
||||
Integer loadOfY = loadInfo.get(y.getId());
|
||||
|
||||
if(loadOfX != null && loadOfY != null) {
|
||||
if(loadOfX < loadOfY)
|
||||
return -1;
|
||||
else if(loadOfX > loadOfY)
|
||||
return 1;
|
||||
return 0;
|
||||
} else if(loadOfX == null && loadOfY == null) {
|
||||
return 0;
|
||||
} else {
|
||||
if(loadOfX == null)
|
||||
return -1;
|
||||
if (loadOfX != null && loadOfY != null) {
|
||||
if (loadOfX < loadOfY)
|
||||
return -1;
|
||||
else if (loadOfX > loadOfY)
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
} else if (loadOfX == null && loadOfY == null) {
|
||||
return 0;
|
||||
} else {
|
||||
if (loadOfX == null)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if(allocationList.size() > 0)
|
||||
return allocationList.get(0);
|
||||
}
|
||||
return null;
|
||||
return (allocationList.size() > 0) ? allocationList.get(0).getId() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -619,7 +619,12 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
}
|
||||
}
|
||||
}
|
||||
return allocator.allocProxy(runningList, loadInfo, dataCenterId);
|
||||
Long allocated = allocator.allocProxy(runningList, loadInfo, dataCenterId);
|
||||
if (allocated == null) {
|
||||
s_logger.debug("Unable to find a console proxy ");
|
||||
return null;
|
||||
}
|
||||
return _consoleProxyDao.findById(allocated);
|
||||
} else {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
s_logger.trace("Empty running proxy pool for now in data center : " + dataCenterId);
|
||||
|
||||
@ -38,6 +38,11 @@
|
||||
<artifactId>cloud-server</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-schema</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user