@@ -2309,6 +2309,7 @@ public Pair<List<Long>, Integer> searchForServerIdsAndCount(ListHostsCmd cmd) {
23092309 Long pageSize = cmd .getPageSizeVal ();
23102310 Hypervisor .HypervisorType hypervisorType = cmd .getHypervisor ();
23112311 final CPU .CPUArch arch = cmd .getArch ();
2312+ String version = cmd .getVersion ();
23122313
23132314 Filter searchFilter = new Filter (HostVO .class , "id" , Boolean .TRUE , startIndex , pageSize );
23142315
@@ -2325,11 +2326,13 @@ public Pair<List<Long>, Integer> searchForServerIdsAndCount(ListHostsCmd cmd) {
23252326 hostSearchBuilder .and ("resourceState" , hostSearchBuilder .entity ().getResourceState (), SearchCriteria .Op .EQ );
23262327 hostSearchBuilder .and ("hypervisor_type" , hostSearchBuilder .entity ().getHypervisorType (), SearchCriteria .Op .EQ );
23272328 hostSearchBuilder .and ("arch" , hostSearchBuilder .entity ().getArch (), SearchCriteria .Op .EQ );
2329+ hostSearchBuilder .and ("version" , hostSearchBuilder .entity ().getVersion (), SearchCriteria .Op .EQ );
23282330
23292331 if (keyword != null ) {
23302332 hostSearchBuilder .and ().op ("keywordName" , hostSearchBuilder .entity ().getName (), SearchCriteria .Op .LIKE );
23312333 hostSearchBuilder .or ("keywordStatus" , hostSearchBuilder .entity ().getStatus (), SearchCriteria .Op .LIKE );
23322334 hostSearchBuilder .or ("keywordType" , hostSearchBuilder .entity ().getType (), SearchCriteria .Op .LIKE );
2335+ hostSearchBuilder .or ("keywordVersion" , hostSearchBuilder .entity ().getVersion (), SearchCriteria .Op .LIKE );
23332336 hostSearchBuilder .cp ();
23342337 }
23352338
@@ -2360,6 +2363,7 @@ public Pair<List<Long>, Integer> searchForServerIdsAndCount(ListHostsCmd cmd) {
23602363 sc .setParameters ("keywordName" , "%" + keyword + "%" );
23612364 sc .setParameters ("keywordStatus" , "%" + keyword + "%" );
23622365 sc .setParameters ("keywordType" , "%" + keyword + "%" );
2366+ sc .setParameters ("keywordVersion" , "%" + keyword + "%" );
23632367 }
23642368
23652369 if (id != null ) {
@@ -2409,6 +2413,10 @@ public Pair<List<Long>, Integer> searchForServerIdsAndCount(ListHostsCmd cmd) {
24092413 sc .setParameters ("arch" , arch );
24102414 }
24112415
2416+ if (version != null ) {
2417+ sc .setParameters ("version" , version );
2418+ }
2419+
24122420 Pair <List <HostVO >, Integer > uniqueHostPair = hostDao .searchAndCount (sc , searchFilter );
24132421 Integer count = uniqueHostPair .second ();
24142422 List <Long > hostIds = uniqueHostPair .first ().stream ().map (HostVO ::getId ).collect (Collectors .toList ());
@@ -5397,6 +5405,8 @@ public ListResponse<ManagementServerResponse> listManagementServers(ListMgmtsCmd
53975405 protected Pair <List <ManagementServerJoinVO >, Integer > listManagementServersInternal (ListMgmtsCmd cmd ) {
53985406 Long id = cmd .getId ();
53995407 String name = cmd .getHostName ();
5408+ String version = cmd .getVersion ();
5409+ String keyword = cmd .getKeyword ();
54005410
54015411 SearchBuilder <ManagementServerJoinVO > sb = managementServerJoinDao .createSearchBuilder ();
54025412 SearchCriteria <ManagementServerJoinVO > sc = sb .create ();
@@ -5406,6 +5416,12 @@ protected Pair<List<ManagementServerJoinVO>, Integer> listManagementServersInter
54065416 if (name != null ) {
54075417 sc .addAnd ("name" , SearchCriteria .Op .EQ , name );
54085418 }
5419+ if (version != null ) {
5420+ sc .addAnd ("version" , SearchCriteria .Op .EQ , version );
5421+ }
5422+ if (keyword != null ) {
5423+ sc .addAnd ("version" , SearchCriteria .Op .LIKE , "%" + keyword + "%" );
5424+ }
54095425 return managementServerJoinDao .searchAndCount (sc , null );
54105426 }
54115427
0 commit comments