mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Reverting the range of commits that broke the build
This reverts commits 30c33415..f6a2c817bc Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
a4400721bd
commit
b59e3aaefc
@ -1,84 +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.
|
||||
package org.apache.cloudstack.config;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Configuration represents one global configuration parameter for CloudStack.
|
||||
* Its scope should indicate whether this parameter can be set at different
|
||||
* organization levels in CloudStack.
|
||||
*
|
||||
*/
|
||||
public interface Configuration {
|
||||
|
||||
/**
|
||||
* @return Category of the parameter.
|
||||
*/
|
||||
String getCategory();
|
||||
|
||||
/**
|
||||
* @return Server instance that uses this parameter.
|
||||
*/
|
||||
String getInstance();
|
||||
|
||||
/**
|
||||
* @return Component that introduced this parameter.
|
||||
*/
|
||||
String getComponent();
|
||||
|
||||
/**
|
||||
* @return Name of the parameter.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return Value set by the administrator. Defaults to the defaultValue.
|
||||
*/
|
||||
String getValue();
|
||||
|
||||
/**
|
||||
* @return Description of the value and the range of the value.
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* @return Default value for this parameter. Null indicates this parameter is optional.
|
||||
*/
|
||||
String getDefaultValue();
|
||||
|
||||
/**
|
||||
* @return Scope for the parameter. Null indicates that this parameter is
|
||||
* always global. A non-null value indicates that this parameter can be
|
||||
* set at a certain organization level.
|
||||
*/
|
||||
String getScope();
|
||||
|
||||
/**
|
||||
* @return can the configuration parameter be changed without restarting the server.
|
||||
*/
|
||||
boolean isDynamic();
|
||||
|
||||
/**
|
||||
* @return The date this VO was updated by the components. Note that this is not
|
||||
* a date for when an administrator updates the value. This is when the system
|
||||
* updated this value. By searching on this field gives you all the config
|
||||
* parameters that have changed in an upgrade. Null value indicates that this
|
||||
* parameter is no longer used and can be deleted.
|
||||
*/
|
||||
Date getUpdated();
|
||||
}
|
||||
@ -16,26 +16,25 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.resource.ResourceService;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
public class AddClusterCmdTest extends TestCase {
|
||||
|
||||
private AddClusterCmd addClusterCmd;
|
||||
@ -45,7 +44,6 @@ public class AddClusterCmdTest extends TestCase {
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() {
|
||||
/*
|
||||
@ -112,7 +110,8 @@ public class AddClusterCmdTest extends TestCase {
|
||||
Cluster cluster = Mockito.mock(Cluster.class);
|
||||
Cluster[] clusterArray = new Cluster[] { cluster };
|
||||
|
||||
Mockito.doReturn(Arrays.asList(clusterArray)).when(resourceService).discoverCluster(addClusterCmd);
|
||||
Mockito.when(resourceService.discoverCluster(addClusterCmd))
|
||||
.thenReturn(Arrays.asList(clusterArray));
|
||||
|
||||
addClusterCmd.execute();
|
||||
|
||||
|
||||
@ -16,28 +16,27 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import junit.framework.Assert;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.resource.ResourceService;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
public class AddHostCmdTest extends TestCase {
|
||||
|
||||
private AddHostCmd addHostCmd;
|
||||
@ -47,7 +46,6 @@ public class AddHostCmdTest extends TestCase {
|
||||
@Rule
|
||||
public ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() {
|
||||
resourceService = Mockito.mock(ResourceService.class);
|
||||
@ -127,12 +125,14 @@ public class AddHostCmdTest extends TestCase {
|
||||
|
||||
HostResponse responseHost = new HostResponse();
|
||||
responseHost.setName("Test");
|
||||
Mockito.doReturn(Arrays.asList(mockArray)).when(resourceService).discoverHosts(addHostCmd);
|
||||
Mockito.when(responseGenerator.createHostResponse(host)).thenReturn(responseHost);
|
||||
Mockito.when(resourceService.discoverHosts(addHostCmd)).thenReturn(
|
||||
Arrays.asList(mockArray));
|
||||
Mockito.when(responseGenerator.createHostResponse(host)).thenReturn(
|
||||
responseHost);
|
||||
addHostCmd.execute();
|
||||
Mockito.verify(responseGenerator).createHostResponse(host);
|
||||
@SuppressWarnings("unchecked")
|
||||
ListResponse<HostResponse> actualResponse = ((ListResponse<HostResponse>)addHostCmd.getResponseObject());
|
||||
ListResponse<HostResponse> actualResponse = ((ListResponse<HostResponse>) addHostCmd
|
||||
.getResponseObject());
|
||||
Assert.assertEquals(responseHost, actualResponse.getResponses().get(0));
|
||||
Assert.assertEquals("addhostresponse", actualResponse.getResponseName());
|
||||
|
||||
@ -144,7 +144,8 @@ public class AddHostCmdTest extends TestCase {
|
||||
addHostCmd._resourceService = resourceService;
|
||||
|
||||
try {
|
||||
Mockito.when(resourceService.discoverHosts(addHostCmd)).thenThrow(DiscoveryException.class);
|
||||
Mockito.when(resourceService.discoverHosts(addHostCmd)).thenThrow(
|
||||
DiscoveryException.class);
|
||||
} catch (InvalidParameterValueException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
||||
@ -195,6 +195,13 @@
|
||||
<artifactId>cloud-engine-components-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-compute</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-network</artifactId>
|
||||
|
||||
@ -81,7 +81,6 @@
|
||||
</bean>
|
||||
|
||||
<bean id="messageBus" class = "org.apache.cloudstack.framework.messagebus.MessageBusBase" />
|
||||
<bean id="configDepot" class = "org.apache.cloudstack.framework.config.ConfigDepotImpl" />
|
||||
|
||||
<!--
|
||||
DAO with customized configuration
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
-->
|
||||
|
||||
<bean id="databaseUpgradeChecker" class="com.cloud.upgrade.DatabaseUpgradeChecker" />
|
||||
<bean id="configurationDaoImpl" class="org.apache.cloudstack.framework.config.dao.ConfigurationDaoImpl" />
|
||||
<bean id="configurationDaoImpl" class="com.cloud.configuration.dao.ConfigurationDaoImpl" />
|
||||
<bean id="GlobalLoadBalancingRulesServiceImpl" class ="org.apache.cloudstack.region.gslb.GlobalLoadBalancingRulesServiceImpl" />
|
||||
|
||||
<!--
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
<!--
|
||||
DAO with customized configuration under non-OSS deployment
|
||||
-->
|
||||
<bean id="configurationDaoImpl" class="org.apache.cloudstack.framework.config.dao.ConfigurationDaoImpl">
|
||||
<bean id="configurationDaoImpl" class="com.cloud.configuration.dao.ConfigurationDaoImpl">
|
||||
<property name="configParams">
|
||||
<map>
|
||||
<entry key="premium" value="true" />
|
||||
|
||||
52
engine/compute/pom.xml
Normal file
52
engine/compute/pom.xml
Normal file
@ -0,0 +1,52 @@
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<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>
|
||||
<artifactId>cloud-engine-compute</artifactId>
|
||||
<name>Apache CloudStack Cloud Engine Compute Component</name>
|
||||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine</artifactId>
|
||||
<version>4.3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-ipc</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-components-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test</testSourceDirectory>
|
||||
</build>
|
||||
</project>
|
||||
34
engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java
Executable file
34
engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java
Executable file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.cloudstack.compute;
|
||||
|
||||
import java.util.logging.Handler;
|
||||
|
||||
public interface ComputeOrchestrator {
|
||||
/**
|
||||
* start the vm
|
||||
* @param vm vm
|
||||
* @param reservationId
|
||||
*/
|
||||
void start(String vm, String reservationId, Handler handler);
|
||||
|
||||
void cancel(String reservationId);
|
||||
|
||||
void stop(String vm, String reservationId);
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.cloudstack.compute;
|
||||
|
||||
import java.util.logging.Handler;
|
||||
|
||||
|
||||
public class ComputeOrchestratorImpl implements ComputeOrchestrator {
|
||||
|
||||
@Override
|
||||
public void cancel(String reservationId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(String vm, String reservationId) {
|
||||
// Retrieve the VM
|
||||
// Locate the HypervisorGuru based on the VM type
|
||||
// Call HypervisorGuru to stop the VM
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(String vm, String reservationId, Handler handler) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
36
engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java
Executable file
36
engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java
Executable file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
package org.apache.cloudstack.platform.planning;
|
||||
|
||||
import org.apache.cloudstack.framework.ipc.Ipc;
|
||||
|
||||
public interface Concierge {
|
||||
@Ipc(topic="cs.concierge.reserve")
|
||||
String reserve(String vm, String planner, Long until);
|
||||
|
||||
@Ipc(topic="cs.concierge.cancel")
|
||||
String cancel(String reservationId);
|
||||
|
||||
@Ipc(topic="cs.concierge.claim")
|
||||
String claim(String reservationId);
|
||||
|
||||
@Ipc(topic="cs.concierge.reserveAnother")
|
||||
String reserveAnother(String reservationId);
|
||||
|
||||
}
|
||||
@ -32,6 +32,7 @@
|
||||
</build>
|
||||
<modules>
|
||||
<module>api</module>
|
||||
<module>compute</module>
|
||||
<module>orchestration</module>
|
||||
<module>storage</module>
|
||||
<module>storage/volume</module>
|
||||
|
||||
109
engine/schema/src/com/cloud/configuration/ConfigurationVO.java
Normal file
109
engine/schema/src/com/cloud/configuration/ConfigurationVO.java
Normal file
@ -0,0 +1,109 @@
|
||||
// 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.
|
||||
package com.cloud.configuration;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.cloudstack.config.Configuration;
|
||||
|
||||
import com.cloud.utils.crypt.DBEncryptionUtil;
|
||||
|
||||
@Entity
|
||||
@Table(name="configuration")
|
||||
public class ConfigurationVO implements Configuration{
|
||||
@Column(name="instance")
|
||||
private String instance;
|
||||
|
||||
@Column(name="component")
|
||||
private String component;
|
||||
|
||||
@Id
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
|
||||
@Column(name="value", length=4095)
|
||||
private String value;
|
||||
|
||||
@Column(name="description", length=1024)
|
||||
private String description;
|
||||
|
||||
@Column(name="category")
|
||||
private String category;
|
||||
|
||||
protected ConfigurationVO() {}
|
||||
|
||||
public ConfigurationVO(String category, String instance, String component, String name, String value, String description) {
|
||||
this.category = category;
|
||||
this.instance = instance;
|
||||
this.component = component;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void setInstance(String instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
public String getComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(String component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return (("Hidden".equals(getCategory()) || "Secure".equals(getCategory())) ? DBEncryptionUtil.decrypt(value) : value);
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
||||
@ -14,57 +14,56 @@
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.framework.config.dao;
|
||||
package com.cloud.configuration.dao;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigurationVO;
|
||||
|
||||
import com.cloud.configuration.ConfigurationVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface ConfigurationDao extends GenericDao<ConfigurationVO, String> {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* 1. params passed in.
|
||||
* 2. configuration for the instance.
|
||||
* 3. configuration for the DEFAULT instance.
|
||||
*
|
||||
*
|
||||
* @param params parameters from the components.xml which will override the database values.
|
||||
* @return a consolidated look at the configuration parameters.
|
||||
*/
|
||||
public Map<String, String> getConfiguration(String instance, Map<String, ? extends Object> params);
|
||||
|
||||
|
||||
public Map<String, String> getConfiguration(Map<String, ? extends Object> params);
|
||||
|
||||
|
||||
public Map<String, String> getConfiguration();
|
||||
|
||||
|
||||
/**
|
||||
* Updates a configuration value
|
||||
* @param value the new value
|
||||
* @return true if success, false if failure
|
||||
*/
|
||||
public boolean update(String name, String value);
|
||||
|
||||
|
||||
/**
|
||||
* Gets the value for the specified configuration name
|
||||
* @return value
|
||||
*/
|
||||
public String getValue(String name);
|
||||
|
||||
|
||||
public String getValueAndInitIfNotExist(String name, String category, String initValue);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* returns whether or not this is a premium configuration
|
||||
* @return true if premium configuration, false otherwise
|
||||
*/
|
||||
boolean isPremium();
|
||||
|
||||
|
||||
ConfigurationVO findByName(String name);
|
||||
|
||||
boolean update(String name, String category, String value);
|
||||
|
||||
|
||||
void invalidateCache();
|
||||
}
|
||||
@ -14,7 +14,7 @@
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.framework.config.dao;
|
||||
package com.cloud.configuration.dao;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -29,8 +29,7 @@ import javax.naming.ConfigurationException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigurationVO;
|
||||
|
||||
import com.cloud.configuration.ConfigurationVO;
|
||||
import com.cloud.utils.component.ComponentLifecycle;
|
||||
import com.cloud.utils.crypt.DBEncryptionUtil;
|
||||
import com.cloud.utils.db.DB;
|
||||
@ -49,13 +48,13 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||
|
||||
final SearchBuilder<ConfigurationVO> InstanceSearch;
|
||||
final SearchBuilder<ConfigurationVO> NameSearch;
|
||||
|
||||
|
||||
public static final String UPDATE_CONFIGURATION_SQL = "UPDATE configuration SET value = ? WHERE name = ?";
|
||||
|
||||
public ConfigurationDaoImpl () {
|
||||
InstanceSearch = createSearchBuilder();
|
||||
InstanceSearch.and("instance", InstanceSearch.entity().getInstance(), SearchCriteria.Op.EQ);
|
||||
|
||||
|
||||
NameSearch = createSearchBuilder();
|
||||
NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||
setRunLevel(ComponentLifecycle.RUN_LEVEL_SYSTEM_BOOTSTRAP);
|
||||
@ -65,10 +64,10 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||
public boolean isPremium() {
|
||||
return _premium;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void invalidateCache() {
|
||||
_configs = null;
|
||||
_configs = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -82,21 +81,21 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||
List<ConfigurationVO> configurations = listIncludingRemovedBy(sc);
|
||||
|
||||
for (ConfigurationVO config : configurations) {
|
||||
if (config.getValue() != null)
|
||||
_configs.put(config.getName(), config.getValue());
|
||||
if (config.getValue() != null)
|
||||
_configs.put(config.getName(), config.getValue());
|
||||
}
|
||||
|
||||
if(!"DEFAULT".equals(instance)){
|
||||
//Default instance params are already added, need not add again
|
||||
sc = InstanceSearch.create();
|
||||
sc.setParameters("instance", instance);
|
||||
//Default instance params are already added, need not add again
|
||||
sc = InstanceSearch.create();
|
||||
sc.setParameters("instance", instance);
|
||||
|
||||
configurations = listIncludingRemovedBy(sc);
|
||||
configurations = listIncludingRemovedBy(sc);
|
||||
|
||||
for (ConfigurationVO config : configurations) {
|
||||
if (config.getValue() != null)
|
||||
_configs.put(config.getName(), config.getValue());
|
||||
}
|
||||
for (ConfigurationVO config : configurations) {
|
||||
if (config.getValue() != null)
|
||||
_configs.put(config.getName(), config.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -109,12 +108,12 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||
public Map<String, String> getConfiguration(Map<String, ? extends Object> params) {
|
||||
return getConfiguration("DEFAULT", params);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, String> getConfiguration() {
|
||||
return getConfiguration("DEFAULT", new HashMap<String, Object>());
|
||||
}
|
||||
|
||||
|
||||
protected void mergeConfigs(Map<String, String> dbParams, Map<String, ? extends Object> xmlParams) {
|
||||
for (Map.Entry<String, ? extends Object> param : xmlParams.entrySet()) {
|
||||
dbParams.put(param.getKey(), (String)param.getValue());
|
||||
@ -123,9 +122,9 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
super.configure(name, params);
|
||||
super.configure(name, params);
|
||||
|
||||
Object premium = params.get("premium");
|
||||
Object premium = params.get("premium");
|
||||
_premium = (premium != null) && ((String) premium).equals("true");
|
||||
|
||||
return true;
|
||||
@ -134,7 +133,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||
//Use update method with category instead
|
||||
@Override @Deprecated
|
||||
public boolean update(String name, String value) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
|
||||
stmt.setString(1, value);
|
||||
@ -149,7 +148,7 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||
|
||||
@Override
|
||||
public boolean update(String name, String category, String value) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
value = ("Hidden".equals(category) || "Secure".equals(category)) ? DBEncryptionUtil.encrypt(value) : value;
|
||||
PreparedStatement stmt = txn.prepareStatement(UPDATE_CONFIGURATION_SQL);
|
||||
@ -162,13 +161,13 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getValue(String name) {
|
||||
ConfigurationVO config = findByName(name);
|
||||
ConfigurationVO config = findByName(name);
|
||||
return (config == null) ? null : config.getValue();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public String getValueAndInitIfNotExist(String name, String category, String initValue) {
|
||||
@ -195,12 +194,12 @@ public class ConfigurationDaoImpl extends GenericDaoBase<ConfigurationVO, String
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ConfigurationVO findByName(String name) {
|
||||
SearchCriteria<ConfigurationVO> sc = NameSearch.create();
|
||||
sc.setParameters("name", name);
|
||||
return findOneIncludingRemovedBy(sc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -17,7 +17,6 @@
|
||||
package com.cloud.keystore;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
@ -33,6 +32,8 @@ import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
@Component
|
||||
@Local(value={KeystoreDao.class})
|
||||
public class KeystoreDaoImpl extends GenericDaoBase<KeystoreVO, Long> implements KeystoreDao {
|
||||
@ -53,8 +54,7 @@ public class KeystoreDaoImpl extends GenericDaoBase<KeystoreVO, Long> implements
|
||||
public List<KeystoreVO> findCertChain() {
|
||||
SearchCriteria<KeystoreVO> sc = CertChainSearch.create();
|
||||
List<KeystoreVO> ks = listBy(sc);
|
||||
Collections.sort(ks, new Comparator() { @Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
Collections.sort(ks, new Comparator() { public int compare(Object o1, Object o2) {
|
||||
Integer seq1 = ((KeystoreVO)o1).getIndex();
|
||||
Integer seq2 = ((KeystoreVO)o2).getIndex();
|
||||
return seq1.compareTo(seq2);
|
||||
@ -99,7 +99,7 @@ public class KeystoreDaoImpl extends GenericDaoBase<KeystoreVO, Long> implements
|
||||
@Override
|
||||
@DB
|
||||
public void save(String alias, String certificate, Integer index, String domainSuffix) {
|
||||
KeystoreVO ks = findByName(alias);
|
||||
KeystoreVO ks = this.findByName(alias);
|
||||
if (ks != null) {
|
||||
ks.setCertificate(certificate);
|
||||
ks.setName(alias);
|
||||
@ -112,7 +112,7 @@ public class KeystoreDaoImpl extends GenericDaoBase<KeystoreVO, Long> implements
|
||||
newks.setName(alias);
|
||||
newks.setIndex(index);
|
||||
newks.setDomainSuffix(domainSuffix);
|
||||
persist(newks);
|
||||
this.persist(newks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,14 +30,12 @@ import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.storage.VMTemplateStorageResourceAssoc;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.host.Host;
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
package org.apache.cloudstack.storage.cache.manager;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.component.Manager;
|
||||
@ -28,20 +29,16 @@ import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria2;
|
||||
import com.cloud.utils.db.SearchCriteriaService;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.*;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event;
|
||||
import org.apache.cloudstack.framework.async.AsyncCallFuture;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.cache.allocator.StorageCacheAllocator;
|
||||
import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
@ -18,23 +18,20 @@
|
||||
*/
|
||||
package org.apache.cloudstack.storage.cache.manager;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.utils.DateUtil;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria2;
|
||||
import com.cloud.utils.db.SearchCriteriaService;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.*;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
|
||||
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
||||
@ -39,14 +39,12 @@ import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
|
||||
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.command.CopyCommand;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
|
||||
import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -59,6 +57,7 @@ import com.cloud.agent.api.to.DataTO;
|
||||
import com.cloud.agent.api.to.NfsTO;
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
|
||||
@ -48,7 +48,6 @@ import org.apache.cloudstack.framework.async.AsyncCallFuture;
|
||||
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
|
||||
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
|
||||
import org.apache.cloudstack.framework.async.AsyncRpcContext;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.command.CommandResult;
|
||||
import org.apache.cloudstack.storage.command.DeleteCommand;
|
||||
import org.apache.cloudstack.storage.datastore.DataObjectManager;
|
||||
@ -58,7 +57,6 @@ import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
|
||||
import org.apache.cloudstack.storage.image.store.TemplateObject;
|
||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -67,6 +65,7 @@ import com.cloud.agent.api.storage.ListTemplateAnswer;
|
||||
import com.cloud.agent.api.storage.ListTemplateCommand;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
|
||||
@ -21,12 +21,10 @@ import java.io.IOException;
|
||||
import org.apache.cloudstack.acl.APIChecker;
|
||||
import org.apache.cloudstack.engine.service.api.OrchestrationService;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDaoImpl;
|
||||
import org.apache.cloudstack.framework.rpc.RpcProvider;
|
||||
import org.apache.cloudstack.storage.cache.manager.StorageCacheManagerImpl;
|
||||
import org.apache.cloudstack.storage.test.ChildTestConfiguration.Library;
|
||||
import org.apache.cloudstack.test.utils.SpringUtils;
|
||||
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
@ -42,6 +40,7 @@ import com.cloud.alert.AlertManager;
|
||||
import com.cloud.capacity.dao.CapacityDaoImpl;
|
||||
import com.cloud.cluster.ClusteredAgentRebalanceService;
|
||||
import com.cloud.cluster.agentlb.dao.HostTransferMapDaoImpl;
|
||||
import com.cloud.configuration.dao.ConfigurationDaoImpl;
|
||||
import com.cloud.dc.ClusterDetailsDaoImpl;
|
||||
import com.cloud.dc.dao.ClusterDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterDaoImpl;
|
||||
|
||||
@ -21,15 +21,14 @@ import javax.inject.Inject;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.*;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.command.CreateObjectAnswer;
|
||||
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
|
||||
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.storage.Snapshot;
|
||||
|
||||
@ -22,12 +22,11 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.configuration.dao.ConfigurationDaoImpl;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
|
||||
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDaoImpl;
|
||||
import org.apache.cloudstack.storage.command.CopyCommand;
|
||||
import org.apache.cloudstack.storage.command.DownloadCommand;
|
||||
import org.apache.cloudstack.storage.resource.LocalNfsSecondaryStorageResource;
|
||||
|
||||
@ -31,9 +31,9 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
|
||||
@ -24,10 +24,9 @@ import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
import com.cloud.storage.StorageManager;
|
||||
|
||||
@ -26,13 +26,12 @@ import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.capacity.dao.CapacityDao;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
import com.cloud.service.dao.ServiceOfferingDao;
|
||||
|
||||
@ -18,21 +18,18 @@
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
|
||||
import org.apache.cloudstack.storage.image.datastore.ImageStoreProviderManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class DataStoreManagerImpl implements DataStoreManager {
|
||||
|
||||
@ -23,13 +23,13 @@ import com.cloud.agent.api.storage.DownloadAnswer;
|
||||
import com.cloud.agent.api.storage.Proxy;
|
||||
import com.cloud.agent.api.to.DataObjectType;
|
||||
import com.cloud.agent.api.to.DataTO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.storage.VMTemplateStorageResourceAssoc;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.storage.dao.VolumeDao;
|
||||
import com.cloud.storage.download.DownloadMonitor;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||
@ -39,18 +39,15 @@ import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
|
||||
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
|
||||
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
|
||||
import org.apache.cloudstack.framework.async.AsyncRpcContext;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.command.CommandResult;
|
||||
import org.apache.cloudstack.storage.command.DeleteCommand;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Date;
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
package org.apache.cloudstack.storage.image.db;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -25,9 +24,6 @@ import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
@ -36,16 +32,20 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreState
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.UpdateBuilder;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
@Component
|
||||
public class TemplateDataStoreDaoImpl extends GenericDaoBase<TemplateDataStoreVO, Long> implements TemplateDataStoreDao {
|
||||
private static final Logger s_logger = Logger.getLogger(TemplateDataStoreDaoImpl.class);
|
||||
@ -250,11 +250,11 @@ public class TemplateDataStoreDaoImpl extends GenericDaoBase<TemplateDataStoreVO
|
||||
@Override
|
||||
public List<TemplateDataStoreVO> listByTemplateZoneDownloadStatus(long templateId, Long zoneId, Status... status) {
|
||||
// get all elgible image stores
|
||||
List<DataStore> imgStores = _storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
|
||||
List<DataStore> imgStores = this._storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
|
||||
if (imgStores != null) {
|
||||
List<TemplateDataStoreVO> result = new ArrayList<TemplateDataStoreVO>();
|
||||
for (DataStore store : imgStores) {
|
||||
List<TemplateDataStoreVO> sRes = listByTemplateStoreDownloadStatus(templateId, store.getId(),
|
||||
List<TemplateDataStoreVO> sRes = this.listByTemplateStoreDownloadStatus(templateId, store.getId(),
|
||||
status);
|
||||
if (sRes != null && sRes.size() > 0) {
|
||||
result.addAll(sRes);
|
||||
@ -268,10 +268,10 @@ public class TemplateDataStoreDaoImpl extends GenericDaoBase<TemplateDataStoreVO
|
||||
@Override
|
||||
public TemplateDataStoreVO findByTemplateZoneDownloadStatus(long templateId, Long zoneId, Status... status) {
|
||||
// get all elgible image stores
|
||||
List<DataStore> imgStores = _storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
|
||||
List<DataStore> imgStores = this._storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
|
||||
if (imgStores != null) {
|
||||
for (DataStore store : imgStores) {
|
||||
List<TemplateDataStoreVO> sRes = listByTemplateStoreDownloadStatus(templateId, store.getId(),
|
||||
List<TemplateDataStoreVO> sRes = this.listByTemplateStoreDownloadStatus(templateId, store.getId(),
|
||||
status);
|
||||
if (sRes != null && sRes.size() > 0) {
|
||||
Collections.shuffle(sRes);
|
||||
@ -326,13 +326,13 @@ public class TemplateDataStoreDaoImpl extends GenericDaoBase<TemplateDataStoreVO
|
||||
// get all elgible image stores
|
||||
List<DataStore> imgStores = null;
|
||||
if (role == DataStoreRole.Image) {
|
||||
imgStores = _storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
|
||||
imgStores = this._storeMgr.getImageStoresByScope(new ZoneScope(zoneId));
|
||||
} else if (role == DataStoreRole.ImageCache) {
|
||||
imgStores = _storeMgr.getImageCacheStores(new ZoneScope(zoneId));
|
||||
imgStores = this._storeMgr.getImageCacheStores(new ZoneScope(zoneId));
|
||||
}
|
||||
if (imgStores != null) {
|
||||
for (DataStore store : imgStores) {
|
||||
List<TemplateDataStoreVO> sRes = listByTemplateStore(templateId, store.getId());
|
||||
List<TemplateDataStoreVO> sRes = this.listByTemplateStore(templateId, store.getId());
|
||||
if (sRes != null && sRes.size() > 0) {
|
||||
return sRes.get(0);
|
||||
}
|
||||
|
||||
@ -48,7 +48,6 @@ import org.apache.cloudstack.framework.async.AsyncCallFuture;
|
||||
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
|
||||
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
|
||||
import org.apache.cloudstack.framework.async.AsyncRpcContext;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.command.CommandResult;
|
||||
import org.apache.cloudstack.storage.command.DeleteCommand;
|
||||
import org.apache.cloudstack.storage.datastore.DataObjectManager;
|
||||
@ -58,7 +57,6 @@ import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -69,6 +67,7 @@ import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.Resource.ResourceType;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.UsageEventUtils;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
|
||||
@ -29,17 +29,5 @@
|
||||
<artifactId>cloud-framework-db</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-config</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@ -45,10 +45,9 @@ import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.ConfigValue;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.cloudstack.config.ConfigDepot;
|
||||
import org.apache.cloudstack.config.ConfigKey;
|
||||
import org.apache.cloudstack.config.ConfigValue;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
|
||||
import com.cloud.cluster.dao.ManagementServerHostDao;
|
||||
@ -69,7 +68,7 @@ import com.cloud.utils.mgmt.JmxUtil;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
@Local(value = { ClusterManager.class })
|
||||
public class ClusterManagerImpl extends ManagerBase implements ClusterManager, Configurable {
|
||||
public class ClusterManagerImpl extends ManagerBase implements ClusterManager {
|
||||
private static final Logger s_logger = Logger.getLogger(ClusterManagerImpl.class);
|
||||
|
||||
private static final int EXECUTOR_SHUTDOWN_TIMEOUT = 1000; // 1 second
|
||||
@ -1028,10 +1027,10 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
|
||||
return true;
|
||||
}
|
||||
|
||||
protected final ConfigKey<Integer> HeartBeatInterval = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.interval", "management-server",
|
||||
"1500", "Interval to check for the heart beat between management server nodes", false);
|
||||
protected final ConfigKey<Integer> HeartBeatThreshold = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.threshold", "management-server",
|
||||
"150000", "Threshold before self-fence the management server", true);
|
||||
protected final ConfigKey<Integer> HeartBeatInterval = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.interval", "management-server", ClusterManager.class,
|
||||
"1500", "Interval to check for the heart beat between management server nodes", false, "Seconds");
|
||||
protected final ConfigKey<Integer> HeartBeatThreshold = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.threshold", "management-server", ClusterManager.class,
|
||||
"150000", "Threshold before self-fence the management server", true, "Seconds");
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
@ -1112,16 +1111,6 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
|
||||
return pingManagementNode(mshost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigComponentName() {
|
||||
return ClusterManager.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] {HeartBeatInterval, HeartBeatThreshold};
|
||||
}
|
||||
|
||||
private boolean pingManagementNode(ManagementServerHostVO mshost) {
|
||||
|
||||
String targetIp = mshost.getServiceIP();
|
||||
|
||||
@ -31,9 +31,9 @@ import javax.naming.ConfigurationException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.ConfigValue;
|
||||
import org.apache.cloudstack.config.ConfigDepot;
|
||||
import org.apache.cloudstack.config.ConfigKey;
|
||||
import org.apache.cloudstack.config.ConfigValue;
|
||||
|
||||
import com.cloud.cluster.dao.ManagementServerHostDao;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
@ -125,8 +125,8 @@ public class ClusterServiceServletAdapter extends AdapterBase implements Cluster
|
||||
return true;
|
||||
}
|
||||
|
||||
private final ConfigKey<Integer> ClusterMessageTimeOut = new ConfigKey<Integer>(Integer.class, "cluster.message.timeout.seconds", "Advance", "300",
|
||||
"Time (in seconds) to wait before a inter-management server message post times out.", true);
|
||||
private final ConfigKey<Integer> ClusterMessageTimeOut = new ConfigKey<Integer>(Integer.class, "cluster.message.timeout.seconds", "Advance", ClusterManager.class, "300",
|
||||
"Time (in seconds) to wait before a inter-management server message post times out.", true, "Seconds");
|
||||
|
||||
private void init() throws ConfigurationException {
|
||||
if(_mshostDao != null)
|
||||
|
||||
@ -27,7 +27,7 @@ import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.params.HttpClientParams;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigValue;
|
||||
import org.apache.cloudstack.config.ConfigValue;
|
||||
|
||||
public class ClusterServiceServletImpl implements ClusterService {
|
||||
private static final long serialVersionUID = 4574025200012566153L;
|
||||
|
||||
@ -1,45 +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. -->
|
||||
<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>
|
||||
<artifactId>cloud-framework-config</artifactId>
|
||||
<name>Apache CloudStack Framework - Configuration</name>
|
||||
<parent>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloudstack-framework</artifactId>
|
||||
<version>4.3.0-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-utils</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-db</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -1,106 +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.
|
||||
package org.apache.cloudstack.framework.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.utils.db.EntityManager;
|
||||
|
||||
/**
|
||||
* ConfigDepotImpl implements the ConfigDepot and ConfigDepotAdmin interface.
|
||||
* Its functionalities include:
|
||||
* - Control how dynamic config values are cached and refreshed.
|
||||
* - Control how scoped config values are stored.
|
||||
* - Gather all of the Configurable interfaces and insert their config
|
||||
* variables into the config table.
|
||||
* - Hide the data source where configs are stored and retrieved.
|
||||
*
|
||||
* When dealing with this class, we must be very careful on cluster situations.
|
||||
*
|
||||
* TODO:
|
||||
* - Move the rest of the changes to the config table to here.
|
||||
* - Implement ScopedConfigValue
|
||||
* - Move the code to set scoped configuration values to here.
|
||||
* - Add the code to mark the rows in configuration table without
|
||||
* the corresponding keys to be null.
|
||||
* - Move all of the configurations to using ConfigDepot
|
||||
* - Completely eliminate Config.java
|
||||
* - Figure out the correct categories.
|
||||
*
|
||||
*/
|
||||
class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
|
||||
@Inject
|
||||
EntityManager _entityMgr;
|
||||
|
||||
@Inject
|
||||
ConfigurationDao _configDao;
|
||||
|
||||
@Inject
|
||||
List<Configurable> _configurables;
|
||||
|
||||
public ConfigDepotImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ConfigValue<T> get(ConfigKey<T> config) {
|
||||
return new ConfigValue<T>(_entityMgr, config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ScopedConfigValue<T> getScopedValue(ConfigKey<T> config) {
|
||||
assert (config.scope() != null) : "Did you notice the configuration you're trying to retrieve is not scoped?";
|
||||
return new ScopedConfigValue<T>(_entityMgr, config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populateConfigurations() {
|
||||
Date date = new Date();
|
||||
for (Configurable configurable : _configurables) {
|
||||
for (ConfigKey<?> key : configurable.getConfigKeys()) {
|
||||
ConfigurationVO vo = _configDao.findById(key.key());
|
||||
if (vo == null) {
|
||||
vo = new ConfigurationVO(configurable.getConfigComponentName(), key);
|
||||
vo.setUpdated(date);
|
||||
_configDao.persist(vo);
|
||||
} else {
|
||||
if (vo.isDynamic() != key.isDynamic() ||
|
||||
!vo.getDescription().equals(key.description()) ||
|
||||
((vo.getDefaultValue() != null && key.defaultValue() == null) ||
|
||||
(vo.getDefaultValue() == null && key.defaultValue() != null) ||
|
||||
!vo.getDefaultValue().equals(key.defaultValue()))) {
|
||||
vo.setDynamic(key.isDynamic());
|
||||
vo.setDescription(key.description());
|
||||
vo.setDefaultValue(key.defaultValue());
|
||||
vo.setUpdated(date);
|
||||
_configDao.persist(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getComponentsInDepot() {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
}
|
||||
@ -1,175 +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.
|
||||
package org.apache.cloudstack.framework.config;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
import org.apache.cloudstack.config.Configuration;
|
||||
|
||||
import com.cloud.utils.crypt.DBEncryptionUtil;
|
||||
|
||||
@Entity
|
||||
@Table(name = "configuration")
|
||||
public class ConfigurationVO implements Configuration {
|
||||
@Column(name = "instance")
|
||||
private String instance;
|
||||
|
||||
@Column(name = "component")
|
||||
private String component;
|
||||
|
||||
@Id
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "value", length = 4095)
|
||||
private String value;
|
||||
|
||||
@Column(name = "default_value", length = 4095)
|
||||
private String defaultValue;
|
||||
|
||||
@Column(name = "description", length = 1024)
|
||||
private String description;
|
||||
|
||||
@Column(name = "category")
|
||||
private String category;
|
||||
|
||||
@Column(name = "is_dynamic")
|
||||
private boolean dynamic;
|
||||
|
||||
@Column(name = "scope")
|
||||
private String scope;
|
||||
|
||||
@Column(name = "updated")
|
||||
@Temporal(value = TemporalType.TIMESTAMP)
|
||||
private Date updated;
|
||||
|
||||
protected ConfigurationVO() {
|
||||
}
|
||||
|
||||
public ConfigurationVO(String category, String instance, String component, String name, String value, String description) {
|
||||
this.category = category;
|
||||
this.instance = instance;
|
||||
this.component = component;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public ConfigurationVO(String component, ConfigKey<?> key) {
|
||||
this(key.category(), "DEFAULT", component, key.key(), key.defaultValue(), key.description());
|
||||
defaultValue = key.defaultValue();
|
||||
dynamic = key.isDynamic();
|
||||
scope = key.scope() != null ? key.scope().getName() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void setInstance(String instance) {
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComponent() {
|
||||
return component;
|
||||
}
|
||||
|
||||
public void setComponent(String component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return (("Hidden".equals(getCategory()) || "Secure".equals(getCategory())) ? DBEncryptionUtil.decrypt(value) : value);
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScope() {
|
||||
return scope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return dynamic;
|
||||
}
|
||||
|
||||
public void setDynamic(boolean dynamic) {
|
||||
this.dynamic = dynamic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public void setScope(String scope) {
|
||||
this.scope = scope;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public void setUpdated(Date updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
}
|
||||
@ -1,43 +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.
|
||||
package org.apache.cloudstack.framework.config;
|
||||
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.org.Grouping;
|
||||
import com.cloud.utils.db.EntityManager;
|
||||
|
||||
public class ScopedConfigValue<T> extends ConfigValue<T> {
|
||||
public T getValueForScope(long scopeId) {
|
||||
// TODO: In order to complete this the details for zone, pod, cluster
|
||||
// needs to have interfaces. Then you can use the EntityManager to
|
||||
// retrieve those information.
|
||||
Class<? extends Grouping> scope = _config.scope();
|
||||
if (scope == DataCenter.class) {
|
||||
} else if (scope == Pod.class) {
|
||||
|
||||
} else if (scope == Cluster.class) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected ScopedConfigValue(EntityManager entityMgr, ConfigKey<T> key) {
|
||||
super(entityMgr, key);
|
||||
}
|
||||
}
|
||||
@ -1,131 +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.
|
||||
package org.apache.cloudstack.framework.config;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.ComponentScan.Filter;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
import org.springframework.core.type.classreading.MetadataReader;
|
||||
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
import org.springframework.core.type.filter.TypeFilter;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.test.utils.SpringUtils;
|
||||
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import com.cloud.utils.db.EntityManager;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
|
||||
public class ConfigDepotAdminTest {
|
||||
private final ConfigKey<Integer> DynamicIntCK = new ConfigKey<Integer>(Integer.class, "dynIntKey", "Advance", "10", "Test Key", true);
|
||||
private final ConfigKey<Integer> StaticIntCK = new ConfigKey<Integer>(Integer.class, "statIntKey", "Advance", "10", "Test Key", false);
|
||||
|
||||
@Inject
|
||||
Configurable configurable;
|
||||
|
||||
@Inject
|
||||
ConfigDepot _configDepot;
|
||||
|
||||
@Inject
|
||||
ConfigDepotAdmin _depotAdmin;
|
||||
|
||||
@Inject
|
||||
EntityManager _entityMgr;
|
||||
|
||||
@Inject
|
||||
ConfigurationDao _configDao;
|
||||
|
||||
/**
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
ComponentContext.initComponentsLifeCycle(); // NOTE #3
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoPopulation() {
|
||||
ConfigurationVO dynamicIntCV = new ConfigurationVO("UnitTestComponent", DynamicIntCK);
|
||||
dynamicIntCV.setValue("100");
|
||||
ConfigurationVO staticIntCV = new ConfigurationVO("UnitTestComponent", StaticIntCK);
|
||||
dynamicIntCV.setValue("200");
|
||||
|
||||
when(configurable.getConfigComponentName()).thenReturn("UnitTestComponent");
|
||||
when(configurable.getConfigKeys()).thenReturn(new ConfigKey<?>[] {DynamicIntCK, StaticIntCK});
|
||||
when(_entityMgr.findById(org.apache.cloudstack.config.Configuration.class, DynamicIntCK.key())).thenReturn(dynamicIntCV);
|
||||
when(_entityMgr.findById(org.apache.cloudstack.config.Configuration.class, StaticIntCK.key())).thenReturn(staticIntCV);
|
||||
when(_configDao.findById(StaticIntCK.key())).thenReturn(null);
|
||||
when(_configDao.findById(DynamicIntCK.key())).thenReturn(dynamicIntCV);
|
||||
when(_configDao.persist(any(ConfigurationVO.class))).thenReturn(dynamicIntCV);
|
||||
|
||||
_depotAdmin.populateConfigurations();
|
||||
|
||||
// This is once because DynamicIntCK is returned.
|
||||
verify(_configDao, times(1)).persist(any(ConfigurationVO.class));
|
||||
|
||||
when(_configDao.findById(DynamicIntCK.key())).thenReturn(dynamicIntCV);
|
||||
_depotAdmin.populateConfigurations();
|
||||
// This is two because DynamicIntCK also returns null.
|
||||
verify(_configDao, times(2)).persist(any(ConfigurationVO.class));
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ComponentScan(basePackageClasses = {ConfigDepotImpl.class}, includeFilters = {@Filter(value = TestConfiguration.Library.class, type = FilterType.CUSTOM)}, useDefaultFilters = false)
|
||||
static class TestConfiguration extends SpringUtils.CloudStackTestConfiguration {
|
||||
@Bean
|
||||
public Configurable configurable() {
|
||||
return mock(Configurable.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EntityManager entityMgr() {
|
||||
return mock(EntityManager.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConfigurationDao configurationDao() {
|
||||
return mock(ConfigurationDao.class);
|
||||
}
|
||||
|
||||
public static class Library implements TypeFilter {
|
||||
@Override
|
||||
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
|
||||
ComponentScan cs = TestConfiguration.class.getAnnotation(ComponentScan.class);
|
||||
return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache-core</artifactId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.persistence</groupId>
|
||||
|
||||
@ -32,10 +32,8 @@ import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
@ -79,6 +77,9 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
/**
|
||||
* GenericDaoBase is a simple way to implement DAOs. It DOES NOT
|
||||
* support the full EJB3 spec. It borrows some of the annotations from
|
||||
@ -1265,7 +1266,6 @@ public abstract class GenericDaoBase<T, ID extends Serializable> extends Compone
|
||||
return update(ub, sc, rows);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DB(txn=false)
|
||||
public int update(final T entity, final SearchCriteria<T> sc) {
|
||||
final UpdateBuilder ub = getUpdateBuilder(entity);
|
||||
|
||||
@ -52,10 +52,5 @@
|
||||
<artifactId>cloud-framework-cluster</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-config</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@ -20,7 +20,6 @@ package org.apache.cloudstack.framework.jobs.impl;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -38,10 +37,10 @@ import javax.naming.ConfigurationException;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.ConfigValue;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.cloudstack.config.ConfigDepot;
|
||||
import org.apache.cloudstack.config.ConfigKey;
|
||||
import org.apache.cloudstack.config.ConfigValue;
|
||||
import org.apache.cloudstack.config.Configurable;
|
||||
import org.apache.cloudstack.framework.jobs.AsyncJob;
|
||||
import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher;
|
||||
import org.apache.cloudstack.framework.jobs.AsyncJobExecutionContext;
|
||||
@ -77,11 +76,13 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.exception.ExceptionUtil;
|
||||
import com.cloud.utils.mgmt.JmxUtil;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager, ClusterManagerListener, Configurable {
|
||||
// Advanced
|
||||
private static final ConfigKey<Long> JobExpireMinutes = new ConfigKey<Long>(Long.class, "job.expire.minutes", "Advanced", "1440",
|
||||
private static final ConfigKey<Long> JobExpireMinutes = new ConfigKey<Long>(Long.class, "job.expire.minutes", "Advanced", AsyncJobManager.class, "1440",
|
||||
"Time (in minutes) for async-jobs to be kept in system", true, null);
|
||||
private static final ConfigKey<Long> JobCancelThresholdMinutes = new ConfigKey<Long>(Long.class, "job.cancel.threshold.minutes", "Advanced",
|
||||
private static final ConfigKey<Long> JobCancelThresholdMinutes = new ConfigKey<Long>(Long.class, "job.cancel.threshold.minutes", "Advanced", AsyncJobManager.class,
|
||||
"60", "Time (in minutes) for async-jobs to be forcely cancelled if it has been in process for long", true, null);
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(AsyncJobManagerImpl.class);
|
||||
@ -113,11 +114,6 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
|
||||
private final ScheduledExecutorService _heartbeatScheduler = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AsyncJobMgr-Heartbeat"));
|
||||
private ExecutorService _executor;
|
||||
|
||||
@Override
|
||||
public String getConfigComponentName() {
|
||||
return AsyncJobManager.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] {JobExpireMinutes, JobCancelThresholdMinutes};
|
||||
|
||||
@ -34,8 +34,7 @@
|
||||
<module>rest</module>
|
||||
<module>events</module>
|
||||
<module>jobs</module>
|
||||
<module>cluster</module>
|
||||
<module>db</module>
|
||||
<module>config</module>
|
||||
<module>cluster</module>
|
||||
<module>db</module>
|
||||
</modules>
|
||||
</project>
|
||||
|
||||
@ -27,12 +27,11 @@ import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.messagebus.MessageSubscriber;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
|
||||
@ -27,12 +27,12 @@ import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.ApiLimitResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.ratelimit.ApiRateLimitService;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@ -37,10 +37,10 @@ import org.apache.log4j.Logger;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.ratelimit.ApiRateLimitService;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
|
||||
@ -19,7 +19,6 @@ package org.apache.cloudstack.ratelimit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
@ -34,16 +33,15 @@ import org.apache.cloudstack.api.ApiConstants.LDAPParams;
|
||||
import org.apache.cloudstack.api.command.admin.ratelimit.ResetApiLimitCmd;
|
||||
import org.apache.cloudstack.api.command.user.ratelimit.GetApiLimitCmd;
|
||||
import org.apache.cloudstack.api.response.ApiLimitResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.RequestLimitException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountService;
|
||||
import com.cloud.user.User;
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
|
||||
@ -24,14 +24,13 @@ import java.util.concurrent.Executors;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.response.ApiLimitResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.ratelimit.ApiRateLimitServiceImpl;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.RequestLimitException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.AccountService;
|
||||
|
||||
@ -43,12 +43,12 @@ import org.apache.cloudstack.api.response.DedicateHostResponse;
|
||||
import org.apache.cloudstack.api.response.DedicatePodResponse;
|
||||
import org.apache.cloudstack.api.response.DedicateZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.DedicatedResourceVO;
|
||||
|
||||
@ -48,9 +48,9 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.dedicated.DedicatedResourceManagerImpl;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.test.utils.SpringUtils;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DedicatedResourceVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
|
||||
@ -53,13 +53,13 @@ import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.test.utils.SpringUtils;
|
||||
|
||||
import com.cloud.capacity.CapacityManager;
|
||||
import com.cloud.capacity.CapacityVO;
|
||||
import com.cloud.capacity.dao.CapacityDao;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
|
||||
@ -34,14 +34,13 @@ import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
import com.cloud.baremetal.networkservice.BareMetalResourceBase;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
|
||||
@ -25,9 +25,8 @@ import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.capacity.CapacityManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterDetailsVO;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
|
||||
@ -25,14 +25,12 @@ package com.cloud.baremetal.networkservice;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.IAgentControl;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -68,6 +66,7 @@ import com.cloud.baremetal.manager.BaremetalManager;
|
||||
import com.cloud.host.Host.Type;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.server.ManagementServer;
|
||||
import com.cloud.utils.component.ComponentContext;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
@ -80,6 +79,8 @@ import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachine.State;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
|
||||
|
||||
@Local(value = ServerResource.class)
|
||||
public class BareMetalResourceBase extends ManagerBase implements ServerResource {
|
||||
private static final Logger s_logger = Logger.getLogger(BareMetalResourceBase.class);
|
||||
@ -133,8 +134,8 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
|
||||
_cpuNum = Long.parseLong((String) params.get(ApiConstants.CPU_NUMBER));
|
||||
} catch (NumberFormatException e) {
|
||||
throw new ConfigurationException(String.format("Unable to parse number of CPU or memory capacity "
|
||||
+ "or cpu capacity(cpu number = %1$s memCapacity=%2$s, cpuCapacity=%3$s", params.get(ApiConstants.CPU_NUMBER),
|
||||
params.get(ApiConstants.MEMORY), params.get(ApiConstants.CPU_SPEED)));
|
||||
+ "or cpu capacity(cpu number = %1$s memCapacity=%2$s, cpuCapacity=%3$s", (String) params.get(ApiConstants.CPU_NUMBER),
|
||||
(String) params.get(ApiConstants.MEMORY), (String) params.get(ApiConstants.CPU_SPEED)));
|
||||
}
|
||||
|
||||
_zone = (String) params.get("zone");
|
||||
|
||||
@ -37,7 +37,6 @@ import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
|
||||
import org.apache.cloudstack.api.AddBaremetalPxeCmd;
|
||||
import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
|
||||
import org.apache.cloudstack.api.ListBaremetalPxePingServersCmd;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -45,6 +44,7 @@ import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupPxeServerCommand;
|
||||
import com.cloud.agent.api.routing.VmDataCommand;
|
||||
import com.cloud.baremetal.database.BaremetalPxeVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.host.Host;
|
||||
|
||||
@ -39,11 +39,10 @@ import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.UcsBladeResponse;
|
||||
import org.apache.cloudstack.api.response.UcsManagerResponse;
|
||||
import org.apache.cloudstack.api.response.UcsProfileResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
|
||||
@ -28,13 +28,11 @@ import java.util.UUID;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
||||
import com.cloud.agent.api.storage.CreateEntityDownloadURLCommand;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.storage.Storage;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.storage.command.CopyCommand;
|
||||
@ -55,6 +53,7 @@ import com.cloud.agent.api.to.DataTO;
|
||||
import com.cloud.agent.api.to.NicTO;
|
||||
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.InsufficientAddressCapacityException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
|
||||
@ -46,7 +46,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
|
||||
private String guid;
|
||||
|
||||
@Column(name = "name")
|
||||
private String vmwareDatacenterName;
|
||||
private String name;
|
||||
|
||||
@Column(name = "vcenter_host")
|
||||
private String vCenterHost;
|
||||
@ -73,7 +73,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
|
||||
|
||||
@Override
|
||||
public String getVmwareDatacenterName() {
|
||||
return vmwareDatacenterName;
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,7 +105,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
|
||||
}
|
||||
|
||||
public void setVmwareDatacenterName(String name) {
|
||||
this.vmwareDatacenterName = name;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setVcenterHost(String vCenterHost) {
|
||||
@ -141,7 +141,7 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
|
||||
|
||||
public VmwareDatacenterVO(String guid, String name, String vCenterHost, String user, String password) {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.vmwareDatacenterName = name;
|
||||
this.name = name;
|
||||
this.guid = guid;
|
||||
this.vCenterHost = vCenterHost;
|
||||
this.user = user;
|
||||
|
||||
@ -48,7 +48,6 @@ import org.apache.cloudstack.api.command.admin.zone.ListVmwareDcsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.RemoveVmwareDcCmd;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
@ -60,6 +59,7 @@ import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.ClusterVSMMapVO;
|
||||
|
||||
@ -51,11 +51,11 @@ import org.apache.cloudstack.api.command.admin.zone.AddVmwareDcCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.RemoveVmwareDcCmd;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.test.utils.SpringUtils;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.cluster.ClusterManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterDetailsVO;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
|
||||
@ -28,10 +28,9 @@ import javax.naming.ConfigurationException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.agent.api.to.LoadBalancerTO;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
|
||||
@ -38,7 +38,6 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.AgentManager.OnError;
|
||||
@ -51,6 +50,7 @@ import com.cloud.agent.api.routing.NetworkElementCommand;
|
||||
import com.cloud.agent.api.to.LoadBalancerTO;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
|
||||
@ -27,9 +27,7 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.response.ExternalLoadBalancerResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.to.LoadBalancerTO;
|
||||
@ -45,6 +43,7 @@ import com.cloud.api.commands.ListF5LoadBalancersCmd;
|
||||
import com.cloud.api.response.F5LoadBalancerResponse;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
@ -91,7 +90,6 @@ import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Local(value = {NetworkElement.class, LoadBalancingServiceProvider.class, IpDeployer.class})
|
||||
|
||||
@ -28,7 +28,6 @@ import javax.naming.ConfigurationException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
|
||||
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
|
||||
|
||||
@ -45,6 +44,7 @@ import com.cloud.agent.api.routing.NetworkElementCommand;
|
||||
import com.cloud.agent.api.to.LoadBalancerTO;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
|
||||
@ -18,10 +18,8 @@ package org.apache.cloudstack.internallbvmmgr;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
|
||||
import org.apache.cloudstack.test.utils.SpringUtils;
|
||||
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
@ -33,6 +31,7 @@ import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
import org.springframework.core.type.filter.TypeFilter;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.dao.AccountVlanMapDaoImpl;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.network.NetworkManager;
|
||||
|
||||
@ -21,6 +21,7 @@ import com.cloud.api.commands.*;
|
||||
import com.cloud.api.response.SrxFirewallResponse;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
@ -49,16 +50,12 @@ import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
import org.apache.cloudstack.api.response.ExternalFirewallResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Local(value = {NetworkElement.class, FirewallServiceProvider.class,
|
||||
|
||||
@ -22,6 +22,7 @@ package com.cloud.network.element;
|
||||
import com.cloud.agent.api.to.FirewallRuleTO;
|
||||
import com.cloud.agent.api.to.PortForwardingRuleTO;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
@ -53,7 +54,6 @@ import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.dao.NicDao;
|
||||
|
||||
import com.midokura.midonet.client.MidonetApi;
|
||||
import com.midokura.midonet.client.dto.DtoRule;
|
||||
import com.midokura.midonet.client.resource.Bridge;
|
||||
@ -68,9 +68,6 @@ import com.midokura.midonet.client.resource.RouterPort;
|
||||
import com.midokura.midonet.client.resource.Rule;
|
||||
import com.midokura.midonet.client.resource.RuleChain;
|
||||
import com.sun.jersey.core.util.MultivaluedMapImpl;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -78,7 +75,6 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.ws.rs.core.MultivaluedMap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -28,10 +28,8 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
import org.apache.cloudstack.region.gslb.GslbServiceProvider;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
@ -53,6 +51,7 @@ import com.cloud.api.commands.ListNetscalerLoadBalancersCmd;
|
||||
import com.cloud.api.response.NetscalerLoadBalancerResponse;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterIpAddressVO;
|
||||
@ -116,7 +115,6 @@ import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@Local(value = {NetworkElement.class, StaticNatServiceProvider.class, LoadBalancingServiceProvider.class, GslbServiceProvider.class})
|
||||
|
||||
@ -59,7 +59,7 @@ import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
|
||||
import java.util.Arrays;
|
||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||
|
||||
public class NiciraNvpGuestNetworkGuruTest {
|
||||
PhysicalNetworkDao physnetdao = mock (PhysicalNetworkDao.class);
|
||||
|
||||
@ -30,13 +30,12 @@ import javax.persistence.EntityExistsException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.Command;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
|
||||
@ -32,16 +32,15 @@ import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.commands.AddSspCmd;
|
||||
import org.apache.cloudstack.api.commands.DeleteSspCmd;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.network.dao.SspCredentialDao;
|
||||
import org.apache.cloudstack.network.dao.SspCredentialVO;
|
||||
import org.apache.cloudstack.network.dao.SspTenantDao;
|
||||
import org.apache.cloudstack.network.dao.SspTenantVO;
|
||||
import org.apache.cloudstack.network.dao.SspUuidDao;
|
||||
import org.apache.cloudstack.network.dao.SspUuidVO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
|
||||
@ -19,16 +19,15 @@ package org.apache.cloudstack.network.element;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.network.dao.SspCredentialDao;
|
||||
import org.apache.cloudstack.network.dao.SspCredentialVO;
|
||||
import org.apache.cloudstack.network.dao.SspTenantDao;
|
||||
import org.apache.cloudstack.network.dao.SspUuidDao;
|
||||
import org.apache.cloudstack.network.element.SspElement;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
|
||||
@ -75,16 +75,6 @@
|
||||
<artifactId>cloud-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-utils</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-config</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-api</artifactId>
|
||||
|
||||
@ -26,12 +26,9 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
|
||||
import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -39,6 +36,7 @@ import com.cloud.agent.api.storage.CreateEntityDownloadURLCommand;
|
||||
import com.cloud.agent.api.to.DataStoreTO;
|
||||
import com.cloud.agent.api.to.NfsTO;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
|
||||
@ -21,22 +21,20 @@ package org.apache.cloudstack.storage.datastore.driver;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreDetailsDao;
|
||||
import org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl;
|
||||
import org.apache.cloudstack.storage.image.store.ImageStoreImpl;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.to.DataStoreTO;
|
||||
import com.cloud.agent.api.to.S3TO;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.storage.Storage.ImageFormat;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.S3Utils;
|
||||
|
||||
@ -32,11 +32,10 @@ import javax.naming.directory.SearchControls;
|
||||
import javax.naming.directory.SearchResult;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants.LDAPParams;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bouncycastle.util.encoders.Base64;
|
||||
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.user.UserAccount;
|
||||
import com.cloud.user.dao.UserAccountDao;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@ -30,6 +30,7 @@ import java.util.Map;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.bouncycastle.util.encoders.Base64;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@ -99,25 +100,25 @@ public class AuthenticatorTest {
|
||||
assertEquals("20 byte user bad password not authenticated", false, authenticator.authenticate("admin20Byte", "fake", 0L, dummyMap));
|
||||
}
|
||||
|
||||
// @Test
|
||||
// public void testTiming() throws UnsupportedEncodingException, NoSuchAlgorithmException {
|
||||
// Map<String, Object[]> dummyMap = new HashMap<String, Object[]>();
|
||||
// Double threshold = (double)500000; //half a millisecond
|
||||
//
|
||||
// Long t1 = System.nanoTime();
|
||||
// authenticator.authenticate("admin", "password", 0L, dummyMap);
|
||||
// Long t2 = System.nanoTime();
|
||||
// authenticator.authenticate("admin20Byte", "password", 0L, dummyMap);
|
||||
// Long t3 = System.nanoTime();
|
||||
// authenticator.authenticate("fake", "fake", 0L, dummyMap);
|
||||
// Long t4 = System.nanoTime();
|
||||
// authenticator.authenticate("admin", "fake", 0L, dummyMap);
|
||||
// Long t5 = System.nanoTime();
|
||||
// Long diff1 = t2 - t1;
|
||||
// Long diff2 = t3 - t2;
|
||||
// Long diff3 = t4 - t3;
|
||||
// Long diff4 = t5 - t4;
|
||||
// Assert.assertTrue("All computation times within " + threshold / 1000000 + " milisecond",
|
||||
// (diff1 <= threshold) && (diff2 <= threshold) && (diff3 <= threshold) && (diff4 <= threshold));
|
||||
// }
|
||||
@Test
|
||||
public void testTiming() throws UnsupportedEncodingException, NoSuchAlgorithmException {
|
||||
Map<String, Object[]> dummyMap = new HashMap<String, Object[]>();
|
||||
Double threshold = (double)500000; //half a millisecond
|
||||
|
||||
Long t1 = System.nanoTime();
|
||||
authenticator.authenticate("admin", "password", 0L, dummyMap);
|
||||
Long t2 = System.nanoTime();
|
||||
authenticator.authenticate("admin20Byte", "password", 0L, dummyMap);
|
||||
Long t3 = System.nanoTime();
|
||||
authenticator.authenticate("fake", "fake", 0L, dummyMap);
|
||||
Long t4 = System.nanoTime();
|
||||
authenticator.authenticate("admin", "fake", 0L, dummyMap);
|
||||
Long t5 = System.nanoTime();
|
||||
Long diff1 = t2 - t1;
|
||||
Long diff2 = t3 - t2;
|
||||
Long diff3 = t4 - t3;
|
||||
Long diff4 = t5 - t4;
|
||||
Assert.assertTrue("All computation times within " + threshold / 1000000 + " milisecond",
|
||||
(diff1 <= threshold) && (diff2 <= threshold) && (diff3 <= threshold) && (diff4 <= threshold));
|
||||
}
|
||||
}
|
||||
|
||||
9
pom.xml
9
pom.xml
@ -54,7 +54,7 @@
|
||||
<cs.jpa.version>2.0.0</cs.jpa.version>
|
||||
<cs.jasypt.version>1.9.0</cs.jasypt.version>
|
||||
<cs.trilead.version>build213-svnkit-1.3-patch</cs.trilead.version>
|
||||
<cs.ehcache.version>2.6.6</cs.ehcache.version>
|
||||
<cs.ehcache.version>1.5.0</cs.ehcache.version>
|
||||
<cs.gson.version>1.7.1</cs.gson.version>
|
||||
<cs.guava.version>14.0-rc1</cs.guava.version>
|
||||
<cs.xapi.version>5.6.100-1-SNAPSHOT</cs.xapi.version>
|
||||
@ -211,7 +211,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache-core</artifactId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
<version>${cs.ehcache.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -341,6 +341,11 @@
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
<version>1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
|
||||
@ -106,11 +106,6 @@
|
||||
<artifactId>cloud-framework-events</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-config</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
|
||||
@ -40,12 +40,11 @@ import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.config.ConfigDepot;
|
||||
import org.apache.cloudstack.config.ConfigKey;
|
||||
import org.apache.cloudstack.config.ConfigValue;
|
||||
import org.apache.cloudstack.config.Configurable;
|
||||
import org.apache.cloudstack.context.ServerContexts;
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.ConfigValue;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
@ -73,6 +72,7 @@ import com.cloud.agent.transport.Request;
|
||||
import com.cloud.agent.transport.Response;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
@ -97,6 +97,7 @@ import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.resource.ResourceState;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.storage.resource.DummySecondaryStorageResource;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||
@ -147,6 +148,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
protected ConfigurationDao _configDao = null;
|
||||
@Inject
|
||||
protected ClusterDao _clusterDao = null;
|
||||
protected int _port;
|
||||
|
||||
@Inject
|
||||
protected HighAvailabilityManager _haMgr = null;
|
||||
@ -178,29 +180,26 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
@Inject
|
||||
protected ConfigDepot _configDepot;
|
||||
|
||||
protected final ConfigKey<Integer> Workers = new ConfigKey<Integer>(Integer.class, "workers", "Advance", "5",
|
||||
"Number of worker threads handling remote agent connections.", false);
|
||||
protected final ConfigKey<Integer> Port = new ConfigKey<Integer>(Integer.class, "port", "Advance", "8250", "Port to listen on for remote agent connections.", false);
|
||||
protected final ConfigKey<Integer> PingInterval = new ConfigKey<Integer>(Integer.class, "ping.interval", "Advance", "60",
|
||||
"Interval to send application level pings to make sure the connection is still working", false);
|
||||
protected final ConfigKey<Float> PingTimeout = new ConfigKey<Float>(Float.class, "ping.timeout", "Advance", "2.5",
|
||||
"Multiplier to ping.interval before announcing an agent has timed out", true);
|
||||
protected final ConfigKey<Integer> Wait = new ConfigKey<Integer>(Integer.class, "wait", "Advance", "1800",
|
||||
"Time in seconds to wait for control commands to return", true);
|
||||
protected final ConfigKey<Integer> AlertWait = new ConfigKey<Integer>(Integer.class, "alert.wait", "Advance", "1800",
|
||||
"Seconds to wait before alerting on a disconnected agent", true);
|
||||
protected final ConfigKey<Integer> DirectAgentLoadSize = new ConfigKey<Integer>(Integer.class, "direct.agent.load.size", "Advance", "16",
|
||||
"The number of direct agents to load each time", false);
|
||||
protected final ConfigKey<Integer> DirectAgentPoolSize = new ConfigKey<Integer>(Integer.class, "direct.agent.pool.size", "Advance", "500",
|
||||
"Default size for DirectAgentPool", false);
|
||||
|
||||
protected ConfigValue<Integer> _port;
|
||||
protected final ConfigKey<Integer> Workers = new ConfigKey<Integer>(Integer.class, "workers", "Advance", AgentManager.class, "5",
|
||||
"Number of worker threads handling remote agent connections.", false, "5-Max Thread Limit");
|
||||
protected final ConfigKey<Integer> Port = new ConfigKey<Integer>(Integer.class, "port", "Advance", AgentManager.class, "8250", "Port to listen on for remote agent connections.", false, "Usable port range");
|
||||
protected final ConfigKey<Integer> PingInterval = new ConfigKey<Integer>(Integer.class, "ping.interval", "Advance", AgentManager.class, "60", "Interval to send application level pings to make sure the connection is still working", false, "Seconds");
|
||||
protected final ConfigKey<Float> PingTimeout = new ConfigKey<Float>(Float.class, "ping.timeout", "Advance", AgentManager.class, "2.5", "Multiplier to ping.interval before announcing an agent has timed out", true, null);
|
||||
protected final ConfigKey<Integer> Wait = new ConfigKey<Integer>(Integer.class, "wait", "Advance", AgentManager.class, "1800",
|
||||
"Time in seconds to wait for control commands to return", true, "Seconds");
|
||||
protected final ConfigKey<Integer> AlertWait = new ConfigKey<Integer>(Integer.class, "alert.wait", "Advance", AgentManager.class, "1800",
|
||||
"Seconds to wait before alerting on a disconnected agent", true, "Seconds");
|
||||
protected final ConfigKey<Integer> DirectAgentLoadSize = new ConfigKey<Integer>(Integer.class, "direct.agent.load.size", "Advance", AgentManager.class, "16",
|
||||
"The number of direct agents to load each time", false, null);
|
||||
protected final ConfigKey<Integer> DirectAgentPoolSize = new ConfigKey<Integer>(Integer.class, "direct.agent.pool.size", "Advance", AgentManager.class, "500",
|
||||
"Default size for DirectAgentPool", false, null);
|
||||
|
||||
@Override
|
||||
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
|
||||
|
||||
_port = _configDepot.get(Port);
|
||||
ConfigValue<Integer> workers = _configDepot.get(Workers);
|
||||
final Map<String, String> configs = _configDao.getConfiguration("AgentManager", params);
|
||||
_port = NumbersUtil.parseInt(configs.get("port"), 8250);
|
||||
final int workers = NumbersUtil.parseInt(configs.get("workers"), 5);
|
||||
|
||||
_pingInterval = _configDepot.get(PingInterval);
|
||||
|
||||
@ -226,8 +225,8 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
//allow core threads to time out even when there are no items in the queue
|
||||
_connectExecutor.allowCoreThreadTimeOut(true);
|
||||
|
||||
_connection = new NioServer("AgentManager", _port.value(), workers.value() + 10, this);
|
||||
s_logger.info("Listening on " + _port.value() + " with " + workers.value() + " workers");
|
||||
_connection = new NioServer("AgentManager", _port, workers + 10, this);
|
||||
s_logger.info("Listening on " + _port + " with " + workers + " workers");
|
||||
|
||||
|
||||
ConfigValue<Integer> size = _configDepot.get(DirectAgentPoolSize);
|
||||
@ -1577,11 +1576,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConfigComponentName() {
|
||||
return AgentManager.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] {Workers, Port, PingInterval, PingTimeout, Wait, AlertWait, DirectAgentLoadSize, DirectAgentPoolSize};
|
||||
|
||||
@ -23,7 +23,6 @@ import java.net.UnknownHostException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@ -48,10 +47,9 @@ import org.apache.log4j.Logger;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.ConfigValue;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.config.ConfigDepot;
|
||||
import org.apache.cloudstack.config.ConfigKey;
|
||||
import org.apache.cloudstack.config.ConfigValue;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
@ -78,12 +76,14 @@ import com.cloud.cluster.agentlb.HostTransferMapVO;
|
||||
import com.cloud.cluster.agentlb.HostTransferMapVO.HostTransferState;
|
||||
import com.cloud.cluster.agentlb.dao.HostTransferMapDao;
|
||||
import com.cloud.cluster.dao.ManagementServerHostDao;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.OperationTimedoutException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.host.Status.Event;
|
||||
import com.cloud.resource.ResourceState;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.serializer.GsonHelper;
|
||||
import com.cloud.storage.resource.DummySecondaryStorageResource;
|
||||
@ -134,14 +134,14 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
|
||||
super();
|
||||
}
|
||||
|
||||
protected final ConfigKey<Boolean> EnableLB = new ConfigKey<Boolean>(Boolean.class, "agent.lb.enabled", "Advanced", "false",
|
||||
"Enable agent load balancing between management server nodes", true);
|
||||
protected final ConfigKey<Double> ConnectedAgentThreshold = new ConfigKey<Double>(Double.class, "agent.load.threshold", "Advanced", "0.7",
|
||||
"What percentage of the agents can be held by one management server before load balancing happens", true);
|
||||
protected final ConfigKey<Integer> LoadSize = new ConfigKey<Integer>(Integer.class, "direct.agent.load.size", "Advanced", "16",
|
||||
"How many agents to connect to in each round", true);
|
||||
protected final ConfigKey<Integer> ScanInterval = new ConfigKey<Integer>(Integer.class, "direct.agent.scan.interval", "Advanced", "90",
|
||||
"Interval between scans to load agents", false);
|
||||
protected final ConfigKey<Boolean> EnableLB = new ConfigKey<Boolean>(Boolean.class, "agent.lb.enabled", "Advanced", AgentManager.class, "false",
|
||||
"Enable agent load balancing between management server nodes", true, "True/False");
|
||||
protected final ConfigKey<Double> ConnectedAgentThreshold = new ConfigKey<Double>(Double.class, "agent.load.threshold", "Advanced", AgentManager.class, "0.7",
|
||||
"What percentage of the agents can be held by one management server before load balancing happens", true, "0-1");
|
||||
protected final ConfigKey<Integer> LoadSize = new ConfigKey<Integer>(Integer.class, "direct.agent.load.size", "Advanced", AgentManager.class, "16",
|
||||
"How many agents to connect to in each round", true, "");
|
||||
protected final ConfigKey<Integer> ScanInterval = new ConfigKey<Integer>(Integer.class, "direct.agent.scan.interval", "Advanced", AgentManager.class, "90",
|
||||
"Interval between scans to load agents", false, "Seconds");
|
||||
|
||||
|
||||
protected ConfigValue<Boolean> _agentLBEnabled;
|
||||
@ -508,13 +508,13 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
|
||||
throw new CloudRuntimeException("Unable to resolve " + ip);
|
||||
}
|
||||
try {
|
||||
ch = SocketChannel.open(new InetSocketAddress(addr, _port.value()));
|
||||
ch = SocketChannel.open(new InetSocketAddress(addr, _port));
|
||||
ch.configureBlocking(true); // make sure we are working at blocking mode
|
||||
ch.socket().setKeepAlive(true);
|
||||
ch.socket().setSoTimeout(60 * 1000);
|
||||
try {
|
||||
SSLContext sslContext = Link.initSSLContext(true);
|
||||
sslEngine = sslContext.createSSLEngine(ip, _port.value());
|
||||
sslEngine = sslContext.createSSLEngine(ip, _port);
|
||||
sslEngine.setUseClientMode(true);
|
||||
|
||||
Link.doHandshake(ch, sslEngine, true);
|
||||
@ -1241,6 +1241,10 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
|
||||
}
|
||||
|
||||
|
||||
public boolean executeResourceUserRequest(long hostId, ResourceState.Event event) throws AgentUnavailableException {
|
||||
return _resourceMgr.executeUserRequest(hostId, event);
|
||||
}
|
||||
|
||||
protected class ClusterDispatcher implements ClusterManager.Dispatcher {
|
||||
@Override
|
||||
public String getName() {
|
||||
@ -1313,7 +1317,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
|
||||
|
||||
boolean result = false;
|
||||
try {
|
||||
result = _resourceMgr.executeUserRequest(cmd.getHostId(), cmd.getEvent());
|
||||
result = executeResourceUserRequest(cmd.getHostId(), cmd.getEvent());
|
||||
s_logger.debug("Result is " + result);
|
||||
} catch (AgentUnavailableException ex) {
|
||||
s_logger.warn("Agent is unavailable", ex);
|
||||
@ -1405,17 +1409,4 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
|
||||
}
|
||||
profilerAgentLB.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
ConfigKey<?>[] keys = super.getConfigKeys();
|
||||
|
||||
List<ConfigKey<?>> keysLst = new ArrayList<ConfigKey<?>>();
|
||||
keysLst.addAll(Arrays.asList(keys));
|
||||
keysLst.add(EnableLB);
|
||||
keysLst.add(ConnectedAgentThreshold);
|
||||
keysLst.add(LoadSize);
|
||||
keysLst.add(ScanInterval);
|
||||
return keysLst.toArray(new ConfigKey<?>[keysLst.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,10 +29,9 @@ import javax.naming.ConfigurationException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.agent.manager.allocator.HostAllocator;
|
||||
import com.cloud.capacity.CapacityManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterDetailsVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
|
||||
@ -29,11 +29,10 @@ import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.agent.manager.allocator.PodAllocator;
|
||||
import com.cloud.capacity.CapacityVO;
|
||||
import com.cloud.capacity.dao.CapacityDao;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.Pod;
|
||||
|
||||
@ -25,13 +25,12 @@ import javax.naming.ConfigurationException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.StartupCommandProcessor;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.manager.authn.AgentAuthnException;
|
||||
import com.cloud.agent.manager.authn.AgentAuthorizer;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.exception.ConnectionException;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.utils.component.AdapterBase;
|
||||
|
||||
@ -38,10 +38,8 @@ import javax.mail.URLName;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -55,6 +53,7 @@ import com.cloud.capacity.dao.CapacityDao;
|
||||
import com.cloud.capacity.dao.CapacityDaoImpl.SummedCapacity;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
@ -78,7 +77,6 @@ import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.component.ManagerBase;
|
||||
import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
||||
import com.sun.mail.smtp.SMTPMessage;
|
||||
import com.sun.mail.smtp.SMTPSSLTransport;
|
||||
import com.sun.mail.smtp.SMTPTransport;
|
||||
|
||||
@ -52,7 +52,6 @@ import org.apache.cloudstack.api.response.UserResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.jobs.AsyncJob;
|
||||
import org.apache.cloudstack.framework.jobs.AsyncJobManager;
|
||||
import org.apache.cloudstack.framework.jobs.dao.AsyncJobDao;
|
||||
@ -107,6 +106,7 @@ import com.cloud.capacity.dao.CapacityDaoImpl.SummedCapacity;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationService;
|
||||
import com.cloud.configuration.Resource.ResourceType;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.AccountVlanMapVO;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterDetailsVO;
|
||||
|
||||
@ -114,14 +114,14 @@ import org.apache.cloudstack.api.response.CreateCmdResponse;
|
||||
import org.apache.cloudstack.api.response.ExceptionResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.framework.config.ConfigurationVO;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.framework.jobs.AsyncJob;
|
||||
import org.apache.cloudstack.framework.jobs.AsyncJobManager;
|
||||
import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
|
||||
|
||||
import com.cloud.api.response.ApiResponseSerializer;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.event.ActionEventUtils;
|
||||
|
||||
@ -79,7 +79,6 @@ import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.query.QueryService;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@ -126,6 +125,7 @@ import com.cloud.api.query.vo.TemplateJoinVO;
|
||||
import com.cloud.api.query.vo.UserAccountJoinVO;
|
||||
import com.cloud.api.query.vo.UserVmJoinVO;
|
||||
import com.cloud.api.query.vo.VolumeJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.dc.DedicatedResourceVO;
|
||||
import com.cloud.dc.dao.DedicatedResourceDao;
|
||||
import com.cloud.domain.Domain;
|
||||
|
||||
@ -22,14 +22,13 @@ import java.util.List;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.api.ApiResponseHelper;
|
||||
import com.cloud.api.query.vo.AffinityGroupJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
||||
@ -24,13 +24,12 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.response.DomainRouterResponse;
|
||||
import org.apache.cloudstack.api.response.NicResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.ApiResponseHelper;
|
||||
import com.cloud.api.query.vo.DomainRouterJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.network.Networks.TrafficType;
|
||||
import com.cloud.network.router.VirtualRouter;
|
||||
import com.cloud.network.router.VirtualRouter.Role;
|
||||
|
||||
@ -30,13 +30,12 @@ import javax.inject.Inject;
|
||||
import org.apache.cloudstack.api.ApiConstants.HostDetails;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.HostForMigrationResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.query.vo.HostJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostStats;
|
||||
import com.cloud.storage.StorageStats;
|
||||
|
||||
@ -24,12 +24,11 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.response.ImageStoreDetailResponse;
|
||||
import org.apache.cloudstack.api.response.ImageStoreResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.query.vo.ImageStoreJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
|
||||
@ -23,8 +23,6 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -32,6 +30,7 @@ import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.query.vo.AccountJoinVO;
|
||||
import com.cloud.api.query.vo.ProjectJoinVO;
|
||||
import com.cloud.api.query.vo.ResourceTagJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.projects.Project;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.user.dao.AccountDao;
|
||||
|
||||
@ -23,13 +23,12 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.response.ResourceTagResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.ApiResponseHelper;
|
||||
import com.cloud.api.query.vo.ResourceTagJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.server.ResourceTag;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
|
||||
@ -24,8 +24,6 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.response.SecurityGroupResponse;
|
||||
import org.apache.cloudstack.api.response.SecurityGroupRuleResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -33,6 +31,7 @@ import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.ApiResponseHelper;
|
||||
import com.cloud.api.query.vo.ResourceTagJoinVO;
|
||||
import com.cloud.api.query.vo.SecurityGroupJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.network.security.SecurityGroup;
|
||||
import com.cloud.network.security.SecurityRule.SecurityRuleType;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@ -21,16 +21,14 @@ import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.query.vo.StoragePoolJoinVO;
|
||||
import com.cloud.capacity.Capacity;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.storage.ScopeType;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.StorageStats;
|
||||
|
||||
@ -29,7 +29,6 @@ import org.apache.cloudstack.api.response.TemplateResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -38,6 +37,7 @@ import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.ApiResponseHelper;
|
||||
import com.cloud.api.query.vo.ResourceTagJoinVO;
|
||||
import com.cloud.api.query.vo.TemplateJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.Storage.TemplateType;
|
||||
import com.cloud.storage.VMTemplateHostVO;
|
||||
|
||||
@ -31,14 +31,13 @@ import org.apache.cloudstack.api.ApiConstants.VMDetails;
|
||||
import org.apache.cloudstack.api.response.NicResponse;
|
||||
import org.apache.cloudstack.api.response.SecurityGroupResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.query.vo.ResourceTagJoinVO;
|
||||
import com.cloud.api.query.vo.UserVmJoinVO;
|
||||
import com.cloud.configuration.dao.ConfigurationDao;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.uservm.UserVm;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user