Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: backend: upgrade - process symbolic link files
......................................................................

backend: upgrade - process symbolic link files

Currently if users decided to upgrade the ovirt-node via restapi using
the symbolic link name ovirt-node-iso.iso it will fail. This patch adds
getCanonicalPath() call to resolves the symbolic links.

Change-Id: If4084095c40848dc5573d434c1c7ca497883b280
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1093303
Signed-off-by: Douglas Schilling Landgraf <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
1 file changed, 22 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/67/27467/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
index 33a3326..4b9faac 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InstallVdsCommand.java
@@ -1,10 +1,12 @@
 package org.ovirt.engine.core.bll;
 
+import java.io.IOException;
 import java.io.File;
 import java.util.Collections;
 import java.util.Map;
 import java.util.regex.Matcher;
 
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.ovirt.engine.core.bll.network.NetworkConfigurator;
 import org.ovirt.engine.core.common.AuditLogType;
@@ -64,17 +66,28 @@
 
         for (OVirtNodeInfo.Entry info : OVirtNodeInfo.getInstance().get()) {
             if (info.path.equals(iso.getParentFile())) {
-                Matcher matcher = info.isoPattern.matcher(iso.getName());
-                if (matcher.find()) {
-                    String rpmLike = matcher.group(1).replaceAll("-", ".");
-                    log.debugFormat("ISO version: {0} {1} {3}", iso, rpmLike, 
ovirtHostOsVersion);
-                    RpmVersion isoVersion = new RpmVersion(rpmLike, "", true);
-                    if 
(VdsHandler.isIsoVersionCompatibleForUpgrade(ovirtHostOsVersion, isoVersion)) {
-                        log.debugFormat("ISO compatible: {0}", iso);
-                        ret = true;
-                        break;
+                try {
+                    Matcher matcher = info.isoPattern.matcher(
+                        iso.getCanonicalFile().getName()
+                    );
+                    if (matcher.find()) {
+                        String rpmLike = matcher.group(1).replaceAll("-", ".");
+                        log.debugFormat("ISO version: {0} {1} {2}", iso, 
rpmLike, ovirtHostOsVersion);
+                        RpmVersion isoVersion = new RpmVersion(rpmLike, "", 
true);
+                        if 
(VdsHandler.isIsoVersionCompatibleForUpgrade(ovirtHostOsVersion, isoVersion)) {
+                            log.debugFormat("ISO compatible: {0}", iso);
+                            ret = true;
+                            break;
+                        }
                     }
+                } catch (IOException e) {
+                    log.errorFormat(
+                        "Cannot get canonical path to {0} with error {1}",
+                        iso.getName(),
+                        ExceptionUtils.getMessage(e)
+                    );
                 }
+
             }
         }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4084095c40848dc5573d434c1c7ca497883b280
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.4.1
Gerrit-Owner: Douglas Schilling Landgraf <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to