list_instances() returns a list of nodes, not instances

Bug #1309719 reported by Adam Gandelman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
Medium
Lucas Alvares Gomes

Bug Description

From nova.virt.driver:

    def list_instances(self):
        """Return the names of all the instances known to the virtualization
        layer, as a list.
        """

However, the ironic driver currently just returns a list of ironic nodes. The best we can do from the Ironic driver is to return a list of instance uuids.

This causes some inaccurate accounting of running instances in nova.compute.manager, and perhaps some unnecessary API calls to the ironic driver, specifically in ComputeVirtAPI._get_instances_on_driver().

Returning names would require an added instance lookup, but there is also a list_instance_uuiids() method available that we do not implement, that would avoid list_instances() entirely.

Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Looking at this closer, it appears difficult to resolve instance names from Ironic node's associated instance_uuids from within IronicDriver:list_instances(). We do not have access to the request context and consequently cannot use nova.objects.instance.Instace.get_by_uuid(). In addition to adding the list_instance_uuids(), I think list_instances() needs to be fixed. It is used in various checks throughout nova.compute.manager, which always return False for Ironic. This happens to work because of the single instance-to-node ratio, but who knows where this will bite us in the future.

Changed in ironic:
assignee: nobody → Lucas Alvares Gomes (lucasagomes)
Changed in ironic:
importance: Undecided → Critical
importance: Critical → Medium
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Related fix proposed to ironic (master)

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

Changed in ironic:
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to ironic (master)

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

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

Reviewed: https://review.openstack.org/92384
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=b09d98fe94ffc907dc749e6983e3b4f3b9863990
Submitter: Jenkins
Branch: master

commit b09d98fe94ffc907dc749e6983e3b4f3b9863990
Author: Lucas Alvares Gomes <email address hidden>
Date: Tue May 6 12:20:49 2014 +0100

    Pass kwargs to ClientWrapper's call() method

    As the ClientWrapper class had no unittests some were added to test
    the specific part of the code for this change. The FakeClient() and
    associated classes from test_driver.py were moved to a common file to
    make it easier to be imported and used by the new unittests.

    Partial-bug: #1316549
    Related-bug: #1309719
    Change-Id: I11be25a6ce981e63027073d12fbf2922896f4693

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

Reviewed: https://review.openstack.org/92385
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=d2a632d7e290852c8fadb1bf3968e573ef8c537c
Submitter: Jenkins
Branch: master

commit d2a632d7e290852c8fadb1bf3968e573ef8c537c
Author: Lucas Alvares Gomes <email address hidden>
Date: Tue May 6 13:52:27 2014 +0100

    list_instances() to return a list of instances names

    Previously the list_instances() method in the Nova Ironic driver was
    returning a list of instances UUIDs instead of a list of instances names
    causing various checks throughout nova.compute.manager to always return
    False for Ironic.

    Closes-Bug: #1309719
    Change-Id: I0ed29911f180f99a7e2b1c00ddd6c43064f04f7f

Changed in ironic:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ironic:
milestone: none → juno-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ironic:
milestone: juno-1 → 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.