Cannot boot with legacy bdm against v2.1 Nova API

Bug #1491737 reported by Feodor Tersin
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
High
Andriy Kurilin

Bug Description

Since that DevStack uses v2.1 as a default compute service, nova boot command with legacy bdm specified fails.

nova boot --block-device-mapping /dev/vda=cb69ba25-b0ad-4899-8aad-c5382b762b7e:::1 ...

where cb69ba25-b0ad-4899-8aad-c5382b762b7e is a volume id
returns

BadRequest: Invalid input for field/attribute 0. Value: {u'boot_index': 0, u'uuid': u'cb69ba25-b0ad-4899-8aad-c5382b762b7e', u'device_name': u'/dev/vda', u'source_type': u'', u'volume_id': u'cb69ba25-b0ad-4899-8aad-c5382b762b7e', u'delete_on_termination': u'1'}. Additional properties are not allowed (u'source_type', u'boot_index', u'uuid' were unexpected) (HTTP 400)

the request from debug output:

DEBUG (session:195) REQ: curl -g -i -X POST http://169.254.5.50:8774/v2.1/9b6cac5d097e4cb59e676eb73fdaccd0/os-volumes_boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}a1ea51af42a1b649cb0e970d40246a951eb41ef2" -d '{"server": {"name": "inst1", "imageRef": "", "block_device_mapping": [{"boot_index": 0, "uuid": "cb69ba25-b0ad-4899-8aad-c5382b762b7e", "device_name": "/dev/vda", "source_type": "", "volume_id": "cb69ba25-b0ad-4899-8aad-c5382b762b7e", "delete_on_termination": "1"}], "flavorRef": "1", "max_count": 1, "min_count": 1}}'

At the same time the same request against v2 does work properly:

nova --service-type compute-legacy boot --block-device-mapping /dev/vda=cb69ba25-b0ad-4899-8aad-c5382b762b7e:::1 ...

returns an instance info.
The request from debug output:

DEBUG (session:195) REQ: curl -g -i -X POST http://169.254.5.50:8774/v2/9b6cac5d097e4cb59e676eb73fdaccd0/os-volumes_boot -H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}58fb5cf7d26c0e6f303eee0326433e9a563f6849" -d '{"server": {"name": "inst", "imageRef": "", "block_device_mapping": [{"boot_index": 0, "uuid": "cb69ba25-b0ad-4899-8aad-c5382b762b7e", "device_name": "/dev/vda", "source_type": "", "volume_id": "cb69ba25-b0ad-4899-8aad-c5382b762b7e", "delete_on_termination": "1"}], "flavorRef": "1", "max_count": 1, "min_count": 1}}'

Revision history for this message
melanie witt (melwitt) wrote :

So, this is getting a 400 back from nova API, which makes me think it's related to nova and not novaclient. We need to find out if v2.1 is supposed to support the legacy bdm format.

Revision history for this message
Feodor Tersin (ftersin) wrote :
melanie witt (melwitt)
Changed in python-novaclient:
importance: Undecided → High
status: New → Confirmed
Changed in python-novaclient:
assignee: nobody → Andrey Kurilin (andreykurilin)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

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

Changed in python-novaclient:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/221525
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=5153dcda807c554769081626c10c43d16adea671
Submitter: Jenkins
Branch: master

commit 5153dcda807c554769081626c10c43d16adea671
Author: Andrey Kurilin <email address hidden>
Date: Wed Sep 9 01:04:45 2015 +0300

    [BugFix] Change parameters for legacy bdm

    `_parse_block_device_mapping` method was design to support both
    bdm v1 and v2. The implementation is based on the fact that API side
    ignores unknown/incorrect parameters, so `_parse_block_device_mapping` compose
    equal parameter for bdm v1 and bdm v2. Since Nova V2.1 contains schema checks,
    such implementation stoped working.
    Despite the fact that novaclient.v2.servers contains separate logic for bdm v2,
    we can make `_parse_block_device_mapping` works only with legacy bdm and
    in future patches make it works for both bdm v1 and bdm v2.

    Change-Id: I37c00ac77b1a3b500221d779533532e9f43e5277
    Closes-Bug: #1491737

Changed in python-novaclient:
status: In Progress → Fix Committed
Changed in python-novaclient:
milestone: none → 2.29.0
status: Fix Committed → Fix Released
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.