HPENetworking / topology_docker

Docker based Platform Engine plugin for the Topology Modular Framework
https://topology-docker.readthedocs.io/
Apache License 2.0
2 stars 15 forks source link

Specifying image in the test file causes unexpected behaviour #8

Closed walintonc closed 8 years ago

walintonc commented 8 years ago

Hello, If I specify the name of the Docker image to be used such as the following example:

[type=openswitch name="OpenSwitch 1"] ops1
[type=host name="Host 1" image="openswitch/genericx86-64"] hs1
[type=host name="Host 2"] hs2

The behaviour it causes is unexpected. WITHOUT this property the tests run just fine. The following is the stack trace and error message:

========================================================================================================================================================================================= ERRORS ==========================================================================================================================================================================================
_______________________________________________________________________________________________________________________________________________________________________________ ERROR at setup of test_vlan _______________________________________________________________________________________________________________________________________________________________________________
[gw1] linux -- Python 3.4.3 /ws/cambronw/openswitch_tests/.tox/py34/bin/python3.4
Error building topogy in module test_vlan:
Traceback (most recent call last):
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/docker/client.py", line 138, in _raise_for_status
    response.raise_for_status()
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/requests/models.py", line 840, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 409 Client Error: Conflict for url: http+docker://localunixsocket/v1.21/images/openswitch%2Fgenericx86-64%3Alatest/tag?repo=openswitch%2Fgenericx86-64&tag=latest&force=0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology/pytest/plugin.py", line 157, in topology
    topomgr.build()
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology/manager.py", line 296, in build
    raise e
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology/manager.py", line 238, in build
    enode = self._platform.add_node(node)
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology_docker/platform.py", line 77, in add_node
    node.identifier, **node.metadata
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology_docker/nodes/host.py", line 41, in __init__
    super(HostNode, self).__init__(identifier, image=image, **kwargs)
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology_docker/node.py", line 77, in __init__
    self._autopull()
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology_docker/node.py", line 133, in _autopull
    if not self._client.tag(pull_name, image, tag):
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/docker/utils/decorators.py", line 21, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/docker/api/image.py", line 269, in tag
    self._raise_for_status(res)
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/docker/client.py", line 142, in _raise_for_status
    raise errors.APIError(e, response, explanation=explanation)
docker.errors.APIError: 409 Client Error: Conflict ("b'Conflict: Tag openswitch/genericx86-64:latest is already set to image d3db7be415c0, if you want to replace it, please use -f option'")

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Captured stderr setup ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Build failed at stage "add_node" with "409 Client Error: Conflict ("b'Conflict: Tag openswitch/genericx86-64:latest is already set to image d3db7be415c0, if you want to replace it, please use -f option'")". Calling plugin rollback routine...
-------------------------------------------------------------------------------------------------------------------------------------------------------- generated xml file: /ws/cambronw/openswitch_tests/.tox/py34/tmp/tests.xml --------------------------------------------------------------------------------------------------------------------------------------------------------
================================================================================================================================================================================ slowest 10 test durations ================================================================================================================================================================================
15.51s setup    test_vlan.py::test_vlan
0.00s teardown test_vlan.py::test_vlan
================================================================================================================================================================================ 1 error in 16.67 seconds =================================================================================================================================================================================
ERROR: InvocationError: '/ws/cambronw/openswitch_tests/.tox/py34/bin/py.test --random --durations=10 --junitxml=tests.xml --topology-nml-dir topologies --topology-plot-dir topologies --topology-plot-format svg --topology-platform docker -n=auto -v /ws/cambronw/openswitch_tests/test'
_________________________________________________________________________________________________________________________________________________________________________________________ summary _________________________________________________________________________________________________________________________________________________________________________________________
ERROR:   py34: commands failed
ocelotl commented 8 years ago

Is your intention to load an openswitch image on a host?

walintonc commented 8 years ago

No. On a switch.

Regards, Walinton Cambronero HPE Aruba Networking

