This is an automated email from the ASF dual-hosted git repository.
sureshanaparti pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.22 by this push:
new 6516f7f1aa7 Fix query execution in countVgpuVMs (#12713)
6516f7f1aa7 is described below
commit 6516f7f1aa71bb2ea46e8b02663d33f9f38345e1
Author: Vishesh <[email protected]>
AuthorDate: Fri Feb 27 18:23:25 2026 +0530
Fix query execution in countVgpuVMs (#12713)
---
.../schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
index 703fabd2cab..7ebf61366fe 100755
--- a/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
+++ b/engine/schema/src/main/java/com/cloud/vm/dao/VMInstanceDaoImpl.java
@@ -846,15 +846,18 @@ public class VMInstanceDaoImpl extends
GenericDaoBase<VMInstanceVO, Long> implem
try {
pstmtLegacy =
txn.prepareAutoCloseStatement(finalQueryLegacy.toString());
- pstmt = txn.prepareAutoCloseStatement(finalQuery.toString());
for (int i = 0; i < resourceIdList.size(); i++) {
pstmtLegacy.setLong(1 + i, resourceIdList.get(i));
- pstmt.setLong(1 + i, resourceIdList.get(i));
}
ResultSet rs = pstmtLegacy.executeQuery();
while (rs.next()) {
result.put(rs.getString(1).concat(rs.getString(2)),
rs.getLong(3));
}
+
+ pstmt = txn.prepareAutoCloseStatement(finalQuery.toString());
+ for (int i = 0; i < resourceIdList.size(); i++) {
+ pstmt.setLong(1 + i, resourceIdList.get(i));
+ }
rs = pstmt.executeQuery();
while (rs.next()) {
result.put(rs.getString(1).concat(rs.getString(2)),
rs.getLong(3));