Maor Lipchuk has uploaded a new change for review.

Change subject: core: Use name groups for ISO tools
......................................................................

core: Use name groups for ISO tools

Use java7 feature of name groups when matching cluster
and tool version for ISO files in ISO domain.

Signed-off-by: Maor Lipchuk <mlipc...@redhat.com>
Change-Id: Id19888eee7c1afc7489af5208b6cddd2376d74a3
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/IsoDomainListSyncronizer.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
2 files changed, 10 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/99/13899/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/IsoDomainListSyncronizer.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/IsoDomainListSyncronizer.java
index 1e2784a..04e6150 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/IsoDomainListSyncronizer.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/IsoDomainListSyncronizer.java
@@ -57,16 +57,21 @@
     private static final ConcurrentMap<Object, Lock> syncDomainForFileTypeMap 
= new ConcurrentHashMap<Object, Lock>();
     private int isoDomainRefreshRate;
     RepoFileMetaDataDAO repoStorageDom;
+    public static final String TOOL_CLUSTER_LEVEL = "clusterLevel";
+    public static final String TOOL_VERSION = "toolVersion";
 
     // Not kept as static member to enable reloading the config value
     public static String getGuestToolsSetupIsoPrefix() {
         return Config.<String> GetValue(ConfigValues.GuestToolsSetupIsoPrefix);
     }
 
-    // Not kept as static member to enable reloading the config value
     public static String getRegexToolPattern() {
-        final String guestToolsSetupIsoPrefix = getGuestToolsSetupIsoPrefix();
-        return guestToolsSetupIsoPrefix + 
"([0-9]{1,}.[0-9])(_{1})([0-9]{1,}).[i|I][s|S][o|O]$";
+        String regexPattern =
+                
String.format("%1$s(?<%2$s>[0-9]{1,}.[0-9])_{1}(?<%3$s>[0-9]{1,}).[i|I][s|S][o|O]$",
+                        getGuestToolsSetupIsoPrefix(),
+                        TOOL_CLUSTER_LEVEL,
+                        TOOL_VERSION);
+        return regexPattern;
     }
 
     /**
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
index bed660b..703f1e4 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
@@ -612,9 +612,8 @@
                         
Pattern.compile(IsoDomainListSyncronizer.getRegexToolPattern()).matcher(fileName);
                 if (matchToolPattern.find()) {
                     // Get cluster version and tool version of Iso tool.
-                    // TODO: Should be group name string support in java7.
-                    Version clusterVer = new 
Version(matchToolPattern.group(1));
-                    int toolVersion = 
Integer.parseInt(matchToolPattern.group(3));
+                    Version clusterVer = new 
Version(matchToolPattern.group(IsoDomainListSyncronizer.TOOL_CLUSTER_LEVEL));
+                    int toolVersion = 
Integer.parseInt(matchToolPattern.group(IsoDomainListSyncronizer.TOOL_VERSION));
 
                     if 
(clusterVer.compareTo(getVm().getVdsGroupCompatibilityVersion()) <= 0) {
                         if ((bestClusterVer == null)


--
To view, visit http://gerrit.ovirt.org/13899
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id19888eee7c1afc7489af5208b6cddd2376d74a3
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to