Nova can incorrectly think an instance is volume backed

Bug #1501851 reported by Andrew Laski
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Nimish Joshi
Liberty
Fix Released
Low
Sven Anderson

Bug Description

If an instance is booted with "nova boot --block-device source=image,dest=local..." the instance ends up with no image_ref set and an entry in the block_device_mappings table. This confuses the compute/api.py is_volume_backed_instance method which assumes that if image_ref isn't set then the instance is volume backed.

Andrew Laski (alaski)
tags: added: volumes
Changed in nova:
importance: Undecided → Low
status: New → Confirmed
tags: added: low-hanging-fruit
Nimish Joshi (jnimish77)
Changed in nova:
assignee: nobody → Nimish (jnimish77)
Revision history for this message
Nimish Joshi (jnimish77) wrote :

Hi, can you specify the issue in details please?
-thank you

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/234165

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Matthew Booth (mbooth-9) wrote :

Can you post the complete command line you used to boot an instance? I get the following trying to do this:

$ nova boot --block-device source=image,dest=local,id=62b38431-b89c-404f-9ece-f4d7eb2a0aa4 --flavor m1.tiny foo
ERROR (BadRequest): Block Device Mapping is Invalid: Mapping image to local is not supported. (HTTP 400) (Request-ID: req-21076585-78f7-42d5-8487-f33f226d86a8)

Revision history for this message
Andrew Laski (alaski) wrote :

The comment at http://git.openstack.org/cgit/openstack/nova/tree/nova/block_device.py#n205 indicates that the --image flag is needed as well when booting in this manner. I missed that since I was recreating the API request based on what I was actually seeing in the db. I did not see the API request that led to this.

Revision history for this message
Matthew Booth (mbooth-9) wrote :

I saw that too, but I still can't reproduce:

$ nova boot --image 62b38431-b89c-404f-9ece-f4d7eb2a0aa4 --block-device source=image,dest=local,id=62b38431-b89c-404f-9ece-f4d7eb2a0aa4 --flavor m1.tiny foo
ERROR (BadRequest): Block Device Mapping is Invalid: Mapping image to local is not supported. (HTTP 400) (Request-ID: req-2f29d8e4-8be5-4f4f-8f7d-6cc94c2c437b)

$ nova boot --image 62b38431-b89c-404f-9ece-f4d7eb2a0aa4 --block-device source=image,dest=local,id=62b38431-b89c-404f-9ece-f4d7eb2a0aa4,bootindex=0 --flavor m1.tiny foo
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-6b9712e9-07a6-4b10-9ff8-ddcbb46897a8)

I think you're saying that you saw a bdm of source=image,dest=local, and inferred the root cause? I might take a look and see if I can come up with another way this might have arisen.

Revision history for this message
Andrew Laski (alaski) wrote :

Yes, that is what I did. It is possible that these instances were created at a time when a lack of checks allowed them to be booted in a way that is no longer possible.

However I still believe it's a bug to have the is_volume_backed_instance method rely on a blank image_ref to determine whether or not it's volume backed. It should check on the boot device.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Nikola Đipanov (ndipanov) wrote :

The check was added by a fix for this bug: https://bugs.launchpad.net/nova/+bug/1377958

And then improved by this fix: https://review.openstack.org/#/c/166401/

Agreed with Andrew that we should really not be relying on an empty image field when we have all the information explicitly stored and can make a decision without guessing.

Dan Smith (danms)
tags: added: liberty-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit db184423e512aff9653d74a3d3bcfc6c80b23403
Author: Sven Anderson <email address hidden>
Date: Tue Nov 10 14:33:13 2015 +0100

    Fix is_volume_backed_instance() for unset image_ref

    is_volume_backed_instance() assumed from old times, that if image_ref
    is not set, the instance is always volume backed. This is not true
    anymore, since block device mappings can also reference images as
    source. This fix adapts the test cases and function accordingly.

    Change-Id: Ie83d8d8154d372991fb37dae0def37e3f4583090
    Closes-Bug: #1501851

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

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/247773

Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/nova 13.0.0.0b1

This issue was fixed in the openstack/nova 13.0.0.0b1 development milestone.

Changed in nova:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/liberty)

Reviewed: https://review.openstack.org/247773
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=d0f4a37c2acdaa531908db7fec782477b6158de4
Submitter: Jenkins
Branch: stable/liberty

commit d0f4a37c2acdaa531908db7fec782477b6158de4
Author: Sven Anderson <email address hidden>
Date: Tue Nov 10 14:33:13 2015 +0100

    Fix is_volume_backed_instance() for unset image_ref

    is_volume_backed_instance() assumed from old times, that if image_ref
    is not set, the instance is always volume backed. This is not true
    anymore, since block device mappings can also reference images as
    source. This fix adapts the test cases and function accordingly.

    Change-Id: Ie83d8d8154d372991fb37dae0def37e3f4583090
    Closes-Bug: #1501851
    (cherry picked from commit db184423e512aff9653d74a3d3bcfc6c80b23403)

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/nova 12.0.1

This issue was fixed in the openstack/nova 12.0.1 release.

Matt Riedemann (mriedem)
tags: removed: liberty-backport-potential
tags: added: in-stable-liberty
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Michael Still (<email address hidden>) on branch: master
Review: https://review.openstack.org/234165
Reason: This patch has been idle for a long time, so I am abandoning it to keep the review clean sane. If you're interested in still working on this patch, then please unabandon it and upload a new patchset.

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.