Skip to content

Commit 0174a13

Browse files
committed
Fix some NPEs in External Hypervisor framework
1 parent 069f8f2 commit 0174a13

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

plugins/hypervisors/external/src/main/java/org/apache/cloudstack/guru/ExternalHypervisorGuru.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ public List<Command> finalizeExpunge(VirtualMachine vm) {
120120

121121
public static void loadExternalResourceAccessDetails(Map<String, String> resourceDetails, Map<String, String> accessDetails) {
122122
Map<String, String> externalInstanceDetails = new HashMap<>();
123+
if (resourceDetails == null) {
124+
return;
125+
}
123126
for (Map.Entry<String, String> entry : resourceDetails.entrySet()) {
124127
if (entry.getKey().startsWith(VmDetailConstants.EXTERNAL_DETAIL_PREFIX)) {
125128
externalInstanceDetails.put(entry.getKey(), entry.getValue());

plugins/hypervisors/external/src/main/java/org/apache/cloudstack/hypervisor/external/resource/ExternalResourceBase.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.apache.cloudstack.hypervisor.external.resource;
1818

1919
import java.util.ArrayList;
20+
import java.util.HashMap;
2021
import java.util.List;
2122
import java.util.Map;
2223

@@ -177,7 +178,7 @@ public RunCustomActionAnswer execute(RunCustomActionCommand cmd) {
177178
}
178179

179180
public Answer execute(Command cmd) {
180-
RunCustomActionCommand runCustomActionCommand = new RunCustomActionCommand(cmd.toString(), null);
181+
RunCustomActionCommand runCustomActionCommand = new RunCustomActionCommand(cmd.toString(), new HashMap<>());
181182
RunCustomActionAnswer customActionAnswer = externalProvisioner.runCustomAction(_extensionName, runCustomActionCommand);
182183
Answer answer = new Answer(cmd, customActionAnswer.getResult(), customActionAnswer.getRunDetails().toString());
183184
return answer;
@@ -259,6 +260,7 @@ public void setRunLevel(int level) {
259260
@Override
260261
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
261262
externalProvisioner = ComponentContext.inject(SimpleExternalProvisioner.class);
263+
externalProvisioner.configure(name, params);
262264
_externalAgentMgr = ComponentContext.inject(ExternalAgentManagerImpl.class);
263265
_externalAgentMgr.configure(name, params);
264266

0 commit comments

Comments
 (0)