-------- Original message -------- From: Diego Hurtado notifications@github.com Date: 01/02/2016 22:34 (GMT-06:00) To: HPENetworking/topology_docker topology_docker@noreply.github.com Cc: "Cambronero, Walinton" walinton.cambronero@hpe.com Subject: Re: [topology_docker] Specifying image in the test file causes unexpected behaviour (#8)

Is your intention to load an openswitch image on a host?

� Reply to this email directly or view it on GitHubhttps://github.com/HPENetworking/topology_docker/issues/8#issuecomment-178369043.

walintonc commented 8 years ago

I just changed the topology definition to the following (my original intent)

# Nodes
[type=openswitch name="OpenSwitch 1" image="openswitch/genericx86-64"] ops1
[type=host name="Host 1"] hs1
[type=host name="Host 2"] hs2

Same problem happened. Here the stack trace:

../../../test_vlan.py::test_vlan
[gw3] ERROR ../../../test_vlan.py::test_vlan

========================================================================================== ERRORS ===========================================================================================
________________________________________________________________________________ ERROR at setup of test_vlan ________________________________________________________________________________
[gw3] linux -- Python 3.4.3 /ws/cambronw/openswitch_tests/.tox/py34/bin/python3.4
Error building topogy in module test_vlan:
Traceback (most recent call last):
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/docker/client.py", line 138, in _raise_for_status
    response.raise_for_status()
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/requests/models.py", line 840, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 409 Client Error: Conflict for url: http+docker://localunixsocket/v1.21/images/openswitch%2Fgenericx86-64%3Alatest/tag?repo=openswitch%2Fgenericx86-64&tag=latest&force=0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology/pytest/plugin.py", line 157, in topology
    topomgr.build()
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology/manager.py", line 296, in build
    raise e
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology/manager.py", line 238, in build
    enode = self._platform.add_node(node)
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology_docker/platform.py", line 77, in add_node
    node.identifier, **node.metadata
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology_docker/nodes/openswitch.py", line 220, in __init__
    **kwargs
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology_docker/node.py", line 77, in __init__
    self._autopull()
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/topology_docker/node.py", line 133, in _autopull
    if not self._client.tag(pull_name, image, tag):
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/docker/utils/decorators.py", line 21, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/docker/api/image.py", line 269, in tag
    self._raise_for_status(res)
  File "/ws/cambronw/openswitch_tests/.tox/py34/lib/python3.4/site-packages/docker/client.py", line 142, in _raise_for_status
    raise errors.APIError(e, response, explanation=explanation)
docker.errors.APIError: 409 Client Error: Conflict ("b'Conflict: Tag openswitch/genericx86-64:latest is already set to image d3db7be415c0, if you want to replace it, please use -f option'")

----------------------------------------------------------------------------------- Captured stderr setup -----------------------------------------------------------------------------------
Build failed at stage "add_node" with "409 Client Error: Conflict ("b'Conflict: Tag openswitch/genericx86-64:latest is already set to image d3db7be415c0, if you want to replace it, please use -f option'")". Calling plugin rollback routine...
--------------------------------------------------------- generated xml file: /ws/cambronw/openswitch_tests/.tox/py34/tmp/tests.xml ---------------------------------------------------------
================================================================================= slowest 10 test durations =================================================================================
2.48s setup    test_vlan.py::test_vlan
0.00s teardown test_vlan.py::test_vlan
================================================================================== 1 error in 3.66 seconds ==================================================================================
ERROR: InvocationError: '/ws/cambronw/openswitch_tests/.tox/py34/bin/py.test --random --durations=10 --junitxml=tests.xml --topology-nml-dir topologies --topology-plot-dir topologies --topology-plot-format svg --topology-platform docker -n=auto -v /ws/cambronw/openswitch_tests/test'
__________________________________________________________________________________________ summary __________________________________________________________________________________________
ERROR:   py34: commands failed
ocelotl commented 8 years ago

Seems like :latest was missing from the image specification, this one will do:

[type=openswitch name="OpenSwitch 1" image="openswitch/genericx86-64:latest"] ops1