Instance shutdown with libvirt hammers the DB

Bug #754983 reported by justinsb
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Josh Kearney

Bug Description

Here's the code that gets executed while an instance is being shut down (blamar has a fix pending for the instance state logic being flawed). I believe this loop hammers the DB (and libvirt / kvm) and there really should be (1) a sleep in there to avoid hammering libvirt and (2) something that doesn't hit the DB on every iteration (maybe don't update unless the state has changed?)

        while True:
            try:
                state = self.get_info(instance['name'])['state']
                db.instance_set_state(context.get_admin_context(),
                                      instance['id'], state)
                if state == power_state.SHUTDOWN:
                    break
            except Exception:
                db.instance_set_state(context.get_admin_context(),
                                      instance['id'],
                                      power_state.SHUTDOWN)
                break

Related branches

Revision history for this message
Jay Pipes (jaypipes) wrote :

Much agreed. At the very least, a sleep should be inserted in the loop...

Thierry Carrez (ttx)
Changed in nova:
importance: Undecided → Low
status: New → Confirmed
Josh Kearney (jk0)
Changed in nova:
status: Confirmed → In Progress
assignee: nobody → Josh Kearney (jk0)
Thierry Carrez (ttx)
Changed in nova:
milestone: none → cactus-rc
Josh Kearney (jk0)
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: cactus-rc → 2011.2
status: Fix Committed → Fix Released
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.