mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-25 02:50:08 +03:00
Bug #4376: migrator of the vlan_bitmap table
This commit is contained in:
parent
0cac55790a
commit
9c362e4e9a
@ -15,6 +15,8 @@
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
require 'set'
|
||||
require 'base64'
|
||||
require 'zlib'
|
||||
|
||||
require 'opennebula'
|
||||
|
||||
@ -752,6 +754,31 @@ module Migrator
|
||||
end
|
||||
@db.run "DROP TABLE old_vm_pool;"
|
||||
|
||||
log_time()
|
||||
|
||||
############################################################################
|
||||
# Bug #4376 - VLAN IDs Bitmap
|
||||
############################################################################
|
||||
|
||||
## Create and bootstrap 'vlan_bitmap' table
|
||||
|
||||
# Create Table
|
||||
@db.run "CREATE TABLE network_vlan_bitmap (id INTEGER, map LONGTEXT, PRIMARY KEY(id));"
|
||||
|
||||
map = ""
|
||||
4096.times.each do |i|
|
||||
map << (reserved_vlan_ids.include?(4095 - i) ? "1" : "0")
|
||||
end
|
||||
|
||||
map_encoded = Base64::strict_encode64(Zlib::Deflate.deflate(map))
|
||||
|
||||
@db[:network_vlan_bitmap].insert(
|
||||
:id => 0,
|
||||
:map => map_encoded
|
||||
)
|
||||
|
||||
log_time()
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user