Skip to content

Commit f46ed59

Browse files
anshulgangwarrajesh-battala
authored andcommitted
CLOUDSTACK-8422: Fixed unable to delete zone from CCP
this closes #202
1 parent 48067e5 commit f46ed59

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

server/src/com/cloud/configuration/ConfigurationManagerImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,11 @@ protected void checkIfPodIsDeletable(long podId) {
954954

955955
String selectSql = "SELECT * FROM `" + dbName + "`.`" + tableName + "` WHERE " + column + " = ?";
956956

957-
if (tableName.equals("host") || tableName.equals("cluster") || tableName.equals("volumes") || tableName.equals("vm_instance")) {
957+
if(tableName.equals("vm_instance")) {
958+
selectSql += " AND state != '" + VirtualMachine.State.Expunging.toString() + "' AND removed IS NULL";
959+
}
960+
961+
if (tableName.equals("host") || tableName.equals("cluster") || tableName.equals("volumes")) {
958962
selectSql += " and removed IS NULL";
959963
}
960964

@@ -1426,7 +1430,7 @@ protected void checkIfZoneIsDeletable(long zoneId) {
14261430
}
14271431

14281432
if (tableName.equals("vm_instance")) {
1429-
selectSql += " AND state != '" + VirtualMachine.State.Expunging.toString() + "'";
1433+
selectSql += " AND state != '" + VirtualMachine.State.Expunging.toString() + "' AND removed IS NULL";
14301434
}
14311435

14321436
TransactionLegacy txn = TransactionLegacy.currentTxn();

0 commit comments

Comments
 (0)