mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-10 01:17:40 +03:00
F #5005: Fix migrator bug. Make use of mysql2 in SQL backend
This commit is contained in:
parent
f0183fef2e
commit
32576f61fc
@ -101,7 +101,7 @@ module Migrator
|
||||
############################################################################
|
||||
def feature_5005
|
||||
@db.run "ALTER TABLE vm_pool RENAME TO old_vm_pool;"
|
||||
@db.run host_pool_schema()
|
||||
@db.run vm_pool_schema()
|
||||
|
||||
@db.transaction do
|
||||
@db.fetch("SELECT * FROM old_vm_pool") do |row|
|
||||
@ -110,7 +110,7 @@ module Migrator
|
||||
c.default_xml.noblanks
|
||||
}
|
||||
|
||||
doc.root.xpath(HISTORY_RECORDS/HISTORY).each do |h|
|
||||
doc.root.xpath("HISTORY_RECORDS/HISTORY").each do |h|
|
||||
reason = h.xpath("REASON")
|
||||
reason.unlink if !reason.nil?
|
||||
|
||||
@ -127,8 +127,8 @@ module Migrator
|
||||
|
||||
@db[:vm_pool].insert(row)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@db.run "DROP TABLE old_vm_pool;"
|
||||
end
|
||||
end
|
||||
|
@ -35,10 +35,10 @@ class OneDB
|
||||
@backend = BackEndSQLite.new(ops[:sqlite])
|
||||
elsif ops[:backend] == :mysql
|
||||
begin
|
||||
require 'mysql'
|
||||
require 'mysql2'
|
||||
rescue LoadError
|
||||
STDERR.puts "Ruby gem mysql is needed for this operation:"
|
||||
STDERR.puts " $ sudo gem install mysql"
|
||||
STDERR.puts "Ruby gem mysql2 is needed for this operation:"
|
||||
STDERR.puts " $ sudo gem install mysql2"
|
||||
exit -1
|
||||
end
|
||||
|
||||
|
@ -272,7 +272,7 @@ class BackEndMySQL < OneDBBacKEnd
|
||||
def connect_db
|
||||
passwd = CGI.escape(@passwd)
|
||||
|
||||
endpoint = "mysql://#{@user}:#{passwd}@#{@server}:#{@port}/#{@db_name}"
|
||||
endpoint = "mysql2://#{@user}:#{passwd}@#{@server}:#{@port}/#{@db_name}"
|
||||
|
||||
begin
|
||||
@db = Sequel.connect(endpoint)
|
||||
|
Loading…
Reference in New Issue
Block a user