Eldan Shachar has uploaded a new change for review. Change subject: engine: Add more search filters for VM ......................................................................
engine: Add more search filters for VM The patch enables to search VMs based on: 1. Cluster compatibility level 2. Custom VM emulated-machine \ CPU-model Change-Id: I607cc9cc3dd6ca80453aa44e20a213504a4df855 Bug-Url: https://bugzilla.redhat.com/1201511 Signed-off-by: Eldan Shachar <[email protected]> --- M backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java M backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/SyntaxCheckerTest.java 2 files changed, 13 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/34/39434/1 diff --git a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java index e2bd8ea..9130130 100644 --- a/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java +++ b/backend/manager/modules/searchbackend/src/main/java/org/ovirt/engine/core/searchbackend/VmConditionFieldAutoCompleter.java @@ -39,6 +39,9 @@ public static final String ID = "ID"; public static final String DESCRIPTION = "DESCRIPTION"; public static final String ARCHITECTURE = "ARCHITECTURE"; + public static final String EMULATED_MACHINE = "EMULATED_MACHINE"; + public static final String CPU_TYPE = "CPU_TYPE"; + public static final String COMPATIBILITY_LEVEL = "COMPATIBILITY_LEVEL"; private static final int MILISECOND = 1000; public VmConditionFieldAutoCompleter() { @@ -69,6 +72,9 @@ mVerbs.add(ID); mVerbs.add(DESCRIPTION); mVerbs.add(ARCHITECTURE); + mVerbs.add(EMULATED_MACHINE); + mVerbs.add(CPU_TYPE); + mVerbs.add(COMPATIBILITY_LEVEL); // Building the autoCompletion Dict buildCompletions(); @@ -99,6 +105,9 @@ getTypeDictionary().put(ID, UUID.class); getTypeDictionary().put(DESCRIPTION, String.class); getTypeDictionary().put(ARCHITECTURE, ArchitectureType.class); + getTypeDictionary().put(EMULATED_MACHINE, String.class); + getTypeDictionary().put(CPU_TYPE, String.class); + getTypeDictionary().put(COMPATIBILITY_LEVEL, String.class); // building the ColumnName Dict columnNameDict.put(NAME, "vm_name"); @@ -128,6 +137,9 @@ columnNameDict.put(ID, "vm_guid"); columnNameDict.put(DESCRIPTION, "description"); columnNameDict.put(ARCHITECTURE, "architecture"); + columnNameDict.put(EMULATED_MACHINE, "custom_emulated_machine"); + columnNameDict.put(CPU_TYPE, "custom_cpu_name"); + columnNameDict.put(COMPATIBILITY_LEVEL, "vds_group_compatibility_version"); // Override field names for purpose of sorting, if needed sortableFieldDict.put(IP, "vm_ip_inet_array"); diff --git a/backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/SyntaxCheckerTest.java b/backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/SyntaxCheckerTest.java index 061631e..84d9965 100644 --- a/backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/SyntaxCheckerTest.java +++ b/backend/manager/modules/searchbackend/src/test/java/org/ovirt/engine/core/searchbackend/SyntaxCheckerTest.java @@ -185,7 +185,7 @@ // Used to validate that searching values not in fields search all fields testValidSql("Vm: mac=00:1a:4a:d4:53:94", - "SELECT * FROM (SELECT * FROM vms WHERE ( vm_guid IN (SELECT distinct vms_with_tags.vm_guid FROM vms_with_tags WHERE ( vms_with_tags.description LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.free_text_comment LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.guest_cur_user_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.quota_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.run_on_vds_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.storage_pool_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.tag_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vds_group_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vm_fqdn LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vm_host LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vm_ip LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vm_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vm_pool_name LIKE '%mac=00:1a:4a:d4:53:94%' ) )) ORDER BY vm_name ASC ) as T1 OFFSET (1 -1) LIMI! T 0"); + "SELECT * FROM (SELECT * FROM vms WHERE ( vm_guid IN (SELECT distinct vms_with_tags.vm_guid FROM vms_with_tags WHERE ( vms_with_tags.custom_cpu_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.custom_emulated_machine LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.description LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.free_text_comment LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.guest_cur_user_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.quota_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.run_on_vds_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.storage_pool_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.tag_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vds_group_compatibility_version LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vds_group_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vm_fqdn LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vm_host LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_! with_tags.vm_ip LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vm_name LIKE '%mac=00:1a:4a:d4:53:94%' OR vms_with_tags.vm_pool_name LIKE '%mac=00:1a:4a:d4:53:94%' ) )) ORDER BY vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 0"); // Testing that in case that function is used in the ORDER BY clause then it is converted with a computed field testValidSql("Vms: SORTBY IP DESC", "SELECT * FROM ((SELECT distinct vms.* FROM vms ) ORDER BY vm_ip_inet_array DESC NULLS LAST,vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 0"); -- To view, visit https://gerrit.ovirt.org/39434 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I607cc9cc3dd6ca80453aa44e20a213504a4df855 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eldan Shachar <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
