mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix NPE in adding host and also put back lost change in deployDataCenter
due to rebase with master.
This commit is contained in:
parent
1bd216fc48
commit
0d580ccb26
@ -463,7 +463,9 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
if (callbackResult.isFailed()) {
|
||||
template.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed);
|
||||
result.setResult(callbackResult.getResult());
|
||||
parentCallback.complete(result);
|
||||
if ( parentCallback != null ){
|
||||
parentCallback.complete(result);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -471,7 +473,9 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
template.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed);
|
||||
} catch (Exception e) {
|
||||
result.setResult(e.toString());
|
||||
parentCallback.complete(result);
|
||||
if ( parentCallback != null ){
|
||||
parentCallback.complete(result);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -736,7 +736,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
||||
DataStoreRole.Primary);
|
||||
}
|
||||
|
||||
HostScope scope = new HostScope(host.getId(), pool.getDataCenterId());
|
||||
HostScope scope = new HostScope(host.getId(), host.getDataCenterId());
|
||||
lifeCycle.attachHost(store, scope, pInfo);
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Unable to setup the local storage pool for " + host, e);
|
||||
|
||||
@ -106,7 +106,7 @@
|
||||
],
|
||||
"cacheStorages": [
|
||||
{
|
||||
"url": "nfs://192.168.56.10/opt/storage/cache",
|
||||
"url": "nfs://192.168.56.10/opt/storage/secondary",
|
||||
"providerName": "NFS",
|
||||
"details": [
|
||||
]
|
||||
|
||||
@ -138,10 +138,28 @@ class deployDataCenters():
|
||||
if secondaryStorages is None:
|
||||
return
|
||||
for secondary in secondaryStorages:
|
||||
secondarycmd = addSecondaryStorage.addSecondaryStorageCmd()
|
||||
secondarycmd = addImageStore.addImageStoreCmd()
|
||||
secondarycmd.url = secondary.url
|
||||
secondarycmd.zoneid = zoneId
|
||||
self.apiClient.addSecondaryStorage(secondarycmd)
|
||||
secondarycmd.provider = secondary.providerName
|
||||
secondarycmd.details = []
|
||||
for item in secondary.details:
|
||||
secondarycmd.details.append(item.__dict__)
|
||||
if secondarycmd.provider == "NFS":
|
||||
secondarycmd.zoneid = zoneId
|
||||
self.apiClient.addImageStore(secondarycmd)
|
||||
|
||||
def createCacheStorages(self, cacheStorages, zoneId):
|
||||
if cacheStorages is None:
|
||||
return
|
||||
for cache in cacheStorages:
|
||||
cachecmd = createCacheStore.createCacheStoreCmd()
|
||||
cachecmd.url = cache.url
|
||||
cachecmd.provider = cache.providerName
|
||||
cachecmd.zoneid = zoneId
|
||||
cachecmd.details = []
|
||||
for item in cache.details:
|
||||
cachecmd.details.append(item.__dict__)
|
||||
self.apiClient.createCacheStore(cachecmd)
|
||||
|
||||
def createnetworks(self, networks, zoneId):
|
||||
if networks is None:
|
||||
@ -328,6 +346,7 @@ class deployDataCenters():
|
||||
zoneId)
|
||||
|
||||
self.createSecondaryStorages(zone.secondaryStorages, zoneId)
|
||||
self.createCacheStorages(zone.cacheStorages, zoneId)
|
||||
|
||||
enabled = getattr(zone, 'enabled', 'True')
|
||||
if enabled == 'True' or enabled is None:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user