OpenStack Compute (Nova)

i18n-key and local-storage hard-coded in xenapi

Reported by Armando Migliaccio on 2012-01-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Undecided
Armando Migliaccio

Bug Description

In order to install/spawn instances, the XenAPI plugin looks for a specific SR on a XenServer/XCP host. More precisely, the plugin assumes the presence of a local SR, as per default XenServer install; this SR has the "other-config" parameter set to "i18n-key=local-storage".

If we look at the code (available in /virt/xenapi/vm_utils.py), this is clearly shown in find_sr:

    @classmethod
    def find_sr(cls, session):
        """Return the storage repository to hold VM images"""
        host = session.get_xenapi_host()

        for sr_ref, sr_rec in cls.get_all_refs_and_recs(session, 'SR'):
            if not ('i18n-key' in sr_rec['other_config'] and
                    sr_rec['other_config']['i18n-key'] == 'local-storage'):
                continue
            for pbd_ref in sr_rec['PBDs']:
                pbd_rec = cls.get_rec(session, 'PBD', pbd_ref)
                if pbd_rec and pbd_rec['host'] == host:
                    return sr_ref
        return None

Many people stumbled upon this, recently and in the past (eg. https://lists.launchpad.net/openstack-xenapi/msg00019.html), so it's time we move this into flags and log a meaningful exception. Plus, in cases where the XenServer only has shared storage, looking for 'local-storage' does feel wrong.

Changed in nova:
assignee: nobody → Armando Migliaccio (armando-migliaccio)
status: New → Confirmed

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

Changed in nova:
status: Confirmed → In Progress

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

commit c56d677a7313b8b29406eaebdd27e59b2c1ee927
Author: Armando Migliaccio <email address hidden>
Date: Wed Jan 25 00:35:34 2012 +0000

    bug 921087: i18n-key and local-storage hard-coded in xenapi

    This fix introduces a new flag 'sr_matching_filter', whose default value is
    'other-config:i18n-key=local-storage'. This filter is used for finding the
    SR on which to install guest instances. The default value is the Local
    Storage in default XenServer/XCP installations, and it is what was hard-coded
    so far.

    To select an SR with a different matching criteria, this flag can be set
    to 'other-config:my_favorite_sr=true'. On the other hand, to fall back on
    the Default SR, as displayed by XenCenter and as returned by
    xenapi.pool.get_default_SR, this flag can be set to to 'default-sr:true'.

    This changeset also makes a small code simplification along the way.

    Change-Id: Ia5ee438389c59a5ef0b858e8548643d57ef16c77

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-02-29
Changed in nova:
milestone: none → essex-4
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in nova:
milestone: essex-4 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers