xenapi: stop using get_all_vdis_in_sr to get cached images

Bug #1221292 reported by John Garbutt
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
John Garbutt

Bug Description

get_all_vdis_in_sr is an expensive multiple call, lets try remove some uses of it.

For example, in _find_cached_images, lets consider querying xapi directly for the vdis with the given image-id.

Tags: xenserver
Revision history for this message
John Garbutt (johngarbutt) wrote :

replacing with get_all_records_where, see example in get_sr_path

Changed in nova:
assignee: nobody → John Garbutt (johngarbutt)
status: Triaged → In Progress
description: updated
summary: - xenapi: should replace get_all_vdis_in_sr
+ xenapi: stop using get_all_vdis_in_sr to get cached images
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/46706

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

Reviewed: https://review.openstack.org/46706
Committed: http://github.com/openstack/nova/commit/ce8e95c7a3fe9d94d6b03ee70c147e5e92aa3b5b
Submitter: Jenkins
Branch: master

commit ce8e95c7a3fe9d94d6b03ee70c147e5e92aa3b5b
Author: John Garbutt <email address hidden>
Date: Fri Sep 13 17:04:06 2013 +0100

    xenapi: stop using get_all_vdis_in_sr in spawn

    Currently when trying to find a cached image, the very expensive call to
    get_all_vdis_in_sr is used, where we could instead fetch the VDI
    directly using a more targeted query.

    Now we are fetching the VDI by name_label we must ensure to clear the
    name_label on newly created VDIs to ensure they do not get picked up by
    later calls to _find_cached_image().

    Fixes bug 1221292

    The above code that checks for _find_cached_images has race conditions
    where its possible to end up with two VDIs returned. To stop this
    happening the code to create the cached images is now synchronized on
    the image being fetched.

    Fixes bug 1226073

    Change-Id: I534fb8f42b00b5d39dc17dd5fee297144b5f379a

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → icehouse-1
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: icehouse-1 → 2014.1
Revision history for this message
Debasish Das (dskdas) wrote :

Because of the change to _find_cached_image, where it directly gets VDI, there is an issue with changing storage repository.

The issue can be reproduced with the following sequence:
1. Create a VM
2. Switch storage repository (got a new flash card and want to use it instead of spindle disk).
3. Create a VM with the same glance image
4. The VM still gets created on old storage repository, even though _find_sr returns the new storage repository

The only way, I could find, to get the VM to spin up on the new storage repository is to delete all VMs from old storage repository (referring to the glance image) and then create a new one.

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.