[Ovirt-devel] [PATCH] Fix optimistic locking during vm migration

Loiseleur Michel mloiseleur at linagora.com
Tue Jun 8 09:31:25 UTC 2010


Signed-off-by: Loiseleur Michel <mloiseleur at linagora.com>
---
 src/db-omatic/db_omatic.rb |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/db-omatic/db_omatic.rb b/src/db-omatic/db_omatic.rb
index da11bfa..79f29d2 100755
--- a/src/db-omatic/db_omatic.rb
+++ b/src/db-omatic/db_omatic.rb
@@ -195,6 +195,9 @@ class DbOmatic < Qmf::ConsoleHandler
         end
 
         @logger.info "Updating VM #{domain['name']} to state #{state}"
+        # Optimistic locking often fails for this operation
+        # See http://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html#M001320
+        vm.lock!
 
         if state == Vm::STATE_STOPPED
             @logger.info "VM has moved to stopped, clearing VM attributes."
-- 
1.7.0.4




More information about the ovirt-devel mailing list