Not adding a image block device mapping causes some valid boot requests to fail

Bug #1433609 reported by Nikola Đipanov
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
jichenjc
Kilo
Fix Released
High
Unassigned
python-novaclient
Fix Released
Medium
Unassigned

Bug Description

The following commit removed the code in the python nova client that would add an image block device mapping entry (source_type: image, destination_type: local) in preparation for fixing https://bugs.launchpad.net/nova/+bug/1377958.

However this makes some valid instance boot requests not work as expected as they will not pass the block device mapping validation because of this. An example would be:

nova boot test-vm --flavor m1.medium --image centos-vm-32 --nic net-id=c3f40e33-d535-4217-916b-1450b8cd3987 --block-device id=26b7b917-2794-452a-95e5-2efb2ca6e32d,bus=sata,source=volume,bootindex=1

Which would be a valid boot request previously since the client would add a block device with boot_index=0 that would not fail.

Changed in nova:
importance: Undecided → High
Revision history for this message
Nikola Đipanov (ndipanov) wrote :

It seems to me that fixing this will actually require putting back the code that was removed by https://review.openstack.org/#/c/153203/ and heavily modifying the original fix to https://bugs.launchpad.net/nova/+bug/1377958 (https://review.openstack.org/#/c/126303 - already landed on master)

The reasoning behind is: first of all changing what the API expects is tricky and we would need to make sure we version it correctly. Also the API as it stands now is consistent - it will expect you to specify block devices in the API request with the proper boot sequence, and it's up to the client to translate the well known CLI syntax into the correct request.

Since we still want to reject any other sourec=image, dest=local block device mapping as per bug https://bugs.launchpad.net/nova/+bug/1377958 - this can be done by comparing compare it with what is passed as 'imageRef' and reject it if it's not a known special case of a "boot image" that all drivers handle independently of the block device mapping data anyway.

For a discussion that initiated this bug report see as it may contain some more detials:

http://lists.openstack.org/pipermail/openstack-dev/2015-March/059173.html

Changed in nova:
status: New → Confirmed
jichenjc (jichenjc)
Changed in nova:
assignee: nobody → jichenjc (jichenjc)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
melanie witt (melwitt) wrote :

The novaclient part was reverted here https://review.openstack.org/#/c/165932/

Qin Zhao (zhaoqin)
tags: added: kilo-backport-potential
Revision history for this message
Qin Zhao (zhaoqin) wrote :

It breaks ephemeral disk functionality. I think we need to backport the patch to kilo release.

See https://bugs.launchpad.net/nova/+bug/1442501

Matt Riedemann (mriedem)
tags: added: kilo-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/166401
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=cadbcc440a2fcfb8532f38111999a06557fbafc2
Submitter: Jenkins
Branch: master

commit cadbcc440a2fcfb8532f38111999a06557fbafc2
Author: jichenjc <email address hidden>
Date: Fri Mar 20 08:36:37 2015 +0800

    Release bdm constraint source and dest type

    https://bugs.launchpad.net/nova/+bug/1377958 fixed a problem
    that source_type: image, destination_type: local is not
    supported for boot instance, exception should be raised to
    reject the param otherwise it will lead to instance become
    ERROR state.

    However the fix introduced a problem on nova client
    https://bugs.launchpad.net/python-novaclient/+bug/1418484
    The fix of the bug leads to following command become invalid

    nova boot test-vm --flavor m1.medium --image centos-vm-32
    --nic net-id=c3f40e33-d535-4217-916b-1450b8cd3987 --block-device
    id=26b7b917-2794-452a-95e5-2efb2ca6e32d,bus=sata,source=volume,bootindex=1

    So we need to release the original constraint to allow
    the above special case pass the validation check then
    we can revert the nova client exception
    (https://review.openstack.org/#/c/165932/)

    This patch checks the boot_index and whether image param is
    given after we found the bdm has source_type: image,
    destination_type: local, if this is the special case, then
    no exception will be raised.

    Closes-Bug: #1433609

    Change-Id: If43faae95169bc3864449a8364975f5c887aac14

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

Fix proposed to branch: proposed/kilo
Review: https://review.openstack.org/172563

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/174060

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (proposed/kilo)

Change abandoned by Doug Hellmann (<email address hidden>) on branch: proposed/kilo
Review: https://review.openstack.org/172563
Reason: replaced by https://review.openstack.org/174060 in stable/kilo

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/kilo)

