wrong lock name when operating instance events

Bug #1330431 reported by Alex Xu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Alex Xu

Bug Description

We use wrong lock name at here:

    def prepare_for_instance_event(self, instance, event_name):
        """Prepare to receive an event for an instance.

        This will register an event for the given instance that we will
        wait on later. This should be called before initiating whatever
        action will trigger the event. The resulting eventlet.event.Event
        object should be wait()'d on to ensure completion.

        :param instance: the instance for which the event will be generated
        :param event_name: the name of the event we're expecting
        :returns: an event object that should be wait()'d on
        """
        @utils.synchronized(self._lock_name)
        def _create_or_get_event():
            if instance.uuid not in self._events:
                self._events.setdefault(instance.uuid, {})
            return self._events[instance.uuid].setdefault(
                event_name, eventlet.event.Event())
        LOG.debug('Preparing to wait for external event %(event)s',
                  {'event': event_name}, instance=instance)
        return _create_or_get_event()

We should invoke self._lock_name, not pass it as name.

So will get log message as below:

2014-06-16 17:44:59.022 DEBUG nova.openstack.common.lockutils [req-97211458-bae1-473b-a3ad-47fd153ae30a admin admin] Got semaphore "<function _lock_name at 0x7fe6a7edec08>" from (pid=30672) lock /opt/stack/nova/nova/openstack/common/lockutils.py:168

Same problem for pop_instance_event and clear_events_for_instance

Alex Xu (xuhj)
Changed in nova:
assignee: nobody → Alex Xu (xuhj)
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/100211

Changed in nova:
status: New → In Progress
Michael Still (mikal)
Changed in nova:
importance: Undecided → Medium
status: In Progress → Triaged
Changed in nova:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit c606043c64b31ba3289002dd9ac90b7566e1bca2
Author: He Jie Xu <email address hidden>
Date: Mon Jun 16 18:04:36 2014 +0800

    Fix wrong lock name for operating instance external events

    This patch correct the wrong lock name for operating instance events.
    Currently it use function object InstanceEvents._lock_name as the lock
    name, the lock name will be like "<function _lock_name at 0x7fe6a7edec08>".
    So when process the server external event, it will use one lock for all
    the events that may belong to different instances. This isn't efficient.
    This patch correct it to invoke InstanceEvents._lock_name to get the lock
    name as '<instance-uuid>-events'. Then the lock is per instance.

    Change-Id: I57712afe893933fde6ea7ab3f5d6328f04c65a8a
    Closes-Bug: #1330431

Changed in nova:
status: In Progress → Fix Committed
tags: added: icehouse-backport-potential
Changed in nova:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-2 → 2014.2
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.