Add data integrity check for Console Proxy/SSVM/Domain Router

This commit is contained in:
Kelven Yang 2011-07-06 17:22:14 -07:00
parent 7e9836dfd0
commit e522ecb3a1
3 changed files with 21 additions and 0 deletions

View File

@ -1248,6 +1248,13 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
_serviceOffering = new ServiceOfferingVO("System Offering For Console Proxy", 1, _proxyRamSize, _proxyCpuMHz, 0, 0, false, null, useLocalStorage, true, null, true, VirtualMachine.Type.ConsoleProxy, true);
_serviceOffering.setUniqueName("Cloud.com-ConsoleProxy");
_serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering);
// this can sometimes happen, if DB is manually or programmatically manipulated
if(_serviceOffering == null) {
String msg = "Data integrity problem : System Offering For Console Proxy has been removed?";
s_logger.error(msg);
throw new ConfigurationException(msg);
}
_loadScanner = new SystemVmLoadScanner<Long>(this);
_loadScanner.initScan(STARTUP_DELAY, _capacityScanInterval);

View File

@ -550,6 +550,13 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
_offering = new ServiceOfferingVO("System Offering For Software Router", 1, _routerRamSize, _routerCpuMHz, null, null, true, null, useLocalStorage, true, null, true, VirtualMachine.Type.DomainRouter, true);
_offering.setUniqueName("Cloud.Com-SoftwareRouter");
_offering = _serviceOfferingDao.persistSystemServiceOffering(_offering);
// this can sometimes happen, if DB is manually or programmatically manipulated
if(_offering == null) {
String msg = "Data integrity problem : System Offering For Software router VM has been removed?";
s_logger.error(msg);
throw new ConfigurationException(msg);
}
_systemAcct = _accountService.getSystemAccount();

View File

@ -784,6 +784,13 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
_serviceOffering = new ServiceOfferingVO("System Offering For Secondary Storage VM", 1, _secStorageVmRamSize, _secStorageVmCpuMHz, null, null, false, null, _useLocalStorage, true, null, true, VirtualMachine.Type.SecondaryStorageVm, true);
_serviceOffering.setUniqueName("Cloud.com-SecondaryStorage");
_serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering);
// this can sometimes happen, if DB is manually or programmatically manipulated
if(_serviceOffering == null) {
String msg = "Data integrity problem : System Offering For Secondary Storage VM has been removed?";
s_logger.error(msg);
throw new ConfigurationException(msg);
}
if (_useServiceVM) {
_loadScanner = new SystemVmLoadScanner<Long>(this);