Check to see if the Map<String, String> of capabilities passed back from the storage driver is null.

This commit is contained in:
Mike Tutkowski 2014-11-06 19:49:44 -07:00
parent ebb96f5e2f
commit 9338abb6f3
2 changed files with 12 additions and 8 deletions

View File

@ -517,11 +517,13 @@ public class ApiResponseHelper implements ResponseGenerator {
Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
Boolean supportsStorageSystemSnapshots = new Boolean(value);
if (mapCapabilities != null) {
String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
Boolean supportsStorageSystemSnapshots = new Boolean(value);
if (supportsStorageSystemSnapshots) {
return DataStoreRole.Primary;
if (supportsStorageSystemSnapshots) {
return DataStoreRole.Primary;
}
}
return DataStoreRole.Image;

View File

@ -1485,11 +1485,13 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();
String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
Boolean supportsStorageSystemSnapshots = new Boolean(value);
if (mapCapabilities != null) {
String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
Boolean supportsStorageSystemSnapshots = new Boolean(value);
if (supportsStorageSystemSnapshots) {
return DataStoreRole.Primary;
if (supportsStorageSystemSnapshots) {
return DataStoreRole.Primary;
}
}
return DataStoreRole.Image;