Reviewed: https://review.openstack.org/174060
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=3cff2c673c6cdf487c2a1eb2a5c6c89c6de80d11
Submitter: Jenkins
Branch: stable/kilo

commit 3cff2c673c6cdf487c2a1eb2a5c6c89c6de80d11
Author: jichenjc <email address hidden>
Date: Fri Mar 20 08:36:37 2015 +0800

    Release bdm constraint source and dest type

    https://bugs.launchpad.net/nova/+bug/1377958 fixed a problem
    that source_type: image, destination_type: local is not
    supported for boot instance, exception should be raised to
    reject the param otherwise it will lead to instance become
    ERROR state.

    However the fix introduced a problem on nova client
    https://bugs.launchpad.net/python-novaclient/+bug/1418484
    The fix of the bug leads to following command become invalid

    nova boot test-vm --flavor m1.medium --image centos-vm-32
    --nic net-id=c3f40e33-d535-4217-916b-1450b8cd3987 --block-device
    id=26b7b917-2794-452a-95e5-2efb2ca6e32d,bus=sata,source=volume,bootindex=1

    So we need to release the original constraint to allow
    the above special case pass the validation check then
    we can revert the nova client exception
    (https://review.openstack.org/#/c/165932/)

    This patch checks the boot_index and whether image param is
    given after we found the bdm has source_type: image,
    destination_type: local, if this is the special case, then
    no exception will be raised.

    Closes-Bug: #1433609

    Change-Id: If43faae95169bc3864449a8364975f5c887aac14
    (cherry picked from commit cadbcc440a2fcfb8532f38111999a06557fbafc2)

Revision history for this message
LiangChen (hs-chen) wrote :

Hi, I used the devstack with stable/kilo to test, but it failed today.
And I check the bug-fix is in the code.

[root@localhost nova]# git show 290839b853f58e515dc07c77f03b5ebd1502f57b
commit 290839b853f58e515dc07c77f03b5ebd1502f57b
Merge: 916ce6f 3cff2c6
Author: Jenkins <email address hidden>
Date: Tue Apr 21 10:49:53 2015 +0000

    Merge "Release bdm constraint source and dest type" into stable/kilo

[root@localhost nova]# nova boot test01 --flavor 2 --image cirros-0.3.2-x86_64-uec-kernel --nic net-id=7754392d-f56e-4240-9a64-9ee5710251be --block-device id=7b2da991-986a-4806-9384-9210a9b700cf,bus=sata,source=volume,bootindex=1
ERROR (BadRequest): Block Device Mapping is Invalid: Boot sequence for the instance and image/block device mapping combination is not valid. (HTTP 400) (Request-ID: req-2d6d9063-bc3c-4a97-b7d0-1233f202a676)

Revision history for this message
jichenjc (jichenjc) wrote :

are you using the latest nova client?
the change includes both novaclient and nova code
can you check whether you have https://review.openstack.org/#/c/165932/ in your novaclinet?

Zhao qin used to tell me the code fixed his issue...

Revision history for this message
LiangChen (hs-chen) wrote :

Hi,
    Thanks.
    The request has accepted With the patch . (https://review.openstack.org/#/c/165932/)

  The devstack is not include the nova client fix, just include the nova fix.

Revision history for this message
jichenjc (jichenjc) wrote :

guess python-novaclient need to be updated in devstack? not faimliar with that area
glad it works

Thierry Carrez (ttx)
tags: removed: kilo-backport-potential kilo-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)
Download full text (18.1 KiB)

Reviewed: https://review.openstack.org/179284
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=5228d4e418734164ffa5ccd91d2865d9cc659c00
Submitter: Jenkins
Branch: master

commit 906ab9d6522b3559b4ad36d40dec3af20397f223
Author: He Jie Xu <email address hidden>
Date: Thu Apr 16 07:09:34 2015 +0800

    Update rpc version aliases for kilo

    Update all of the rpc client API classes to include a version alias
    for the latest version implemented in Kilo. This alias is needed when
    doing rolling upgrades from Kilo to Liberty. With this in place, you can
    ensure all services only send messages that both Kilo and Liberty will
    understand.

    Closes-Bug: #1444745

    Conflicts:
     nova/conductor/rpcapi.py

    NOTE(alex_xu): The conflict is due to there are some logs already added
    into the master.

    Change-Id: I2952aec9aae747639aa519af55fb5fa25b8f3ab4
    (cherry picked from commit 78a8b5802ca148dcf37c5651f75f2126d261266e)

commit f191a2147a21c7e50926b288768a96900cf4c629
Author: Hans Lindgren <email address hidden>
Date: Fri Apr 24 13:10:39 2015 +0200

    Add security group calls missing from latest compute rpc api version bump

    The recent compute rpc api version bump missed out on the security group
    related calls that are part of the api.

    One possible reason is that both compute and security group client side
    rpc api:s share a single target, which is of little value and only cause
    mistakes like this.

    This change eliminates future problems like this by combining them into
    one to get a 1:1 relationship between client and server api:s.

    Change-Id: I9207592a87fab862c04d210450cbac47af6a3fd7
    Closes-Bug: #1448075
    (cherry picked from commit bebd00b117c68097203adc2e56e972d74254fc59)

commit a2872a9262985bd0ee2c6df4f7593947e0516406
Author: Dan Smith <email address hidden>
Date: Wed Apr 22 09:02:03 2015 -0700

    Fix migrate_flavor_data() to catch instances with no instance_extra rows

    The way the query was being performed previously, we would not see any
    instances that didn't have a row in instance_extra. This could happen if
    an instance hasn't been touched for several releases, or if the data
    set is old.

    The fix is a simple change to use outerjoin instead of join. This patch
    includes a test that ensures that instances with no instance_extra rows
    are included in the migration. If we query an instance without such a
    row, we create it before doing a save on the instance.

    Closes-Bug: #1447132
    Change-Id: I2620a8a4338f5c493350f26cdba3e41f3cb28de7
    (cherry picked from commit 92714accc49e85579f406de10ef8b3b510277037)

commit e3a7b83834d1ae2064094e9613df75e3b07d77cd
Author: OpenStack Proposal Bot <email address hidden>
Date: Thu Apr 23 02:18:41 2015 +0000

    Updated from global requirements

    Change-Id: I5d4acd36329fe2dccb5772fed3ec55b442597150

commit 8c9b5e620eef3233677b64cd234ed2551e6aa182
Author: Divya <email address hidden>
Date: Tue Apr 21 08:26:29 2015 +0200

    Control create/delete flavor api permissions using policy.json

    The permissions of ...

Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Revision history for this message
melanie witt (melwitt) wrote :
Changed in python-novaclient:
importance: Undecided → Medium
status: New → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-1 → 12.0.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (stable/kilo)

Reviewed: https://review.openstack.org/216507
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=861d7614f1c0920dcbb5d60421f03abb3d795c11
Submitter: Jenkins
Branch: stable/kilo

commit 861d7614f1c0920dcbb5d60421f03abb3d795c11
Author: jichenjc <email address hidden>
Date: Thu Mar 19 22:58:17 2015 +0800

    Revert 'Remove image to local block device mapping'

    https://review.openstack.org/#/c/153203/3 added check
    for novaclient, removed the logic for both
    --image and --block-device are added.

    But actually the following valid boot command failed
    due to the change here, so this patch reverted original
    one and add some descriptions to avoid further removal.

    nova boot test-vm --flavor m1.medium --image centos-vm-32
    --nic net-id=c3f40e33-d535-4217-916b-1450b8cd3987
    --block-device id=26b7b917-2794-452a-95e5-2efb2ca6e32d,bus=sata,
    source=volume,bootindex=1

    Change-Id: Ia29e63c72b34d3038aa591c466425e65edf5755b
    Partial-Bug: #1433609
    (cherry picked from commit 8679eedb8352630012202c12a9c9acf8757802a5)

tags: added: in-stable-kilo
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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