[Ovirt-devel] [PATCH server] Use save! instead of save

Ian Main imain at redhat.com
Tue May 26 17:53:32 UTC 2009


This patch uses save! instead of save so that exceptions are thrown
when problems occur.  I was seeing dbomatic log that it had a host
avialable but the database was never updated so the save method was
failing silently.  Hopefully this will uncover some more bugs.

Signed-off-by: Ian Main <imain at redhat.com>
---
 src/db-omatic/db_omatic.rb |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/db-omatic/db_omatic.rb b/src/db-omatic/db_omatic.rb
index e043a6f..b3d5e73 100755
--- a/src/db-omatic/db_omatic.rb
+++ b/src/db-omatic/db_omatic.rb
@@ -219,7 +219,7 @@ class DbOmatic < Qpid::Qmf::Console
             #db_host.lock_version = 2
             # XXX: This would just be for init..
             #db_host.is_disabled = 0
-            db_host.save
+            db_host.save!
             host_info[:synced] = true
 
             if state == Host::STATE_AVAILABLE
@@ -406,7 +406,7 @@ class DbOmatic < Qpid::Qmf::Console
         db_host.each do |host|
             @logger.info "Marking host #{host.hostname} unavailable"
             host.state = Host::STATE_UNAVAILABLE
-            host.save
+            host.save!
         end
 
         begin
@@ -419,7 +419,7 @@ class DbOmatic < Qpid::Qmf::Console
         db_vm.each do |vm|
             @logger.info "Marking vm #{vm.description} as stopped."
             vm.state = Vm::STATE_STOPPED
-            vm.save
+            vm.save!
         end
     end
 
-- 
1.6.0.6




More information about the ovirt-devel mailing list