Compute manager ignores image_meta from api when booting an instance

Bug #1281973 reported by Xavier Queralt
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Unassigned

Bug Description

When booting an instance, in the API layer, we get the image to be used for this instance or, if the instance is booted from a volume, the image metadata attached to the volume (if present). This allows us to know a bit more of the volume through the inherited properties of the image from where it was created. This same image metadata is then passed to the selected compute manager for processing the request.

Right now the compute manager completely ignores the image metadata and tries to obtain it only if the instance is booted from an image. This prevents us from obtaining some properties present in the volume that might be needed while starting the instance (think about the hw_disk_bus). Besides, it requires of an extra call to glance that can be avoided.

Changed in nova:
assignee: nobody → Xavier Queralt (xqueralt)
Changed in nova:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit 0185d2445f6db7278ba3a02ace597717ccdbd6b3
Author: Xavier Queralt <email address hidden>
Date: Wed Feb 19 18:48:16 2014 +0100

    Use image from the api in run_instance, if present

    When booting an instance, the API layer already fetches the image
    from glance and passes it to the compute manager. Right now, that
    info is ignored and the compute node has fetches the image metadata
    again from glance if booting from an image. This is a problem when
    booting from a volume, because most of the properties that the volume
    keeps when it has been created from an image won't be considered.

    With this patch, the image metadata passed to run_instance from the API
    will be used if present instead of asking glance again.

    Change-Id: I4680d9d309d7a09f64d52ef0fb105282ace79e5f
    Closes-Bug: 1281973

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Jean-Sebastien Mouret (js-mouret) wrote :

Booting from a volume fails now.

| fault | {"message": "'name'", "code": 500, "details": " File \"/usr/lib/python2.7/dist-packages/nova/compute/manager.py\", line 259, in decorated_function |
| | return function(self, context, *args, **kwargs) |
| | File \"/usr/lib/python2.7/dist-packages/nova/compute/manager.py\", line 1848, in run_instance |
| | do_run_instance() |
| | File \"/usr/lib/python2.7/dist-packages/nova/openstack/common/lockutils.py\", line 249, in inner |
| | return f(*args, **kwargs) |
| | File \"/usr/lib/python2.7/dist-packages/nova/compute/manager.py\", line 1847, in do_run_instance |
| | legacy_bdm_in_spec) |
| | File \"/usr/lib/python2.7/dist-packages/nova/compute/manager.py\", line 996, in _run_instance |
| | notify(\"error\", fault=e) # notify that build failed |
| | File \"/usr/lib/python2.7/dist-packages/nova/openstack/common/excutils.py\", line 68, in __exit__ |
| | six.reraise(self.type_, self.value, self.tb) |
| | File \"/usr/lib/python2.7/dist-packages/nova/compute/manager.py\", line 971, in _run_instance |
| | extra_usage_info = {\"image_name\": image_meta['name']} |
| | ", "created": "2014-03-03T07:31:36Z"} |

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/77528

Revision history for this message
Xavier Queralt (xqueralt-deactivatedaccount) wrote :

It's obvious that the volume won't inherit the name of the image which we don't even need when not booting from an image. The patch in [1] should fix this. Thanks for noticing!

[1] https://review.openstack.org/77528

Changed in nova:
importance: Undecided → High
status: Fix Committed → In Progress
Changed in nova:
importance: High → Medium
importance: Medium → High
Revision history for this message
John Garbutt (johngarbutt) wrote :

reopened due bad fix above

Changed in nova:
importance: High → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to nova (master)

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

commit 43aaf80942a0afb7471e803e57a3db851dab608b
Author: Xavier Queralt <email address hidden>
Date: Mon Mar 3 09:37:53 2014 +0100

    Ignore the image name when booting from volume

    In 0185d2445 the _run_instance method was changed to acquire the image
    metadata from the request_spec instead of glance. This was needed to be
    able to get the image_metadata attached to a volume, when booting from
    it. That change didn't consider that the image name key is not inherited
    when creating a volume from an image and introduced a bug when creating
    the usage_info for volume booted instances.

    This change fixes this by only attaching the image name to the usage_info
    only when booting from an image and not when booting from a volume.

    Related-Bug: 1281973
    Change-Id: I8ec441e7815855a94a28c4566790d5144deff16f

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-rc1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-rc1 → 2014.1
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.