CLOUDSTACK-3091: expect UUID instead of actual DB id, when read internallbvm.service.offering global config

This commit is contained in:
Alena Prokharchyk 2013-06-20 10:06:33 -07:00
parent cd221fc33e
commit bf331064a2
2 changed files with 15 additions and 6 deletions

View File

@ -129,7 +129,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
private String _instance;
private String _mgmtHost;
private String _mgmtCidr;
private long _internalLbVmOfferingId;
private long _internalLbVmOfferingId = 0L;
@Inject VirtualMachineManager _itMgr;
@Inject DomainRouterDao _internalLbVmDao;
@ -394,10 +394,19 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
_mgmtHost = configs.get("host");
_mgmtCidr = _configDao.getValue(Config.ManagementNetwork.key());
String offIdStr = configs.get(Config.InternalLbVmServiceOfferingId.key());
if (offIdStr != null && !offIdStr.isEmpty()) {
_internalLbVmOfferingId = Long.parseLong(offIdStr);
} else {
String offUUID = configs.get(Config.InternalLbVmServiceOfferingId.key());
if (offUUID != null && !offUUID.isEmpty()) {
//get the id by offering UUID
ServiceOfferingVO off = _serviceOfferingDao.findByUuid(offUUID);
if (off != null) {
_internalLbVmOfferingId = off.getId();
} else {
s_logger.warn("Invalid offering UUID is passed in " + Config.InternalLbVmServiceOfferingId.key() + "; the default offering will be used instead");
}
}
//if offering wasn't set, try to get the default one
if (_internalLbVmOfferingId == 0L) {
boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
ServiceOfferingVO newOff = new ServiceOfferingVO("System Offering For Internal LB VM", 1, InternalLoadBalancerVMManager.DEFAULT_INTERNALLB_VM_RAMSIZE, InternalLoadBalancerVMManager.DEFAULT_INTERNALLB_VM_CPU_MHZ, null,
null, true, null, useLocalStorage, true, null, true, VirtualMachine.Type.InternalLoadBalancerVm, true);

View File

@ -431,7 +431,7 @@ public enum Config {
BlacklistedRoutes("Advanced", VpcManager.class, String.class, "blacklisted.routes", null, "Routes that are blacklisted, can not be used for Static Routes creation for the VPC Private Gateway",
"routes", ConfigurationParameterScope.zone.toString()),
InternalLbVmServiceOfferingId("Advanced", ManagementServer.class, Long.class, "internallbvm.service.offering", null, "Uuid of the service offering used by internal lb vm; if NULL - default system internal lb offering will be used", null),
InternalLbVmServiceOfferingId("Advanced", ManagementServer.class, String.class, "internallbvm.service.offering", null, "Uuid of the service offering used by internal lb vm; if NULL - default system internal lb offering will be used", null),
ExecuteInSequence("Advanced", ManagementServer.class, Boolean.class, "execute.in.sequence.hypervisor.commands", "false", "If set to true, StartCommand, StopCommand, CopyVolumeCommand, CreateCommand will be synchronized on the agent side." +
" If set to false, these commands become asynchronous. Default value is false.", null),
ExecuteInSequenceNetworkElementCommands("Advanced", NetworkManager.class, Boolean.class, "execute.in.sequence.network.element.commands", "false", "If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side." +