You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d8bdc41
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: engine/schema/src/main/java/com/cloud/storage/dao/VolumeDaoImpl.java
+23Lines changed: 23 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -96,6 +96,14 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
96
96
protectedstaticfinalStringSELECT_HYPERTYPE_FROM_CLUSTER_VOLUME = "SELECT c.hypervisor_type from volumes v, storage_pool s, cluster c where v.pool_id = s.id and s.cluster_id = c.id and v.id = ?";
97
97
protectedstaticfinalStringSELECT_HYPERTYPE_FROM_ZONE_VOLUME = "SELECT s.hypervisor from volumes v, storage_pool s where v.pool_id = s.id and v.id = ?";
98
98
protectedstaticfinalStringSELECT_POOLSCOPE = "SELECT s.scope from storage_pool s, volumes v where s.id = v.pool_id and v.id = ?";
99
+
// Looks for a VM whose Ready root disk is on this pool and whose attached Ready data disk is on another pool.
100
+
// LIMIT 1 stops after the first match so we do not load all volumes.
"SELECT 1 FROM volumes root INNER JOIN volumes data ON data.instance_id = root.instance_id "
103
+
+ "WHERE root.pool_id = ? AND root.volume_type = 'ROOT' AND root.instance_id IS NOT NULL "
104
+
+ "AND root.removed IS NULL AND root.state = 'Ready' "
105
+
+ "AND data.volume_type = 'DATADISK' AND data.pool_id IS NOT NULL AND data.pool_id <> ? "
106
+
+ "AND data.removed IS NULL AND data.state = 'Ready' LIMIT 1";
99
107
100
108
privatestaticfinalStringORDER_POOLS_NUMBER_OF_VOLUMES_FOR_ACCOUNT_PART1 = "SELECT pool.id, SUM(IF(vol.state='Ready' AND vol.account_id = ?, 1, 0)) FROM `cloud`.`storage_pool` pool LEFT JOIN `cloud`.`volumes` vol ON pool.id = vol.pool_id WHERE pool.data_center_id = ? ";
101
109
privatestaticfinalStringORDER_POOLS_NUMBER_OF_VOLUMES_FOR_ACCOUNT_PART2 = " GROUP BY pool.id ORDER BY 2 ASC ";
@@ -998,6 +1006,21 @@ public boolean existsWithKmsKey(long kmsKeyId) {
0 commit comments