[Kimchi-devel] [PATCH] Github issue #300: hardcoded server port fix

Royce Lv lvroyce at linux.vnet.ibm.com
Thu Jan 9 02:58:24 UTC 2014


Really a good Catch!
Reviewed-by: Royce Lv<lvroyce at linux.vnet.ibm.com>
Tested-by: Royce Lv<lvroyce at linux.vnet.ibm.com>

@Mark, here we have another way to get the config information, the 
cherrypy.config, so we need to decide which way we would like to use as 
a single point in the future.

On 2014年01月09日 09:51, Daniel Barboza wrote:
> From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
>
> When executing kimchi using a port different than 8000, the "Remote ISO Image" will always be disabled.
>
> The issue is caused by functions in featuretests.py that uses the port 8000 hardcoded, instead of getting the actual used port to launch the server.
>
> As of now I haven't found any other occurrence of the "8000" hardcoded port anywhere in the code.
>
> Signed-off-by: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>
> ---
>   src/kimchi/featuretests.py | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/kimchi/featuretests.py b/src/kimchi/featuretests.py
> index 1ca3567..d9409ae 100644
> --- a/src/kimchi/featuretests.py
> +++ b/src/kimchi/featuretests.py
> @@ -20,6 +20,7 @@
>   # License along with this library; if not, write to the Free Software
>   # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
>
> +import cherrypy
>   import libvirt
>   import os
>   import subprocess
> @@ -70,18 +71,17 @@ class FeatureTests(object):
>
>       @staticmethod
>       def qemu_supports_iso_stream():
> -        cmd = "qemu-io http://127.0.0.1:8000/images/icon-fedora.png \
> -              -c 'read -v 0 512'"
> +        cmd = "qemu-io http://127.0.0.1:%d/images/icon-fedora.png \
> +              -c 'read -v 0 512'" % cherrypy.server.socket_port
>           proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
>                                   stderr=subprocess.PIPE, shell=True)
>           stdout, stderr = proc.communicate()
> -
>           return len(stderr) == 0
>
>       @staticmethod
>       def qemu_iso_stream_dns():
> -        cmd = ["qemu-io", "http://localhost:8000/images/icon-fedora.png", "-c",
> -               "'read -v 0 512'"]
> +        cmd = ["qemu-io", "http://localhost:%d/images/icon-fedora.png" %
> +               cherrypy.server.socket_port, "-c", "'read -v 0 512'"]
>           proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
>                                   stderr=subprocess.PIPE)
>           thread = threading.Thread(target=proc.communicate)




More information about the Kimchi-devel mailing list