Skip to content

Commit 8670f25

Browse files
Update plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 1268f5d commit 8670f25

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,18 @@ public boolean isPoolSupportHA() {
327327
public String getHearthBeatPath() {
328328
if (StoragePoolType.NetworkFilesystem.equals(type)) {
329329
String kvmScriptsDir = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.KVM_SCRIPTS_DIR);
330-
return Script.findScript(kvmScriptsDir, "kvmheartbeat.sh");
330+
String scriptPath = Script.findScript(kvmScriptsDir, "kvmheartbeat.sh");
331+
if (scriptPath == null) {
332+
throw new CloudRuntimeException("Unable to find heartbeat script 'kvmheartbeat.sh' in directory: " + kvmScriptsDir);
333+
}
334+
return scriptPath;
331335
} else if (StoragePoolType.SharedMountPoint.equals(type)) {
332336
String kvmScriptsDir = AgentPropertiesFileHandler.getPropertyValue(AgentProperties.KVM_SCRIPTS_DIR);
333-
return Script.findScript(kvmScriptsDir, "kvmsmpheartbeat.sh");
337+
String scriptPath = Script.findScript(kvmScriptsDir, "kvmsmpheartbeat.sh");
338+
if (scriptPath == null) {
339+
throw new CloudRuntimeException("Unable to find heartbeat script 'kvmsmpheartbeat.sh' in directory: " + kvmScriptsDir);
340+
}
341+
return scriptPath;
334342
}
335343
return null;
336344
}

0 commit comments

Comments
 (0)