From e63850a4b04a45f1d356ced702e5583c29ef42a4 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Thu, 10 Apr 2014 12:28:35 +0200 Subject: [PATCH] Bug #2525: Checks that it cannot connect with OpenNebula --- src/onedb/onedb | 1 + src/onedb/onedb.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/onedb/onedb b/src/onedb/onedb index c555ff2bb3..12b52238ff 100755 --- a/src/onedb/onedb +++ b/src/onedb/onedb @@ -37,6 +37,7 @@ $: << RUBY_LIB_LOCATION+'/onedb' require 'cli/command_parser' require 'onedb' +require 'opennebula' FORCE={ :name => "force", diff --git a/src/onedb/onedb.rb b/src/onedb/onedb.rb index eb9a97c5e3..9162a02424 100644 --- a/src/onedb/onedb.rb +++ b/src/onedb/onedb.rb @@ -133,6 +133,8 @@ class OneDB # max_version is ignored for now, as this is the first onedb release. # May be used in next releases def upgrade(max_version, ops) + one_not_running() + db_version = @backend.read_db_version if ops[:verbose] @@ -437,6 +439,12 @@ is preserved. if File.exists?(LOCK_FILE) raise "First stop OpenNebula. Lock file found: #{LOCK_FILE}" end + + client = OpenNebula::Client.new + rc = client.get_version + if !OpenNebula.is_error?(rc) + raise "OpenNebula found listening on '#{client.one_endpoint}'" + end end def pretty_print_db_version(db_version)