Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions server/src/main/java/com/cloud/configuration/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -1471,14 +1471,6 @@ public enum Config {
"false",
"Should be set to true, if there will be multiple NetScaler devices providing EIP service in a zone",
null),
SecondaryStorageServiceOffering(
"Advanced",
ManagementServer.class,
String.class,
"secstorage.service.offering",
null,
"Uuid of the service offering used by secondary storage; if NULL - system offering will be used",
null),
HaTag("Advanced", ManagementServer.class, String.class, "ha.tag", null, "HA tag defining that the host marked with this tag can be used for HA purposes only", null),
ImplicitHostTags(
"Advanced",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public interface ConsoleProxyManager extends Manager, ConsoleProxyService {
true, ConfigKey.Scope.Zone, null);

ConfigKey<String> ConsoleProxyServiceOffering = new ConfigKey<>(String.class, "consoleproxy.service.offering", "Console Proxy", null,
"Uuid of the service offering used by console proxy; if NULL - system offering will be used", true, ConfigKey.Scope.Zone, null);
"UUID of the system offering used by console proxy VMs. If not found, ACS will create a system offering using the 'console.ram.size' and 'console.cpu.mhz' settings.", true, ConfigKey.Scope.Zone, null);

ConfigKey<String> ConsoleProxyCapacityStandby = new ConfigKey<>(String.class, "consoleproxy.capacity.standby", "Console Proxy", String.valueOf(DEFAULT_STANDBY_CAPACITY),
"The minimal number of console proxy viewer sessions that system is able to serve immediately(standby capacity)", false, ConfigKey.Scope.Zone, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ public ConsoleProxyVO assignProxyFromStoppedPool(long dataCenterId) {
return null;
}

public ConsoleProxyVO startNew(long dataCenterId) throws ConcurrentOperationException, ConfigurationException {
public ConsoleProxyVO startNew(long dataCenterId) throws ConcurrentOperationException {

if (logger.isDebugEnabled()) {
logger.debug("Assign console proxy from a newly started Instance for request from data center : " + dataCenterId);
Expand Down Expand Up @@ -692,7 +692,7 @@ protected ConsoleProxyVO createOrUpdateConsoleProxy(ConsoleProxyVO proxy, long d
return proxy;
}

protected Map<String, Object> createProxyInstance(long dataCenterId, List<VMTemplateVO> templates) throws ConcurrentOperationException, ConfigurationException {
protected Map<String, Object> createProxyInstance(long dataCenterId, List<VMTemplateVO> templates) throws ConcurrentOperationException {

long id = consoleProxyDao.getNextInSequence(Long.class, "id");
String name = VirtualMachineName.getConsoleProxyName(id, instance);
Expand Down Expand Up @@ -844,7 +844,7 @@ private void allocCapacity(long dataCenterId) {
if (allocProxyLock.lock(ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_SYNC_IN_SECONDS)) {
try {
proxy = startNew(dataCenterId);
} catch (ConcurrentOperationException | ConfigurationException e) {
} catch (ConcurrentOperationException e) {
logger.warn("Unable to start new console proxy on zone [{}] due to [{}].", zone, e.getMessage(), e);
} finally {
allocProxyLock.unlock();
Expand Down Expand Up @@ -1641,7 +1641,7 @@ private Integer getStandbyCapacity(Long datacenterId) {
return Integer.parseInt(ConsoleProxyCapacityStandby.valueIn(datacenterId));
}

private ServiceOfferingVO getConsoleProxyServiceOffering(Long datacenterId) throws ConfigurationException {
private ServiceOfferingVO getConsoleProxyServiceOffering(Long datacenterId) {
String configKey = ConsoleProxyServiceOffering.key();
String cpvmSrvcOffIdStr = ConsoleProxyServiceOffering.valueIn(datacenterId);
String warningMessage = String.format("Unable to find a service offering by the UUID or ID for console proxy VM with the value [%s] set in the configuration [%s]", cpvmSrvcOffIdStr, configKey);
Expand All @@ -1650,7 +1650,12 @@ private ServiceOfferingVO getConsoleProxyServiceOffering(Long datacenterId) thro
serviceOfferingVO = getServiceOfferingByUuidOrId(cpvmSrvcOffIdStr, warningMessage, configKey);
}

if (serviceOfferingVO == null || !serviceOfferingVO.isSystemUse()) {
if (serviceOfferingVO != null && !serviceOfferingVO.isSystemUse()) {
logger.warn("The service offering [{}] set in the configuration [{}] for console proxy VM is not a system offering. The default system offering will be used instead.", cpvmSrvcOffIdStr, configKey);
serviceOfferingVO = null;
}

if (serviceOfferingVO == null) {
logger.debug("Service offering for console proxy VM is not set or not a system service offering. Creating a default service offering.");
createServiceOfferingForConsoleProxy();
}
Expand All @@ -1674,17 +1679,17 @@ private ServiceOfferingVO getServiceOfferingByUuidOrId(String cpvmSrvcOffIdStr,
return serviceOfferingVO;
}

private void createServiceOfferingForConsoleProxy() throws ConfigurationException {
private void createServiceOfferingForConsoleProxy() {
int ramSize = NumbersUtil.parseInt(configurationDao.getValue("console.ram.size"), DEFAULT_PROXY_VM_RAMSIZE);
int cpuFreq = NumbersUtil.parseInt(configurationDao.getValue("console.cpu.mhz"), DEFAULT_PROXY_VM_CPUMHZ);
List<ServiceOfferingVO> offerings = serviceOfferingDao.createSystemServiceOfferings("System Offering For Console Proxy",
ServiceOffering.consoleProxyDefaultOffUniqueName, 1, ramSize, cpuFreq, 0, 0, false, null,
Storage.ProvisioningType.THIN, true, null, true, VirtualMachine.Type.ConsoleProxy, true);

if (offerings == null || offerings.size() < 2) {
String msg = "Data integrity problem : System Offering For Console Proxy has been removed?";
String msg = "Unable to set a service offering for console proxy VM. Verify if it was removed.";
logger.error(msg);
throw new ConfigurationException(msg);
throw new CloudRuntimeException(msg);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public interface SecondaryStorageVmManager extends Manager {
"The time interval(in millisecond) to scan whether or not system needs more SSVM to ensure minimal standby capacity",
false);

ConfigKey<String> SecondaryStorageServiceOffering = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, String.class, "secstorage.service.offering", null,
"UUID of the system offering used by secondary storage VMs. If not found, ACS will create a system offering using the 'ssvm.ram.size' and 'ssvm.cpu.mhz' settings.", true, ConfigKey.Scope.Zone);

ConfigKey<String> SecondaryStorageVmUserData = new ConfigKey<>(String.class, "secstorage.vm.userdata",
ConfigKey.CATEGORY_ADVANCED, "",
"UUID for user data for secondary storage VMs. This works only when systemvm.userdata.enabled is set to true",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
protected SnapshotDao _snapshotDao;
private SecondaryStorageListener _listener;

private ServiceOfferingVO _serviceOffering;

@Inject
protected ConfigurationDao _configDao;
@Inject
Expand Down Expand Up @@ -685,7 +683,7 @@ protected Map<String, Object> createSecStorageVmInstance(long dataCenterId, Seco
throw new CloudRuntimeException(String.format("Unable to find the system Templates or it was not downloaded in %s.", dc));
}

ServiceOfferingVO serviceOffering = _serviceOffering;
ServiceOfferingVO serviceOffering = findSecondaryStorageVmDefaultOffering(dataCenterId);
if (serviceOffering == null) {
serviceOffering = _offeringDao.findDefaultSystemOffering(ServiceOffering.ssvmDefaultOffUniqueName, ConfigurationManagerImpl.SystemVMUseLocalStorage.valueIn(dataCenterId));
}
Expand Down Expand Up @@ -713,6 +711,47 @@ protected Map<String, Object> createSecStorageVmInstance(long dataCenterId, Seco
return context;
}

private ServiceOfferingVO findSecondaryStorageVmDefaultOffering(long zoneId) {
ServiceOfferingVO serviceOfferingVO = null;
String configValue = SecondaryStorageServiceOffering.valueIn(zoneId);
String configKey = SecondaryStorageServiceOffering.key();
if (configValue != null) {
serviceOfferingVO = _offeringDao.findByUuid(configValue);
if (serviceOfferingVO == null) {
try {
logger.debug("Unable to find a service offering by the UUID for secondary storage VM with the value [{}] set in the configuration [{}]. Trying to find by the ID.", configValue, configKey);
serviceOfferingVO = _offeringDao.findById(Long.parseLong(configValue));

if (serviceOfferingVO == null) {
logger.warn("Unable to find a service offering by the UUID or ID for secondary storage VM with the value [{}] set in the configuration [{}]", configValue, configKey);
}
} catch (NumberFormatException ex) {
logger.warn("Unable to find a service offering by the ID for secondary storage VM with the value [{}] set in the configuration [{}]. The value is not a valid integer number. Error: [{}].", configValue, configKey, ex.getMessage(), ex);
}
}
}

if (serviceOfferingVO != null && !serviceOfferingVO.isSystemUse()) {
logger.warn("The service offering [{}] set in the configuration [{}] for secondary storage VM is not a system offering. The default system offering will be used instead.", configValue, configKey);
serviceOfferingVO = null;
}

if (serviceOfferingVO == null) {
int ramSize = NumbersUtil.parseInt(_configDao.getValue("ssvm.ram.size"), DEFAULT_SS_VM_RAMSIZE);
int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("ssvm.cpu.mhz"), DEFAULT_SS_VM_CPUMHZ);
List<ServiceOfferingVO> offerings = _offeringDao.createSystemServiceOfferings("System Offering For Secondary Storage VM",
ServiceOffering.ssvmDefaultOffUniqueName, 1, ramSize, cpuFreq, null, null, false, null,
Storage.ProvisioningType.THIN, true, null, true, VirtualMachine.Type.SecondaryStorageVm, true);

if (offerings == null || offerings.size() < 2) {
String msg = "Unable to set a service offering for secondary storage VM. Verify if it was removed.";
logger.error(msg);
throw new CloudRuntimeException(msg);
}
}
return serviceOfferingVO;
}

private SecondaryStorageVmAllocator getCurrentAllocator() {
if (_ssVmAllocators.size() > 0) {
return _ssVmAllocators.get(0);
Expand Down Expand Up @@ -943,38 +982,6 @@ public boolean configure(String name, Map<String, Object> params) throws Configu

_itMgr.registerGuru(VirtualMachine.Type.SecondaryStorageVm, this);

String configKey = Config.SecondaryStorageServiceOffering.key();
String ssvmSrvcOffIdStr = configs.get(configKey);
if (ssvmSrvcOffIdStr != null) {
_serviceOffering = _offeringDao.findByUuid(ssvmSrvcOffIdStr);
if (_serviceOffering == null) {
try {
logger.debug(String.format("Unable to find a service offering by the UUID for secondary storage VM with the value [%s] set in the configuration [%s]. Trying to find by the ID.", ssvmSrvcOffIdStr, configKey));
_serviceOffering = _offeringDao.findById(Long.parseLong(ssvmSrvcOffIdStr));

if (_serviceOffering == null) {
logger.info(String.format("Unable to find a service offering by the UUID or ID for secondary storage VM with the value [%s] set in the configuration [%s]", ssvmSrvcOffIdStr, configKey));
}
} catch (NumberFormatException ex) {
logger.warn(String.format("Unable to find a service offering by the ID for secondary storage VM with the value [%s] set in the configuration [%s]. The value is not a valid integer number. Error: [%s].", ssvmSrvcOffIdStr, configKey, ex.getMessage()), ex);
}
}
}

if (_serviceOffering == null || !_serviceOffering.isSystemUse()) {
int ramSize = NumbersUtil.parseInt(_configDao.getValue("ssvm.ram.size"), DEFAULT_SS_VM_RAMSIZE);
int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("ssvm.cpu.mhz"), DEFAULT_SS_VM_CPUMHZ);
List<ServiceOfferingVO> offerings = _offeringDao.createSystemServiceOfferings("System Offering For Secondary Storage VM",
ServiceOffering.ssvmDefaultOffUniqueName, 1, ramSize, cpuFreq, null, null, false, null,
Storage.ProvisioningType.THIN, true, null, true, VirtualMachine.Type.SecondaryStorageVm, true);

if (offerings == null || offerings.size() < 2) {
String msg = "Unable to set a service offering for secondary storage VM. Verify if it was removed.";
logger.error(msg);
throw new ConfigurationException(msg);
}
}

if (_useServiceVM) {
_loadScanner = new SystemVmLoadScanner<>(this);
_loadScanner.initScan(STARTUP_DELAY_IN_MILLISECONDS, SecondaryStorageCapacityScanInterval.value());
Expand Down Expand Up @@ -1550,7 +1557,7 @@ public String getConfigComponentName() {
@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {NTPServerConfig, MaxNumberOfSsvmsForMigration, SecondaryStorageCapacityScanInterval,
SecondaryStorageVmUserData};
SecondaryStorageServiceOffering, SecondaryStorageVmUserData};
}

}
Loading