Error when adding multiple nodes with duplicated macs

Bug #1437212 reported by Dariusz Smigiel
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tuskar-ui
Fix Committed
Undecided
Dariusz Smigiel

Bug Description

1. enter /infrastructure/nodes
2. select "+" button and add multiple nodes at once (at least two)
3. in last node, duplicate mac address: "00:11:22:33:44:55 00:11:22:33:44:55"
4. submit it

Current behaviour:
Popup is showing with info: "Danger: There was an error submitting the form. Please try again. "
After refreshing page, there are all nodes added, before error occured. Node with duplicated macs is also added, but only with one interface.

Expected behaviour:
Nodes shouldn't be added.
Mac addresses should be listed as duplicated.
Form submitting should be prevented.

Log:

DEBUG:ironicclient.common.http:curl -i -X POST -H 'X-Auth-Token: 4367bb444a584f878a433809068f678e' -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'User-Agent: python-ironicclient' -d '{"node_uuid": "faf82239-722e-4fbd-9c31-63a037bf5f54", "address":
"00:11:22:33:44:55"}' http://192.0.2.3:6385/v1/ports
DEBUG:ironicclient.common.http:
HTTP/1.0 409 Conflict
x-openstack-ironic-api-version: 1.1
content-length: 149
server: WSGIServer/0.1 Python/2.7.6
x-openstack-ironic-api-maximum-version: 1.6
date: Fri, 27 Mar 2015 08:44:47 GMT
x-openstack-ironic-api-minimum-version: 1.1
content-type: application/json

{"error_message": "{\"debuginfo\": null, \"faultcode\": \"Client\", \"faultstring\": \"A port with MAC address 00:11:22:33:44:55 already exists.\"}"}

WARNING:ironicclient.common.http:Request returned failure status.
Internal Server Error: /infrastructure/nodes/register/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/root/horizon/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/root/horizon/horizon/decorators.py", line 84, in dec
    return view_func(request, *args, **kwargs)
  File "/root/horizon/horizon/decorators.py", line 52, in dec
    return view_func(request, *args, **kwargs)
  File "/root/horizon/horizon/decorators.py", line 36, in dec
    return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py", line 171, in post
    return self.form_valid(form)
  File "/root/horizon/horizon/forms/views.py", line 173, in form_valid
    exceptions.handle(self.request)
  File "/root/horizon/horizon/exceptions.py", line 364, in handle
    six.reraise(exc_type, exc_value, exc_traceback)
  File "/root/horizon/horizon/forms/views.py", line 170, in form_valid
    handled = form.handle(self.request, form.cleaned_data)
  File "/root/tuskar-ui/tuskar_ui/forms.py", line 130, in handle
    form_success = form.handle(request, form.cleaned_data)
  File "/root/tuskar-ui/tuskar_ui/infrastructure/nodes/forms.py", line 218, in handle
    return create_node(request, data)
  File "/root/tuskar-ui/tuskar_ui/infrastructure/nodes/forms.py", line 76, in create_node
    exceptions.handle(request, _(u"Unable to register node."))
  File "/root/horizon/horizon/exceptions.py", line 364, in handle
    six.reraise(exc_type, exc_value, exc_traceback)
  File "/root/tuskar-ui/tuskar_ui/infrastructure/nodes/forms.py", line 73, in create_node
    node = api.node.Node.create(request, **kwargs)
  File "/root/tuskar-ui/tuskar_ui/api/node.py", line 576, in create
    driver=driver))
  File "/root/tuskar-ui/tuskar_ui/api/node.py", line 137, in create
    address=mac_address
  File "/usr/local/lib/python2.7/dist-packages/ironicclient/v1/port.py", line 107, in create
    return self._create(self._path(), new)
  File "/usr/local/lib/python2.7/dist-packages/ironicclient/common/base.py", line 49, in _create
    resp, body = self.api.json_request('POST', url, body=body)
  File "/usr/local/lib/python2.7/dist-packages/ironicclient/common/http.py", line 202, in json_request
    resp, body_iter = self._http_request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ironicclient/common/http.py", line 185, in _http_request
    error_json.get('debuginfo'), method, url)
Conflict: A port with MAC address 00:11:22:33:44:55 already exists. (HTTP 409)

Changed in tuskar-ui:
assignee: nobody → Dariusz Smigiel (smigiel-dariusz)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tuskar-ui (master)

Fix proposed to branch: master
Review: https://review.openstack.org/168318

Revision history for this message
Radomir Dopieralski (deshipu) wrote :

I don't think we should be displaying an error. We should just accept the mac list and de-dupe it.

Revision history for this message
Liz Blanchard (lblanchard) wrote :

Adding my thoughts from a UX perspective...

So in the case where the user is adding the same MAC address twice to one node, I agree we should just remove one and not throw an error.

IF the user is adding two separate nodes, but adding the same MAC address for each node, we should give the user an error in the modal when they click submit (it should not try to actually submit). This way the user can fix their error and submit successfully. We need to be sure the error is descriptive enough. For example "Node 1 and Node 2 are using the same MAC address. These need to be unique."

Revision history for this message
Dariusz Smigiel (smigiel-dariusz) wrote :

Liz, changed according to your description.
Duplicated MAC address in one node is removed. When duplication occurs between two nodes, I've left default info about duplication.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tuskar-ui (master)

Reviewed: https://review.openstack.org/168318
Committed: https://git.openstack.org/cgit/openstack/tuskar-ui/commit/?id=6a1dba03eeb32f4c30475c623173042fca77e6f1
Submitter: Jenkins
Branch: master

commit 6a1dba03eeb32f4c30475c623173042fca77e6f1
Author: Dariusz Smigiel <email address hidden>
Date: Fri Mar 27 12:56:33 2015 +0100

    Remove duplicated MAC addresses from multi MAC field

    While adding new nodes, there is possibility to paste duplicated addresses in
    multi MAC field. Check if this situation occurred, and remove duplication.

    Closes-Bug: 1437212

    Change-Id: I02436ce6db1b7ce42b98dbb18c1e96b4452db222

Changed in tuskar-ui:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.