mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Configuration: define "host" global config parameter in cloud-api package instead of ClusterManager as the parameter is mostly used by sevices components running remotely (consoleProxy, secondarystorage), or by third party integrators.
Also intoroduced one more global config parameter - api.servlet.endpoint (default value is "http://localhost:8080/client/api?"). The parameter defines API end point. Can be used by CS components/services deployed remotely, for sending CS API requests
This commit is contained in:
parent
ac65f8fddf
commit
452c20b242
@ -0,0 +1,37 @@
|
||||
// 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 org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
|
||||
public class ApiServiceConfiguration implements Configurable {
|
||||
public static final ConfigKey<String> ManagementHostIPAdr = new ConfigKey<String>("Advanced", String.class, "host", "localhost", "The ip address of management server", true);
|
||||
public static final ConfigKey<String> ApiServletPath = new ConfigKey<String>("Advanced", String.class, "api.servlet.endpoint", "http://localhost:8080/client/api?",
|
||||
"API end point. Can be used by CS components/services deployed remotely, for sending CS API requests", true);
|
||||
|
||||
@Override
|
||||
public String getConfigComponentName() {
|
||||
return ApiServiceConfiguration.class.getSimpleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
return new ConfigKey<?>[] {ManagementHostIPAdr};
|
||||
}
|
||||
|
||||
}
|
||||
@ -34,14 +34,14 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
|
||||
import org.apache.cloudstack.config.ApiServiceConfiguration;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -52,7 +52,6 @@ import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
|
||||
import com.cloud.agent.api.routing.NetworkElementCommand;
|
||||
import com.cloud.agent.api.to.LoadBalancerTO;
|
||||
import com.cloud.agent.manager.Commands;
|
||||
import com.cloud.cluster.ClusterManager;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
@ -802,7 +801,7 @@ public class ElasticLoadBalancerManagerImpl extends ManagerBase implements Elast
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Check if we need to add management server explicit route to ELB vm. pod cidr: " + dest.getPod().getCidrAddress() + "/" +
|
||||
dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " +
|
||||
ClusterManager.ManagementHostIPAdr.value());
|
||||
ApiServiceConfiguration.ManagementHostIPAdr.value());
|
||||
}
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
||||
@ -28,11 +28,7 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import org.apache.cloudstack.config.ApiServiceConfiguration;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
@ -44,6 +40,7 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -138,6 +135,8 @@ import com.cloud.vm.VirtualMachineProfile;
|
||||
import com.cloud.vm.dao.ConsoleProxyDao;
|
||||
import com.cloud.vm.dao.UserVmDetailsDao;
|
||||
import com.cloud.vm.dao.VMInstanceDao;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
//
|
||||
// Possible console proxy state transition cases
|
||||
@ -1299,7 +1298,7 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
|
||||
|
||||
StringBuilder buf = profile.getBootArgsBuilder();
|
||||
buf.append(" template=domP type=consoleproxy");
|
||||
buf.append(" host=").append(ClusterManager.ManagementHostIPAdr.value());
|
||||
buf.append(" host=").append(ApiServiceConfiguration.ManagementHostIPAdr.value());
|
||||
buf.append(" port=").append(_mgmtPort);
|
||||
buf.append(" name=").append(profile.getVirtualMachine().getHostName());
|
||||
if (_sslEnabled) {
|
||||
|
||||
@ -42,11 +42,10 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.router.RebootRouterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
|
||||
import org.apache.cloudstack.config.ApiServiceConfiguration;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
@ -57,6 +56,7 @@ import org.apache.cloudstack.framework.jobs.AsyncJobManager;
|
||||
import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
|
||||
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.Listener;
|
||||
@ -107,7 +107,6 @@ import com.cloud.alert.AlertManager;
|
||||
import com.cloud.api.ApiAsyncJobDispatcher;
|
||||
import com.cloud.api.ApiDispatcher;
|
||||
import com.cloud.api.ApiGsonHelper;
|
||||
import com.cloud.cluster.ClusterManager;
|
||||
import com.cloud.cluster.ManagementServerHostVO;
|
||||
import com.cloud.cluster.dao.ManagementServerHostDao;
|
||||
import com.cloud.configuration.Config;
|
||||
@ -2050,7 +2049,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
||||
// DOMR control command is sent over management server in VMware
|
||||
if (dest.getHost().getHypervisorType() == HypervisorType.VMware || dest.getHost().getHypervisorType() == HypervisorType.Hyperv) {
|
||||
s_logger.info("Check if we need to add management server explicit route to DomR. pod cidr: " + dest.getPod().getCidrAddress() + "/" +
|
||||
dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " + ClusterManager.ManagementHostIPAdr.value());
|
||||
dest.getPod().getCidrSize() + ", pod gateway: " + dest.getPod().getGateway() + ", management host: " + ApiServiceConfiguration.ManagementHostIPAdr.value());
|
||||
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Add management server explicit route to DomR.");
|
||||
|
||||
@ -32,9 +32,9 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -43,6 +43,7 @@ import javax.crypto.SecretKey;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.config.ApiServiceConfiguration;
|
||||
import org.apache.cloudstack.framework.config.ConfigDepot;
|
||||
import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
@ -52,7 +53,6 @@ import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.cluster.ClusterManager;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.Resource;
|
||||
@ -240,14 +240,14 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
||||
if (hostIpAdr != null) {
|
||||
Boolean devel = Boolean.valueOf(_configDao.getValue("developer"));
|
||||
if (devel) {
|
||||
String value = _configDao.getValue(ClusterManager.ManagementHostIPAdr.key());
|
||||
String value = _configDao.getValue(ApiServiceConfiguration.ManagementHostIPAdr.key());
|
||||
if (value != null && !value.equals("localhost")) {
|
||||
needUpdateHostIp = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (needUpdateHostIp) {
|
||||
_configDao.update(ClusterManager.ManagementHostIPAdr.key(), ClusterManager.ManagementHostIPAdr.category(), hostIpAdr);
|
||||
_configDao.update(ApiServiceConfiguration.ManagementHostIPAdr.key(), ApiServiceConfiguration.ManagementHostIPAdr.category(), hostIpAdr);
|
||||
s_logger.debug("ConfigurationServer saved \"" + hostIpAdr + "\" as host.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,8 +30,7 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.config.ApiServiceConfiguration;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
@ -43,6 +42,7 @@ import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.utils.identity.ManagementServerNode;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.api.Answer;
|
||||
@ -1014,7 +1014,7 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
||||
|
||||
StringBuilder buf = profile.getBootArgsBuilder();
|
||||
buf.append(" template=domP type=secstorage");
|
||||
buf.append(" host=").append(ClusterManager.ManagementHostIPAdr.value());
|
||||
buf.append(" host=").append(ApiServiceConfiguration.ManagementHostIPAdr.value());
|
||||
buf.append(" port=").append(_mgmtPort);
|
||||
buf.append(" name=").append(profile.getVirtualMachine().getHostName());
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ CREATE VIEW `cloud`.`disk_offering_view` AS
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`service_offering_view`;
|
||||
CREATE VIEW `cloud`.`service_offering_view` AS
|
||||
select
|
||||
select
|
||||
service_offering.id,
|
||||
disk_offering.uuid,
|
||||
disk_offering.name,
|
||||
@ -212,10 +212,10 @@ CREATE VIEW `cloud`.`service_offering_view` AS
|
||||
`cloud`.`domain` ON disk_offering.domain_id = domain.id
|
||||
where
|
||||
disk_offering.state='Active';
|
||||
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`template_view`;
|
||||
CREATE VIEW `cloud`.`template_view` AS
|
||||
select
|
||||
select
|
||||
vm_template.id,
|
||||
vm_template.uuid,
|
||||
vm_template.unique_name,
|
||||
@ -257,7 +257,7 @@ CREATE VIEW `cloud`.`template_view` AS
|
||||
domain.path domain_path,
|
||||
projects.id project_id,
|
||||
projects.uuid project_uuid,
|
||||
projects.name project_name,
|
||||
projects.name project_name,
|
||||
data_center.id data_center_id,
|
||||
data_center.uuid data_center_uuid,
|
||||
data_center.name data_center_name,
|
||||
@ -287,23 +287,23 @@ CREATE VIEW `cloud`.`template_view` AS
|
||||
from
|
||||
`cloud`.`vm_template`
|
||||
inner join
|
||||
`cloud`.`guest_os` ON guest_os.id = vm_template.guest_os_id
|
||||
`cloud`.`guest_os` ON guest_os.id = vm_template.guest_os_id
|
||||
inner join
|
||||
`cloud`.`account` ON account.id = vm_template.account_id
|
||||
inner join
|
||||
`cloud`.`domain` ON domain.id = account.domain_id
|
||||
left join
|
||||
`cloud`.`projects` ON projects.project_account_id = account.id
|
||||
`cloud`.`projects` ON projects.project_account_id = account.id
|
||||
left join
|
||||
`cloud`.`vm_template_details` ON vm_template_details.template_id = vm_template.id
|
||||
`cloud`.`vm_template_details` ON vm_template_details.template_id = vm_template.id
|
||||
left join
|
||||
`cloud`.`vm_template` source_template ON source_template.id = vm_template.source_template_id
|
||||
`cloud`.`vm_template` source_template ON source_template.id = vm_template.source_template_id
|
||||
left join
|
||||
`cloud`.`template_store_ref` ON template_store_ref.template_id = vm_template.id and template_store_ref.store_role = 'Image'
|
||||
left join
|
||||
`cloud`.`image_store` ON image_store.removed is NULL AND template_store_ref.store_id is not NULL AND image_store.id = template_store_ref.store_id
|
||||
`cloud`.`image_store` ON image_store.removed is NULL AND template_store_ref.store_id is not NULL AND image_store.id = template_store_ref.store_id
|
||||
left join
|
||||
`cloud`.`template_zone_ref` ON template_zone_ref.template_id = vm_template.id AND template_store_ref.store_id is NULL AND template_zone_ref.removed is null
|
||||
`cloud`.`template_zone_ref` ON template_zone_ref.template_id = vm_template.id AND template_store_ref.store_id is NULL AND template_zone_ref.removed is null
|
||||
left join
|
||||
`cloud`.`data_center` ON (image_store.data_center_id = data_center.id OR template_zone_ref.zone_id = data_center.id)
|
||||
left join
|
||||
@ -420,7 +420,7 @@ CREATE VIEW `cloud`.`volume_view` AS
|
||||
`cloud`.`async_job` ON async_job.instance_id = volumes.id
|
||||
and async_job.instance_type = 'Volume'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`storage_pool_view`;
|
||||
CREATE VIEW `cloud`.`storage_pool_view` AS
|
||||
select
|
||||
@ -897,3 +897,6 @@ ALTER TABLE `cloud`.`vm_instance` DROP COLUMN `speed`;
|
||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, max_hosts_per_cluster, storage_motion_supported, vm_snapshot_enabled) VALUES (UUID(), 'VMware', '5.5', 128, 0, 13, 32, 1, 1);
|
||||
|
||||
ALTER TABLE `cloud`.`network_acl_item` modify `cidr` varchar(2048);
|
||||
|
||||
INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Advanced", 'DEFAULT', 'management-server', "api.servlet.endpoint", "http://localhost:8080/client/api?", "API end point. Can be used by CS components/services deployed remotely, for sending CS API requests", "http://localhost:8080/client/api?", NULL,NULL,0);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user