Fix link pause/filters only work for the first interface of Docker containers. Fixes #1482

This commit is contained in:
grossmj 2018-12-14 19:53:43 -06:00
parent df4e4bec24
commit fc75a6b8d3
3 changed files with 10 additions and 11 deletions

View File

@ -263,10 +263,11 @@ class DockerHandler:
docker_manager = Docker.instance() docker_manager = Docker.instance()
container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"]) container = docker_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
nio = container.ethernet_adapters[int(request.match_info["adapter_number"])].get_nio(0) adapter_number = int(request.match_info["adapter_number"])
nio = container.ethernet_adapters[adapter_number].get_nio(0)
if "filters" in request.json and nio: if "filters" in request.json and nio:
nio.filters = request.json["filters"] nio.filters = request.json["filters"]
yield from container.adapter_update_nio_binding(int(request.match_info["port_number"]), nio) yield from container.adapter_update_nio_binding(adapter_number, nio)
response.set_status(201) response.set_status(201)
response.json(request.json) response.json(request.json)

View File

@ -301,12 +301,9 @@ class IOUHandler:
nio = vm.adapters[adapter_number].get_nio(port_number) nio = vm.adapters[adapter_number].get_nio(port_number)
if "filters" in request.json and nio: if "filters" in request.json and nio:
nio.filters = request.json["filters"] nio.filters = request.json["filters"]
yield from vm.adapter_update_nio_binding( yield from vm.adapter_update_nio_binding(adapter_number, port_number, nio)
adapter_number,
port_number,
nio)
response.set_status(201) response.set_status(201)
response.json(nio) response.json(request.json)
@Route.delete( @Route.delete(
r"/projects/{project_id}/iou/nodes/{node_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio", r"/projects/{project_id}/iou/nodes/{node_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio",

View File

@ -279,12 +279,13 @@ class VMwareHandler:
vmware_manager = VMware.instance() vmware_manager = VMware.instance()
vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"]) vm = vmware_manager.get_node(request.match_info["node_id"], project_id=request.match_info["project_id"])
nio = vm.ethernet_adapters[int(request.match_info["adapter_number"])] adapter_number = int(request.match_info["adapter_number"])
nio = vm.ethernet_adapters[adapter_number]
if "filters" in request.json and nio: if "filters" in request.json and nio:
nio.filters = request.json["filters"] nio.filters = request.json["filters"]
yield from vm.adapter_update_nio_binding(int(request.match_info["adapter_number"]), nio) yield from vm.adapter_update_nio_binding(adapter_number, nio)
response.set_status(201) response.set_status(201)
response.json(request.json) response.json(request.json)
@Route.delete( @Route.delete(
r"/projects/{project_id}/vmware/nodes/{node_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio", r"/projects/{project_id}/vmware/nodes/{node_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio",