Unable to change nodes' yaml configuration through CLI

Bug #1331883 reported by Anton Rodionov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
Fix Released
High
Dima Shulyak
5.0.x
Fix Committed
High
Dima Shulyak

Bug Description

Using the fuel CLI or curl directly we are unable to upload interface configuration. Even though the config uploaded is the same as the config downloaded it complains that the interface is missing a type. Type is clearly set as you can see below.

[root@fuel ~]# curl -X PUT http://127.0.0.1:8000/api/v1/nodes/1/interfaces/ -H Content-Type:application/json -d '[{"interfaces": [{"name": "eth0", "type": "ether", "state": "up", "mac": "00:25:b5:61:0d:9f", "max_speed": 10000, "current_speed": 20000, "assigned_networks": [{"id": 1, "name": "fuelweb_admin"}, {"id": 14, "name": "management"}], "type": "ether", "id": 2}], "id": 1}]'
Node '1': each interface must have a type

[root@fuel ~]# fuel --debug --env 4 node --node-id 1 --network --download
GET http://127.0.0.1:8000/api/v1/nodes/1/interfaces/
Node attributes for interfaces were written to:
/root/node_1/interfaces.yaml
[root@fuel ~]# cat node_1/interfaces.yaml
- assigned_networks:
- id: 1
name: fuelweb_admin
- id: 14
name: management
current_speed: 20000
id: 2
mac: 00:25:b5:61:0d:9f
max_speed: 10000
name: eth0
state: up
type: ether
- assigned_networks:
- id: 13
name: public
- id: 15
name: storage
- id: 16
name: private
current_speed: 20000
id: 1
mac: 00:25:b5:61:0d:8f
max_speed: 10000
name: eth1
state: up
type: ether
[root@fuel ~]# fuel --debug --env 4 node --node-id 1 --network --upload
PUT http://127.0.0.1:8000/api/v1/nodes/1/interfaces/ data=[{"interfaces": [{"name": "eth0", "mac": "00:25:b5:61:0d:9f", "state": "up", "max_speed": 10000, "current_speed": 20000, "assigned_networks": [{"id": 1, "name": "fuelweb_admin"}, {"id": 14, "name": "management"}], "type": "ether", "id": 2}, {"name": "eth1", "mac": "00:25:b5:61:0d:8f", "state": "up", "max_speed": 10000, "current_speed": 20000, "assigned_networks": [{"id": 13, "name": "public"}, {"id": 15, "name": "storage"}, {"id": 16, "name": "private"}], "type": "ether", "id": 1}], "id": 1}]
HTTP Error 400: Bad Request (Node '1': each interface must have a type)
[root@fuel ~]#

Revision history for this message
Nastya Urlapova (aurlapova) wrote :

Anton, thanks for issue post. For more clarification, please provide iso version.

Changed in fuel:
importance: Undecided → Medium
assignee: nobody → Fuel Python Team (fuel-python)
Revision history for this message
Dima Shulyak (dshulyak) wrote :

I can reproduce it on current master

Changed in fuel:
status: New → Confirmed
milestone: none → 5.1
Revision history for this message
Dima Shulyak (dshulyak) wrote :

Well the issue is in fuelclient, it forms incorrect json.

Correct one below:

[root@nailgun ~]# fuel --debug --env 1 node --node-id 1 --network --upload
PUT http://127.0.0.1:8000/api/v1/nodes/1/interfaces/ data=[{"name": "eth0", "mac": "64:d1:96:2e:bd:b3", "state": "up", "max_speed": null, "current_speed": null, "assigned_networks": [{"id": 1, "name": "fuelweb_admin"}], "type": "ether", "id": 5}, {"name": "eth1", "mac": "64:e9:bb:d3:6a:c5", "state": "up", "max_speed": null, "current_speed": null, "assigned_networks": [{"id": 3, "name": "management"}], "type": "ether", "id": 4}, {"name": "eth2", "mac": "64:2e:89:3d:86:53", "state": "up", "max_speed": null, "current_speed": null, "assigned_networks": [{"id": 4, "name": "storage"}], "type": "ether", "id": 3}, {"name": "eth3", "mac": "64:89:84:5e:76:56", "state": "up", "max_speed": null, "current_speed": null, "assigned_networks": [{"id": 2, "name": "public"}], "type": "ether", "id": 2}, {"name": "eth4", "mac": "64:3f:45:d2:c9:b0", "state": "up", "max_speed": null, "current_speed": null, "assigned_networks": [], "type": "ether", "id": 1}]

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-web (master)

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

Changed in fuel:
assignee: Fuel Python Team (fuel-python) → Dima Shulyak (dshulyak)
status: Confirmed → In Progress
Revision history for this message
Dima Shulyak (dshulyak) wrote :

Anton, i tested this code on lab, and was able to update interfaces.
Can you confirm that it works for you?

Revision history for this message
Anton Rodionov (arodionov) wrote : Re: [Bug 1331883] Re: Unable to change nodes' yaml configuration through CLI

Including Denis Ipatov into the conversation, he was able to reproduce the
issue.
I was only reporting the customer-found defect. The customer has the latest
release, 5.0.

Denis, please look at this.

On Thu, Jun 19, 2014 at 5:02 PM, Dima Shulyak <email address hidden> wrote:

> Anton, i tested this code on lab, and was able to update interfaces.
> Can you confirm that it works for you?
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1331883
>
> Title:
> Unable to change nodes' yaml configuration through CLI
>
> Status in Fuel: OpenStack installer that works:
> In Progress
>
> Bug description:
> Using the fuel CLI or curl directly we are unable to upload interface
> configuration. Even though the config uploaded is the same as the
> config downloaded it complains that the interface is missing a type.
> Type is clearly set as you can see below.
>
> [root@fuel ~]# curl -X PUT
> http://127.0.0.1:8000/api/v1/nodes/1/interfaces/ -H
> Content-Type:application/json -d '[{"interfaces": [{"name": "eth0", "type":
> "ether", "state": "up", "mac": "00:25:b5:61:0d:9f", "max_speed": 10000,
> "current_speed": 20000, "assigned_networks": [{"id": 1, "name":
> "fuelweb_admin"}, {"id": 14, "name": "management"}], "type": "ether", "id":
> 2}], "id": 1}]'
> Node '1': each interface must have a type
>
> [root@fuel ~]# fuel --debug --env 4 node --node-id 1 --network
> --download
> GET http://127.0.0.1:8000/api/v1/nodes/1/interfaces/
> Node attributes for interfaces were written to:
> /root/node_1/interfaces.yaml
> [root@fuel ~]# cat node_1/interfaces.yaml
> - assigned_networks:
> - id: 1
> name: fuelweb_admin
> - id: 14
> name: management
> current_speed: 20000
> id: 2
> mac: 00:25:b5:61:0d:9f
> max_speed: 10000
> name: eth0
> state: up
> type: ether
> - assigned_networks:
> - id: 13
> name: public
> - id: 15
> name: storage
> - id: 16
> name: private
> current_speed: 20000
> id: 1
> mac: 00:25:b5:61:0d:8f
> max_speed: 10000
> name: eth1
> state: up
> type: ether
> [root@fuel ~]# fuel --debug --env 4 node --node-id 1 --network --upload
> PUT http://127.0.0.1:8000/api/v1/nodes/1/interfaces/
> data=[{"interfaces": [{"name": "eth0", "mac": "00:25:b5:61:0d:9f", "state":
> "up", "max_speed": 10000, "current_speed": 20000, "assigned_networks":
> [{"id": 1, "name": "fuelweb_admin"}, {"id": 14, "name": "management"}],
> "type": "ether", "id": 2}, {"name": "eth1", "mac": "00:25:b5:61:0d:8f",
> "state": "up", "max_speed": 10000, "current_speed": 20000,
> "assigned_networks": [{"id": 13, "name": "public"}, {"id": 15, "name":
> "storage"}, {"id": 16, "name": "private"}], "type": "ether", "id": 1}],
> "id": 1}]
> HTTP Error 400: Bad Request (Node '1': each interface must have a type)
> [root@fuel ~]#
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/fuel/+bug/1331883/+subscriptions
>

--
Best regards
Anton Rodionov
OpenStack Operations Engineer
Mirantis Services

Revision history for this message
Miroslav Anashkin (manashkin) wrote :

Raised priority and nominated for 5.0.1 release as well.

Everyone who is going to customize network settings with CLI will encounter this bug.
Including our services team.

Revision history for this message
Denis Ipatov (dipatov) wrote :

[root@6a55aa7df8ac site-packages]# patch -p2 < diff.patch
patching file fuelclient/objects/node.py
Reversed (or previously applied) patch detected! Assume -R? [n] -R
Apply anyway? [n] y
Hunk #1 FAILED at 77.
1 out of 1 hunk FAILED -- saving rejects to file fuelclient/objects/node.py.rej
patching file tests/base.py
patching file tests/test_client.py
Hunk #1 succeeded at 15 (offset -2 lines).
Hunk #2 succeeded at 126 (offset -13 lines).
Hunk #3 succeeded at 213 (offset -13 lines).

Revision history for this message
Denis Ipatov (dipatov) wrote :

After applying the patch nodes are unable to boot through PXE.

Could you please provide an instruction for applying the patch?

Revision history for this message
Dima Shulyak (dshulyak) wrote :

Denis, this code completely unrelated to PXE boot.
I will check if there is any conflicts for applying this patch to stable/5.0

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

Reviewed: https://review.openstack.org/101203
Committed: https://git.openstack.org/cgit/stackforge/fuel-web/commit/?id=891f8c8c3d50ac9c675d89f6891d44e2f05896be
Submitter: Jenkins
Branch: master

commit 891f8c8c3d50ac9c675d89f6891d44e2f05896be
Author: Dima Shulyak <email address hidden>
Date: Thu Jun 19 15:59:19 2014 +0300

    Send json in correct format for nodes/<id>/interfaces

    Fix format for PUT request to nodes/id/interfaces handler

    Change-Id: I3a6194383c9d85448b32afeea3dedf807c6069e5
    Closes-Bug: #1331883

Changed in fuel:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to fuel-web (stable/5.0)

Fix proposed to branch: stable/5.0
Review: https://review.openstack.org/102261

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fuel-web (stable/5.0)

Reviewed: https://review.openstack.org/102261
Committed: https://git.openstack.org/cgit/stackforge/fuel-web/commit/?id=cf9b4826b03b3fc96a65670b117611de108dc5f2
Submitter: Jenkins
Branch: stable/5.0

commit cf9b4826b03b3fc96a65670b117611de108dc5f2
Author: Dima Shulyak <email address hidden>
Date: Thu Jun 19 15:59:19 2014 +0300

    Send json in correct format for nodes/<id>/interfaces

    Fix format for PUT request to nodes/id/interfaces handler

    Change-Id: I3a6194383c9d85448b32afeea3dedf807c6069e5
    Closes-Bug: #1331883

Dmitry Pyzhov (dpyzhov)
no longer affects: fuel/5.1.x
tags: added: in progress
Revision history for this message
Andrey Sledzinskiy (asledzinskiy) wrote :

verified on
{

    "build_id": "2014-09-17_21-40-34",
    "ostf_sha": "64cb59c681658a7a55cc2c09d079072a41beb346",
    "build_number": "11",
    "auth_required": true,
    "api": "1.0",
    "nailgun_sha": "eb8f2b358ea4bb7eb0b2a0075e7ad3d3a905db0d",
    "production": "docker",
    "fuelmain_sha": "8ef433e939425eabd1034c0b70e90bdf888b69fd",
    "astute_sha": "f5fbd89d1e0e1f22ef9ab2af26da5ffbfbf24b13",
    "feature_groups": [
        "mirantis"
    ],
    "release": "5.1",
    "release_versions": {
        "2014.1.1-5.1": {
            "VERSION": {
                "build_id": "2014-09-17_21-40-34",
                "ostf_sha": "64cb59c681658a7a55cc2c09d079072a41beb346",
                "build_number": "11",
                "api": "1.0",
                "nailgun_sha": "eb8f2b358ea4bb7eb0b2a0075e7ad3d3a905db0d",
                "production": "docker",
                "fuelmain_sha": "8ef433e939425eabd1034c0b70e90bdf888b69fd",
                "astute_sha": "f5fbd89d1e0e1f22ef9ab2af26da5ffbfbf24b13",
                "feature_groups": [
                    "mirantis"
                ],
                "release": "5.1",
                "fuellib_sha": "d9b16846e54f76c8ebe7764d2b5b8231d6b25079"
            }
        }
    },
    "fuellib_sha": "d9b16846e54f76c8ebe7764d2b5b8231d6b25079"

}

tags: removed: in progress
Changed in fuel:
status: Fix Committed → Fix Released
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.