Loiseleur Michel
2010-Jun-08 09:31 UTC
[Ovirt-devel] [PATCH] Fix optimistic locking during vm migration
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
Ian Main
2010-Jun-08 23:16 UTC
[Ovirt-devel] [PATCH] Fix optimistic locking during vm migration
On Tue, 2010-06-08 at 11:31 +0200, Loiseleur Michel wrote:> 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!I haven't looked at the code this is going into yet, but don't you need a way to retry on failure? Ian
Reasonably Related Threads
- [PATCH server] Replace the occurence of the type @qmfc.object(Qmf::Query.new(:class => "xxx", 'key' => search_key)) for @qmfc.object(Qmf::Query.new(:class => "xxx"), 'key' => search_key) else the search on the key is not functionnal.
- [PATCH server] Fixed db-omatic so it doesn't segfault because of newer qmf api.
- [PATCH server] Fixed db-omatic so it doesn't die due to an unhandled ActiveRecord::StaleObjectError exception.
- [PATCH] Fix dbomatic state changes.
- problem with kerberos (I think)