[FakeDriver] Live migration issue, power_state=NOSTATE

Bug #1426433 reported by Lorenzo Affetti on 2015-02-27
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Stephen Finucane

Bug Description

[nova master]
In FakeDrivers, when live-migrating an instance everything goes ok.
So, resources are allocated the correct way and instance's host has been changed, but instance Power State goes to NOSTATE.

This seems to be caused by get_info method which programmatically raises InstanceNotFound exception.
Instances list inside FakeDriver seems not to be updated accordingly.

I actually fixed the problem in my local code (nova.virt.fake.FakeDriver) with:

def live_migration(self, context, instance, dest,
                       post_method, recover_method, block_migration=False,
        post_method(context, instance, dest, block_migration,

++ name = instance['name']
++ del self.instances[name]



def post_live_migration_at_destination(self, context, instance,

++ name = instance['name']
++ state = power_state.RUNNING
++ fake_instance = FakeInstance(name, state, instance['uuid'])
++ self.instances[name] = fake_instance

But I don't know if it is a satisfying solution.
With this solution the instance is live_migrated and in state ACTIVE and power state RUNNING after the operation.

Thank you

description: updated
description: updated

Lorenzo, will you be filing a review?

Lorenzo Affetti (affox90) wrote :

O yes, I think I will do it asap.
I think that my solution is a nitty gritty one and i hoped to find experts to write a more suitable code!
I have never bugfixed something.

I will try with pleasure.

Joe Gordon (jogo) on 2015-03-06
Changed in nova:
status: New → Confirmed
tags: added: low-hanging-fruit
Changed in nova:
importance: Undecided → Low
Changed in nova:
assignee: nobody → Lorenzo Affetti (affox90)
Andrea Rosa (andrea-rosa-m) wrote :

@Lorenzo are you still working on this bug? If not please change the assignee from you to 'nobody'

Lorenzo Affetti (affox90) wrote :

@Andrea thank you for waking me up! I want to fix this in next weeks.

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

Changed in nova:
status: Confirmed → In Progress
Changed in nova:
assignee: Lorenzo Affetti (affox90) → Stephen Finucane (sfinucan)
Anup (anup-d-navare) wrote :

Is this bug fixed?

The age of this report and number of assignee changes suggest that this
isn't really a low-hanging-fruit. I'm removing the tag to not confuse
new folks who are searching for that tag.

tags: added: testing
removed: low-hanging-fruit

Change abandoned by Michael Still (<email address hidden>) on branch: master
Review: https://review.openstack.org/243613
Reason: This patch is quite old, so I am abandoning it to keep the review queue manageable. Feel free to restore the change if you're still interested in working on it.

Changed in nova:
assignee: Stephen Finucane (stephenfinucane) → nobody
Changed in nova:
status: In Progress → Confirmed
Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
status: Confirmed → In Progress
Matt Riedemann (mriedem) on 2018-08-08
Changed in nova:
assignee: Matt Riedemann (mriedem) → Lorenzo Affetti (affox90)
Changed in nova:
assignee: Lorenzo Affetti (affox90) → Matt Riedemann (mriedem)
Matt Riedemann (mriedem) on 2019-10-22
Changed in nova:
assignee: Matt Riedemann (mriedem) → Lorenzo Affetti (affox90)
Changed in nova:
assignee: Lorenzo Affetti (affox90) → Stephen Finucane (stephenfinucane)

Reviewed: https://review.opendev.org/243613
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=14342d629b714f172545f133314b5ce584503cae
Submitter: Zuul
Branch: master

commit 14342d629b714f172545f133314b5ce584503cae
Author: Lorenzo Affetti <email address hidden>
Date: Tue Nov 10 12:56:59 2015 +0100

    FakeDriver: adding and removing instances on live migration.

    There was no code in FakeDriver that updated the internal
    dict `self.instances` when a FakeInstance was live migrated.
    This commit fills this gap. As a result, a couple of versioned
    notification samples get updated since we are now properly
    tracking a live migrated instance on the destination host as
    running vs pending power state.

    Closes-Bug: 1426433

    Change-Id: I9562e1bcbb18c7d543d5a6b36011fa28c13dfa79

Changed in nova:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers