You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/09/09 08:13:29 UTC

git commit: updated refs/heads/4.2-forward to 0a0ff45

Updated Branches:
  refs/heads/4.2-forward b2c4529a8 -> 0a0ff45b1


CLOUDSTACK-4608: Resolve the hostname to fqdn from marvin config

In case the marvin configuration does not contain fqdn information fetch
and compare the fqdns of hostip from `cloud`.`host` with the fqdn
available on the client.

Signed-off-by: Prasanna Santhanam <ts...@apache.org>
(cherry picked from commit 433d5839a196dd4a8ecc49abc192c580d79c175d)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0a0ff45b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0a0ff45b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0a0ff45b

Branch: refs/heads/4.2-forward
Commit: 0a0ff45b16d340cf78924d39b6ce73b759e0a624
Parents: b2c4529
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon Sep 9 11:41:13 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Sep 9 11:43:18 2013 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/integration/lib/utils.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a0ff45b/tools/marvin/marvin/integration/lib/utils.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/utils.py b/tools/marvin/marvin/integration/lib/utils.py
index c2403d4f..a6abe06 100644
--- a/tools/marvin/marvin/integration/lib/utils.py
+++ b/tools/marvin/marvin/integration/lib/utils.py
@@ -25,6 +25,8 @@ import string
 import random
 import imaplib
 import email
+import socket
+import urlparse
 import datetime
 from marvin.cloudstackAPI import *
 from marvin.remoteSSHClient import remoteSSHClient
@@ -154,16 +156,23 @@ def fetch_api_client(config_file='datacenterCfg'):
         )
     )
 
-def get_host_credentials(config, hostname):
-    """Get login information for a host `hostname` from marvin's `config`
+def get_host_credentials(config, hostip):
+    """Get login information for a host `hostip` (ipv4) from marvin's `config`
 
     @return the tuple username, password for the host else raise keyerror"""
     for zone in config.zones:
         for pod in zone.pods:
             for cluster in pod.clusters:
                 for host in cluster.hosts:
-                    if str(host.url).find(str(hostname)) > 0:
-                        return host.username, host.password
+                    if str(host.url).startswith('http'):
+                        hostname = urlparse.urlsplit(str(host.url)).netloc
+                    else:
+                        hostname = str(host.url)
+                    try:
+                        if socket.getfqdn(hostip) == socket.getfqdn(hostname):
+                            return host.username, host.password
+                    except socket.error, e:
+                        raise Exception("Unresolvable host %s error is %s" % (hostip, e))
     raise KeyError("Please provide the marvin configuration file with credentials to your hosts")