This is an automated email from the ASF dual-hosted git repository.
nvazquez pushed a commit to branch 4.16
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.16 by this push:
new b6072fc826e Allow expunging a VM on a deleted host when using host
cache and ConfigDrive userdata service (#6234)
b6072fc826e is described below
commit b6072fc826ed0b5a66bf530cf7f4ef85b03c6c2d
Author: Pearl Dsilva <[email protected]>
AuthorDate: Mon Apr 11 19:49:37 2022 +0530
Allow expunging a VM on a deleted host when using host cache and
ConfigDrive userdata service (#6234)
---
.../java/com/cloud/network/element/ConfigDriveNetworkElement.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/server/src/main/java/com/cloud/network/element/ConfigDriveNetworkElement.java
b/server/src/main/java/com/cloud/network/element/ConfigDriveNetworkElement.java
index d08ca4ee239..d95ad648d39 100644
---
a/server/src/main/java/com/cloud/network/element/ConfigDriveNetworkElement.java
+++
b/server/src/main/java/com/cloud/network/element/ConfigDriveNetworkElement.java
@@ -23,6 +23,7 @@ import java.util.Set;
import javax.inject.Inject;
+import com.cloud.host.HostVO;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
@@ -563,6 +564,11 @@ public class ConfigDriveNetworkElement extends AdapterBase
implements NetworkEle
LOG.debug("Deleting config drive ISO for vm: " + vm.getInstanceName()
+ " on host: " + hostId);
final String isoPath =
ConfigDrive.createConfigDrivePath(vm.getInstanceName());
final HandleConfigDriveIsoCommand configDriveIsoCommand = new
HandleConfigDriveIsoCommand(isoPath, null, null, false, true, false);
+ HostVO hostVO = _hostDao.findById(hostId);
+ if (hostVO == null) {
+ LOG.warn(String.format("Host %s appears to be unavailable,
skipping deletion of config-drive ISO on host cache", hostId));
+ return false;
+ }
final HandleConfigDriveIsoAnswer answer = (HandleConfigDriveIsoAnswer)
agentManager.easySend(hostId, configDriveIsoCommand);
if (answer == null) {