[Kimchi-devel] [PATCH] bug fix: Use cherrypy host to run feature tests instead of localhost

Aline Manera alinefm at linux.vnet.ibm.com
Fri Jan 24 17:41:08 UTC 2014


From: Aline Manera <alinefm at br.ibm.com>

When user specifies a different IP/hostname to run kimchi, the feature
tests related to ISO streaming will fail as it points to localhost and
kimchi is running in other address.
Fix it by using cherrypy host to run the feature tests.

Signed-off-by: Aline Manera <alinefm at br.ibm.com>
---
 src/kimchi/featuretests.py |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/kimchi/featuretests.py b/src/kimchi/featuretests.py
index 32ad2ec..1557dd9 100644
--- a/src/kimchi/featuretests.py
+++ b/src/kimchi/featuretests.py
@@ -93,8 +93,10 @@ class FeatureTests(object):
 
     @staticmethod
     def qemu_supports_iso_stream():
-        cmd = "qemu-io -r http://127.0.0.1:%d/images/icon-fedora.png \
-              -c 'read -v 0 512'" % cherrypy.server.socket_port
+        host = cherrypy.server.socket_host
+        port = cherrypy.server.socket_port
+        cmd = "qemu-io -r http://%s:%d/images/icon-fedora.png \
+              -c 'read -v 0 512'" % (host, port)
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE, shell=True)
         stdout, stderr = proc.communicate()
@@ -102,8 +104,10 @@ class FeatureTests(object):
 
     @staticmethod
     def qemu_iso_stream_dns():
-        cmd = ["qemu-io", "-r", "http://localhost:%d/images/icon-fedora.png" %
-               cherrypy.server.socket_port, "-c", "'read -v 0 512'"]
+        host = cherrypy.server.socket_host
+        port = cherrypy.server.socket_port
+        cmd = ["qemu-io", "-r", "http://%s:%d/images/icon-fedora.png" %
+               (host, port), "-c", "'read -v 0 512'"]
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
         thread = threading.Thread(target=proc.communicate)
-- 
1.7.10.4




More information about the Kimchi-devel mailing list