Where the build request was deleted by the user (user deletes the instance) before we created the instance in a cell, but that means they shouldn't be able to list it later either, which is why we don't bother updating the instance mapping for that instance because the instance doesn't exist as a build request nor was it created in a cell.
I'm not sure why we don't just update the instance mapping as soon as we create the instance in a cell:
And if anything fails between those times, the instance will exist in a cell but the instance mapping won't point at it so you can't do things on the instance, but you can list it (because the list routine doesn't go through instance_mappings, it just iterates cells). Furthermore, the user could delete the instance in this case, but what they'd really be deleting is the build request, and since we don't have the instance mapping pointing to the cell, we won't know which cell to find the instance and delete it.
I think we might be hitting this:
https:/ /github. com/openstack/ nova/blob/ 6be7f7248fb1c2b bb890a0a48a424e 205e173c9c/ nova/conductor/ manager. py#L1243
Where the build request was deleted by the user (user deletes the instance) before we created the instance in a cell, but that means they shouldn't be able to list it later either, which is why we don't bother updating the instance mapping for that instance because the instance doesn't exist as a build request nor was it created in a cell.
I'm not sure why we don't just update the instance mapping as soon as we create the instance in a cell:
https:/ /github. com/openstack/ nova/blob/ 6be7f7248fb1c2b bb890a0a48a424e 205e173c9c/ nova/conductor/ manager. py#L1257
Because in the normal flow, we don't update the instance mapping until much later:
https:/ /github. com/openstack/ nova/blob/ 6be7f7248fb1c2b bb890a0a48a424e 205e173c9c/ nova/conductor/ manager. py#L1322
And if anything fails between those times, the instance will exist in a cell but the instance mapping won't point at it so you can't do things on the instance, but you can list it (because the list routine doesn't go through instance_mappings, it just iterates cells). Furthermore, the user could delete the instance in this case, but what they'd really be deleting is the build request, and since we don't have the instance mapping pointing to the cell, we won't know which cell to find the instance and delete it.