[Kimchi-devel] [PATCH] [Kimchi] VM migrate: generic remote path check

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Fri Jun 24 18:25:14 UTC 2016


From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>

The method _check_if_path_exists_in_remote_host was using
'test -f' to check if a file exist in the remote host.
Hovewer, when using iSCSI disks, this path is a symlink
instead of a regular file. This results in failure, making
the code wrongly go to the 'non-shared' migration scenario.

This patch changes the 'test' flag to '-e', which will simply
check for the existence of the path in the remote host. There
is no need to distinguish between whether the path is a file
or a symlink in this method - we just want to know if the path
is valid in the remote host.

Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
---
 model/vms.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/model/vms.py b/model/vms.py
index 3b08c10..7745027 100644
--- a/model/vms.py
+++ b/model/vms.py
@@ -1731,7 +1731,7 @@ class VMModel(object):
     def _check_if_path_exists_in_remote_host(self, path, remote_host, user):
         username_host = "%s@%s" % ('root', remote_host)
         cmd = ['ssh', '-oStrictHostKeyChecking=no', username_host,
-               'test', '-f', path]
+               'test', '-e', path]
         _, _, returncode = run_command(cmd, 5, silent=True)
         return returncode == 0
 
-- 
2.5.5




More information about the Kimchi-devel mailing list