1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-03 01:17:41 +03:00

M #-: Add missing migrators from 876e0b9410

This commit is contained in:
Ruben S. Montero 2023-03-06 12:08:39 +01:00
parent 61e9aed937
commit 2318405b99
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 111 additions and 0 deletions

View File

@ -0,0 +1,76 @@
# -------------------------------------------------------------------------- #
# Copyright 2019-2023, OpenNebula Systems S.L. #
# #
# Licensed under the OpenNebula Software License #
# (the "License"); you may not use this file except in compliance with #
# the License. You may obtain a copy of the License as part of the software #
# distribution. #
# #
# See https://github.com/OpenNebula/one/blob/master/LICENSE.onsla #
# (or copy bundled with OpenNebula in /usr/share/doc/one/). #
# #
# Unless agreed to in writing, software distributed under the License is #
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY #
# KIND, either express or implied. See the License for the specific language #
# governing permissions and limitations under the License. #
# -------------------------------------------------------------------------- #
require 'opennebula'
$LOAD_PATH << File.dirname(__FILE__)
# OpenNebula DB migrator to 6.4
module Migrator
include OpenNebula
def db_version
'6.4.0'
end
def one_version
'OpenNebula 6.4.0'
end
def up
feature_5725
true
end
def feature_5725
init_log_time
# Add STATE and PREV state to all Virtual Networks
@db.run 'ALTER TABLE network_pool RENAME TO old_network_pool;'
create_table(:network_pool)
@db.transaction do
@db.fetch('SELECT * FROM old_network_pool') do |row|
doc = nokogiri_doc(row[:body], 'old_network_pool')
state_node = doc.create_element('STATE', '1')
doc.root.at_xpath('/VNET').add_child(state_node)
prev_state_node = doc.create_element('PREV_STATE', '1')
doc.root.at_xpath('/VNET').add_child(prev_state_node)
row[:body] = doc.root.to_s
@db[:network_pool].insert(row)
end
end
@db.run 'DROP TABLE old_network_pool;'
# Remove old hooks
%w[vcenter_net_create
vcenter_net_delete
vcenter_net_instantiate].each do |hook|
@db.run "DELETE FROM hook_pool WHERE name='#{hook}';"
end
log_time
true
end
end

View File

@ -0,0 +1,35 @@
# -------------------------------------------------------------------------- #
# Copyright 2019-2023, OpenNebula Systems S.L. #
# #
# Licensed under the OpenNebula Software License #
# (the "License"); you may not use this file except in compliance with #
# the License. You may obtain a copy of the License as part of the software #
# distribution. #
# #
# See https://github.com/OpenNebula/one/blob/master/LICENSE.onsla #
# (or copy bundled with OpenNebula in /usr/share/doc/one/). #
# #
# Unless agreed to in writing, software distributed under the License is #
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY #
# KIND, either express or implied. See the License for the specific language #
# governing permissions and limitations under the License. #
# -------------------------------------------------------------------------- #
require 'opennebula'
include OpenNebula
module Migrator
def db_version
"6.4.0"
end
def one_version
"OpenNebula 6.4.0"
end
def up
true
end
end