30
30
31
31
import javax .inject .Inject ;
32
32
33
- import com .cloud .resource .icon .dao .ResourceIconDao ;
34
- import com .cloud .server .ResourceManagerUtil ;
35
- import com .cloud .storage .dao .VMTemplateDetailsDao ;
36
- import com .cloud .vm .VirtualMachineManager ;
37
33
import org .apache .cloudstack .acl .ControlledEntity .ACLType ;
38
34
import org .apache .cloudstack .affinity .AffinityGroupDomainMapVO ;
39
35
import org .apache .cloudstack .affinity .AffinityGroupResponse ;
62
58
import org .apache .cloudstack .api .command .admin .storage .ListStorageTagsCmd ;
63
59
import org .apache .cloudstack .api .command .admin .template .ListTemplatesCmdByAdmin ;
64
60
import org .apache .cloudstack .api .command .admin .user .ListUsersCmd ;
61
+ import org .apache .cloudstack .api .command .admin .vm .ListVMsCmdByAdmin ;
65
62
import org .apache .cloudstack .api .command .admin .zone .ListZonesCmdByAdmin ;
66
63
import org .apache .cloudstack .api .command .user .account .ListAccountsCmd ;
67
64
import org .apache .cloudstack .api .command .user .account .ListProjectAccountsCmd ;
206
203
import com .cloud .projects .dao .ProjectDao ;
207
204
import com .cloud .projects .dao .ProjectInvitationDao ;
208
205
import com .cloud .resource .ResourceManager ;
206
+ import com .cloud .resource .icon .dao .ResourceIconDao ;
207
+ import com .cloud .server .ResourceManagerUtil ;
209
208
import com .cloud .server .ResourceMetaDataService ;
210
209
import com .cloud .server .ResourceTag ;
211
210
import com .cloud .server .ResourceTag .ResourceObjectType ;
224
223
import com .cloud .storage .Volume ;
225
224
import com .cloud .storage .dao .StoragePoolTagsDao ;
226
225
import com .cloud .storage .dao .VMTemplateDao ;
226
+ import com .cloud .storage .dao .VMTemplateDetailsDao ;
227
227
import com .cloud .tags .ResourceTagVO ;
228
228
import com .cloud .tags .dao .ResourceTagDao ;
229
229
import com .cloud .template .VirtualMachineTemplate .State ;
251
251
import com .cloud .vm .UserVmVO ;
252
252
import com .cloud .vm .VMInstanceVO ;
253
253
import com .cloud .vm .VirtualMachine ;
254
+ import com .cloud .vm .VirtualMachineManager ;
254
255
import com .cloud .vm .VmDetailConstants ;
255
256
import com .cloud .vm .dao .DomainRouterDao ;
256
257
import com .cloud .vm .dao .UserVmDao ;
@@ -986,10 +987,14 @@ private Pair<List<UserVmJoinVO>, Integer> searchForUserVMsInternal(ListVMsCmd cm
986
987
Object securityGroupId = cmd .getSecurityGroupId ();
987
988
Object isHaEnabled = cmd .getHaEnabled ();
988
989
Object pod = null ;
990
+ Long clusterId = null ;
989
991
Object hostId = null ;
990
992
Object storageId = null ;
991
993
if (_accountMgr .isRootAdmin (caller .getId ())) {
992
994
pod = cmd .getPodId ();
995
+ if (cmd instanceof ListVMsCmdByAdmin ) {
996
+ clusterId = ((ListVMsCmdByAdmin )cmd ).getClusterId ();
997
+ }
993
998
hostId = cmd .getHostId ();
994
999
storageId = cmd .getStorageId ();
995
1000
}
@@ -1002,6 +1007,7 @@ private Pair<List<UserVmJoinVO>, Integer> searchForUserVMsInternal(ListVMsCmd cm
1002
1007
sb .and ("stateNIN" , sb .entity ().getState (), SearchCriteria .Op .NIN );
1003
1008
sb .and ("dataCenterId" , sb .entity ().getDataCenterId (), SearchCriteria .Op .EQ );
1004
1009
sb .and ("podId" , sb .entity ().getPodId (), SearchCriteria .Op .EQ );
1010
+ sb .and ("clusterId" , sb .entity ().getClusterId (), SearchCriteria .Op .EQ );
1005
1011
sb .and ("hypervisorType" , sb .entity ().getHypervisorType (), SearchCriteria .Op .EQ );
1006
1012
sb .and ("hostIdEQ" , sb .entity ().getHostId (), SearchCriteria .Op .EQ );
1007
1013
sb .and ("templateId" , sb .entity ().getTemplateId (), SearchCriteria .Op .EQ );
@@ -1175,6 +1181,10 @@ private Pair<List<UserVmJoinVO>, Integer> searchForUserVMsInternal(ListVMsCmd cm
1175
1181
}
1176
1182
}
1177
1183
1184
+ if (clusterId != null ) {
1185
+ sc .setParameters ("clusterId" , clusterId );
1186
+ }
1187
+
1178
1188
if (hostId != null ) {
1179
1189
sc .setParameters ("hostIdEQ" , hostId );
1180
1190
}
0 commit comments