wakame-vdc-dcmgr 11.06.0 → 11.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +19 -31
- data/bin/collector +6 -1
- data/config/db/migrations/0001_v1110_origin.rb +446 -0
- data/config/dcmgr.conf.example +51 -0
- data/lib/dcmgr.rb +99 -22
- data/lib/dcmgr/cli/base.rb +34 -1
- data/lib/dcmgr/cli/host.rb +24 -20
- data/lib/dcmgr/cli/image.rb +38 -19
- data/lib/dcmgr/cli/keypair.rb +16 -12
- data/lib/dcmgr/cli/network.rb +189 -81
- data/lib/dcmgr/cli/quota.rb +2 -2
- data/lib/dcmgr/cli/security_group.rb +106 -0
- data/lib/dcmgr/cli/spec.rb +144 -39
- data/lib/dcmgr/cli/storage.rb +16 -15
- data/lib/dcmgr/cli/tag.rb +20 -14
- data/lib/dcmgr/cli/vlan.rb +5 -5
- data/lib/dcmgr/drivers/backing_store.rb +32 -0
- data/lib/dcmgr/drivers/comstar.rb +81 -0
- data/lib/dcmgr/drivers/iijgio_storage.rb +9 -19
- data/lib/dcmgr/drivers/iscsi_target.rb +41 -0
- data/lib/dcmgr/drivers/kvm.rb +161 -28
- data/lib/dcmgr/drivers/linux_iscsi.rb +60 -0
- data/lib/dcmgr/drivers/local_storage.rb +24 -0
- data/lib/dcmgr/drivers/lxc.rb +167 -125
- data/lib/dcmgr/drivers/raw.rb +74 -0
- data/lib/dcmgr/drivers/s3_storage.rb +7 -19
- data/lib/dcmgr/drivers/snapshot_storage.rb +18 -28
- data/lib/dcmgr/drivers/storage_initiator.rb +28 -0
- data/lib/dcmgr/drivers/sun_iscsi.rb +32 -0
- data/lib/dcmgr/drivers/zfs.rb +77 -0
- data/lib/dcmgr/endpoints/core_api.rb +315 -263
- data/lib/dcmgr/endpoints/errors.rb +21 -10
- data/lib/dcmgr/endpoints/metadata.rb +360 -23
- data/lib/dcmgr/helpers/cli_helper.rb +6 -3
- data/lib/dcmgr/helpers/ec2_metadata_helper.rb +9 -0
- data/lib/dcmgr/helpers/nic_helper.rb +11 -0
- data/lib/dcmgr/helpers/snapshot_storage_helper.rb +34 -0
- data/lib/dcmgr/models/account.rb +0 -6
- data/lib/dcmgr/models/account_resource.rb +0 -4
- data/lib/dcmgr/models/base_new.rb +14 -2
- data/lib/dcmgr/models/dhcp_range.rb +38 -0
- data/lib/dcmgr/models/frontend_system.rb +0 -6
- data/lib/dcmgr/models/history.rb +0 -11
- data/lib/dcmgr/models/host_node.rb +131 -0
- data/lib/dcmgr/models/hostname_lease.rb +0 -8
- data/lib/dcmgr/models/image.rb +31 -18
- data/lib/dcmgr/models/instance.rb +137 -143
- data/lib/dcmgr/models/instance_nic.rb +52 -29
- data/lib/dcmgr/models/instance_security_group.rb +9 -0
- data/lib/dcmgr/models/instance_spec.rb +163 -31
- data/lib/dcmgr/models/ip_lease.rb +10 -21
- data/lib/dcmgr/models/mac_lease.rb +30 -11
- data/lib/dcmgr/models/network.rb +148 -27
- data/lib/dcmgr/models/physical_network.rb +18 -0
- data/lib/dcmgr/models/quota.rb +0 -10
- data/lib/dcmgr/models/request_log.rb +3 -18
- data/lib/dcmgr/models/security_group.rb +66 -0
- data/lib/dcmgr/models/security_group_rule.rb +145 -0
- data/lib/dcmgr/models/ssh_key_pair.rb +16 -19
- data/lib/dcmgr/models/{storage_pool.rb → storage_node.rb} +35 -25
- data/lib/dcmgr/models/tag.rb +0 -14
- data/lib/dcmgr/models/tag_mapping.rb +1 -7
- data/lib/dcmgr/models/vlan_lease.rb +2 -8
- data/lib/dcmgr/models/volume.rb +49 -37
- data/lib/dcmgr/models/volume_snapshot.rb +15 -17
- data/lib/dcmgr/node_modules/hva_collector.rb +69 -28
- data/lib/dcmgr/node_modules/instance_ha.rb +23 -12
- data/lib/dcmgr/node_modules/instance_monitor.rb +16 -2
- data/lib/dcmgr/node_modules/openflow_controller.rb +784 -0
- data/lib/dcmgr/node_modules/scheduler.rb +189 -0
- data/lib/dcmgr/node_modules/service_netfilter.rb +452 -227
- data/lib/dcmgr/node_modules/service_openflow.rb +731 -0
- data/lib/dcmgr/node_modules/sta_collector.rb +20 -0
- data/lib/dcmgr/node_modules/sta_tgt_initializer.rb +35 -0
- data/lib/dcmgr/rack/request_logger.rb +11 -6
- data/lib/dcmgr/rpc/hva_handler.rb +256 -110
- data/lib/dcmgr/rpc/sta_handler.rb +244 -0
- data/lib/dcmgr/scheduler.rb +122 -8
- data/lib/dcmgr/scheduler/host_node/exclude_same.rb +24 -0
- data/lib/dcmgr/scheduler/host_node/find_first.rb +12 -0
- data/lib/dcmgr/scheduler/host_node/least_usage.rb +28 -0
- data/lib/dcmgr/scheduler/host_node/per_instance.rb +18 -0
- data/lib/dcmgr/scheduler/host_node/specify_node.rb +26 -0
- data/lib/dcmgr/scheduler/network/flat_single.rb +23 -0
- data/lib/dcmgr/scheduler/network/nat_one_to_one.rb +23 -0
- data/lib/dcmgr/scheduler/network/per_instance.rb +39 -0
- data/lib/dcmgr/scheduler/network/vif_template.rb +19 -0
- data/lib/dcmgr/scheduler/storage_node/find_first.rb +13 -0
- data/lib/dcmgr/scheduler/storage_node/least_usage.rb +23 -0
- data/lib/dcmgr/storage_service.rb +39 -40
- data/lib/dcmgr/tags.rb +3 -3
- data/lib/dcmgr/version.rb +1 -1
- data/lib/dcmgr/vnet.rb +105 -0
- data/lib/dcmgr/vnet/factories.rb +141 -0
- data/lib/dcmgr/vnet/isolators/by_securitygroup.rb +21 -0
- data/lib/dcmgr/vnet/isolators/dummy.rb +17 -0
- data/lib/dcmgr/vnet/netfilter/cache.rb +51 -0
- data/lib/dcmgr/vnet/netfilter/chain.rb +66 -0
- data/lib/dcmgr/vnet/netfilter/controller.rb +193 -0
- data/lib/dcmgr/vnet/netfilter/ebtables_rule.rb +53 -0
- data/lib/dcmgr/vnet/netfilter/iptables_rule.rb +45 -0
- data/lib/dcmgr/vnet/netfilter/task_manager.rb +459 -0
- data/lib/dcmgr/vnet/tasks/accept_all_dns.rb +19 -0
- data/lib/dcmgr/vnet/tasks/accept_arp_broadcast.rb +24 -0
- data/lib/dcmgr/vnet/tasks/accept_arp_from_friends.rb +34 -0
- data/lib/dcmgr/vnet/tasks/accept_arp_from_gateway.rb +21 -0
- data/lib/dcmgr/vnet/tasks/accept_arp_to_host.rb +30 -0
- data/lib/dcmgr/vnet/tasks/accept_ip_from_friends.rb +26 -0
- data/lib/dcmgr/vnet/tasks/accept_ip_from_gateway.rb +23 -0
- data/lib/dcmgr/vnet/tasks/accept_ip_to_anywhere.rb +18 -0
- data/lib/dcmgr/vnet/tasks/accept_related_established.rb +45 -0
- data/lib/dcmgr/vnet/tasks/accept_wakame_dhcp_only.rb +33 -0
- data/lib/dcmgr/vnet/tasks/accept_wakame_dns_only.rb +33 -0
- data/lib/dcmgr/vnet/tasks/debug_iptables.rb +21 -0
- data/lib/dcmgr/vnet/tasks/drop_arp_forwarding.rb +27 -0
- data/lib/dcmgr/vnet/tasks/drop_arp_to_host.rb +24 -0
- data/lib/dcmgr/vnet/tasks/drop_ip_from_anywhere.rb +18 -0
- data/lib/dcmgr/vnet/tasks/drop_ip_spoofing.rb +34 -0
- data/lib/dcmgr/vnet/tasks/drop_mac_spoofing.rb +33 -0
- data/lib/dcmgr/vnet/tasks/exclude_from_nat.rb +47 -0
- data/lib/dcmgr/vnet/tasks/security_group.rb +37 -0
- data/lib/dcmgr/vnet/tasks/static_nat.rb +54 -0
- data/lib/dcmgr/vnet/tasks/translate_metadata_address.rb +32 -0
- data/web/metadata/config.ru +1 -1
- metadata +174 -89
- data/lib/dcmgr/cli/group.rb +0 -101
- data/lib/dcmgr/endpoints/core_api_mock.rb +0 -865
- data/lib/dcmgr/models/host_pool.rb +0 -122
- data/lib/dcmgr/models/instance_netfilter_group.rb +0 -16
- data/lib/dcmgr/models/netfilter_group.rb +0 -89
- data/lib/dcmgr/models/netfilter_rule.rb +0 -21
- data/lib/dcmgr/scheduler/find_last.rb +0 -16
- data/lib/dcmgr/scheduler/find_random.rb +0 -16
- data/lib/dcmgr/stm/instance.rb +0 -25
- data/lib/dcmgr/stm/snapshot_context.rb +0 -33
- data/lib/dcmgr/stm/volume_context.rb +0 -65
data/Rakefile
CHANGED
@@ -9,36 +9,23 @@ require 'dcmgr'
|
|
9
9
|
|
10
10
|
task :environment do
|
11
11
|
Dcmgr.configure 'config/dcmgr.conf'
|
12
|
-
Dcmgr.run_initializers
|
13
12
|
end
|
14
13
|
|
15
14
|
namespace :db do
|
16
15
|
desc 'Create all database tables'
|
17
16
|
task :init => [ :environment ] do
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
Dcmgr::Models.const_get(c).create_table!
|
23
|
-
}
|
24
|
-
Isono::Models::NodeState.create_table!
|
25
|
-
Isono::Models::JobState.create_table!
|
26
|
-
|
27
|
-
Dcmgr::Models::CREATE_TABLE_CLASSES.each { |c|
|
28
|
-
Dcmgr::Models.const_get(c).install_data
|
29
|
-
}
|
17
|
+
Dcmgr.run_initializers(:sequel)
|
18
|
+
|
19
|
+
Sequel.extension :migration
|
20
|
+
Sequel::Migrator.apply(Sequel::DATABASES.first, File.expand_path('../config/db/migrations', __FILE__), 9999)
|
30
21
|
end
|
31
22
|
|
32
23
|
desc 'Drop all database tables'
|
33
24
|
task :drop => [ :environment ] do
|
34
|
-
|
35
|
-
require 'isono'
|
25
|
+
Dcmgr.run_initializers(:sequel)
|
36
26
|
|
37
|
-
|
38
|
-
|
39
|
-
}
|
40
|
-
Isono::Models::NodeState.drop_table
|
41
|
-
Isono::Models::JobState.drop_table
|
27
|
+
Sequel.extension :migration
|
28
|
+
Sequel::Migrator.apply(Sequel::DATABASES.first, File.expand_path('../config/db/migrations', __FILE__), 0)
|
42
29
|
end
|
43
30
|
end
|
44
31
|
|
@@ -67,8 +54,8 @@ task :gem do
|
|
67
54
|
s.email = ['dev@axsh.net']
|
68
55
|
s.homepage = 'http://wakame.jp/'
|
69
56
|
s.name = 'wakame-vdc-dcmgr'
|
70
|
-
s.summary = "
|
71
|
-
s.description = ''
|
57
|
+
s.summary = "Wakame-VDC: Server modules"
|
58
|
+
s.description = 'Datacenter Hypervisor'
|
72
59
|
s.require_path = 'lib'
|
73
60
|
s.required_ruby_version = '>= 1.8.7'
|
74
61
|
|
@@ -80,18 +67,20 @@ task :gem do
|
|
80
67
|
s.bindir='bin'
|
81
68
|
s.executables = %w(collector)
|
82
69
|
|
83
|
-
s.add_dependency "isono", "0.2.
|
70
|
+
s.add_dependency "isono", "0.2.9"
|
84
71
|
s.add_dependency "log4r"
|
85
72
|
s.add_dependency "extlib", '0.9.15'
|
86
73
|
s.add_dependency "configuration"
|
87
|
-
s.add_dependency "statemachine", '1.1.1'
|
88
74
|
s.add_dependency "ruby-hmac"
|
89
75
|
s.add_dependency "ipaddress", '0.7.0'
|
90
|
-
s.add_dependency "rack", ">= 1.2
|
91
|
-
s.add_dependency "sinatra", "1.2.
|
76
|
+
s.add_dependency "rack", ">= 1.3.2"
|
77
|
+
s.add_dependency "sinatra", "1.2.6"
|
92
78
|
s.add_dependency "json", ">= 1.2.0"
|
93
|
-
s.add_dependency "sequel", "3.
|
79
|
+
s.add_dependency "sequel", "3.27.0"
|
94
80
|
s.add_dependency "mysql", ">= 2.8.1"
|
81
|
+
s.add_dependency "net-dhcp", ">= 1.1.0"
|
82
|
+
s.add_dependency "bit-struct", ">= 0.13.6"
|
83
|
+
s.add_dependency "racket", ">= 1.0.11"
|
95
84
|
|
96
85
|
s.add_development_dependency 'bacon'
|
97
86
|
s.add_development_dependency 'rake'
|
@@ -107,8 +96,8 @@ task :gem do
|
|
107
96
|
s.email = ['dev@axsh.net']
|
108
97
|
s.homepage = 'http://wakame.jp/'
|
109
98
|
s.name = 'wakame-vdc-agents'
|
110
|
-
s.summary = "
|
111
|
-
s.description = ''
|
99
|
+
s.summary = "Wakame-VDC: Agent modules"
|
100
|
+
s.description = 'Datacenter Hypervisor'
|
112
101
|
s.require_path = 'lib'
|
113
102
|
s.required_ruby_version = '>= 1.8.7'
|
114
103
|
|
@@ -119,11 +108,10 @@ task :gem do
|
|
119
108
|
s.bindir='bin'
|
120
109
|
s.executables = %w(hva sta nsa)
|
121
110
|
|
122
|
-
s.add_dependency "isono", "0.2.
|
111
|
+
s.add_dependency "isono", "0.2.9"
|
123
112
|
s.add_dependency "log4r"
|
124
113
|
s.add_dependency "extlib", '0.9.15'
|
125
114
|
s.add_dependency "configuration"
|
126
|
-
s.add_dependency "statemachine", '1.1.1'
|
127
115
|
s.add_dependency "ruby-hmac"
|
128
116
|
s.add_dependency "ipaddress", '0.7.0'
|
129
117
|
s.add_dependency "open4"
|
data/bin/collector
CHANGED
@@ -20,12 +20,17 @@ manifest.instance_eval do
|
|
20
20
|
load_module Isono::NodeModules::JobCollector
|
21
21
|
load_module Dcmgr::NodeModules::HvaCollector
|
22
22
|
load_module Dcmgr::NodeModules::InstanceHA
|
23
|
+
load_module Dcmgr::NodeModules::Scheduler
|
23
24
|
|
24
25
|
config do |c|
|
25
26
|
c.data_store.connection_block = proc {
|
26
27
|
require 'sequel'
|
27
|
-
next if Isono::NodeModules::DataStore.disconnected? == false
|
28
|
+
next if Isono::NodeModules::DataStore.disconnected? == false
|
28
29
|
Dcmgr.run_initializers('sequel')
|
30
|
+
|
31
|
+
# TODO; configuration in dcmgr.conf.
|
32
|
+
# c.node_collector.timeout_sec = (60*20).to_f
|
33
|
+
# c.node_collector.kill_sec = (60*20*2).to_f
|
29
34
|
}
|
30
35
|
end
|
31
36
|
end
|
@@ -0,0 +1,446 @@
|
|
1
|
+
Sequel.migration do
|
2
|
+
up do
|
3
|
+
create_table(:accounts) do
|
4
|
+
primary_key :id, :type=>"int(11)"
|
5
|
+
column :uuid, "varchar(255)", :null=>false
|
6
|
+
column :description, "varchar(255)"
|
7
|
+
column :enabled, "int(11)", :default=>1, :null=>false
|
8
|
+
column :created_at, "datetime", :null=>false
|
9
|
+
column :updated_at, "datetime", :null=>false
|
10
|
+
|
11
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
12
|
+
end
|
13
|
+
|
14
|
+
create_table(:frontend_systems) do
|
15
|
+
primary_key :id, :type=>"int(11)"
|
16
|
+
column :kind, "varchar(255)", :null=>false
|
17
|
+
column :key, "varchar(255)", :null=>false
|
18
|
+
column :credential, "varchar(255)"
|
19
|
+
|
20
|
+
index [:key], :unique=>true, :name=>:key
|
21
|
+
end
|
22
|
+
|
23
|
+
create_table(:histories) do
|
24
|
+
primary_key :id, :type=>"int(11)"
|
25
|
+
column :uuid, "varchar(255)", :null=>false
|
26
|
+
column :attr, "varchar(255)", :null=>false
|
27
|
+
column :vchar_value, "varchar(255)"
|
28
|
+
column :blob_value, "text"
|
29
|
+
column :created_at, "datetime", :null=>false
|
30
|
+
|
31
|
+
index [:uuid, :attr]
|
32
|
+
index [:uuid, :created_at]
|
33
|
+
end
|
34
|
+
|
35
|
+
create_table(:host_nodes) do
|
36
|
+
primary_key :id, :type=>"int(11)"
|
37
|
+
column :account_id, "varchar(255)", :null=>false
|
38
|
+
column :uuid, "varchar(255)", :null=>false
|
39
|
+
column :created_at, "datetime", :null=>false
|
40
|
+
column :updated_at, "datetime", :null=>false
|
41
|
+
column :node_id, "varchar(255)"
|
42
|
+
column :arch, "varchar(255)", :null=>false
|
43
|
+
column :hypervisor, "varchar(255)", :null=>false
|
44
|
+
column :name, "varchar(255)", :null => true
|
45
|
+
column :offering_cpu_cores, "int(11)", :null=>false
|
46
|
+
column :offering_memory_size, "int(11)", :null=>false
|
47
|
+
|
48
|
+
index [:account_id]
|
49
|
+
index [:node_id]
|
50
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
51
|
+
end
|
52
|
+
|
53
|
+
create_table(:hostname_leases) do
|
54
|
+
primary_key :id, :type=>"int(11)"
|
55
|
+
column :account_id, "varchar(255)", :null=>false
|
56
|
+
column :hostname, "varchar(32)", :null=>false
|
57
|
+
column :created_at, "datetime", :null=>false
|
58
|
+
column :updated_at, "datetime", :null=>false
|
59
|
+
|
60
|
+
index [:account_id, :hostname], :unique=>true
|
61
|
+
end
|
62
|
+
|
63
|
+
create_table(:images) do
|
64
|
+
primary_key :id, :type=>"int(11)"
|
65
|
+
column :account_id, "varchar(255)", :null=>false
|
66
|
+
column :uuid, "varchar(255)", :null=>false
|
67
|
+
column :created_at, "datetime", :null=>false
|
68
|
+
column :updated_at, "datetime", :null=>false
|
69
|
+
column :boot_dev_type, "int(11)", :default=>1, :null=>false
|
70
|
+
column :source, "text", :null=>false
|
71
|
+
column :arch, "varchar(255)", :null=>false
|
72
|
+
column :description, "text"
|
73
|
+
column :md5sum, "varchar(255)", :null=>false
|
74
|
+
column :is_public, "tinyint(1)", :null=>false, :default=>false
|
75
|
+
column :state, "varchar(255)", :default=>"init", :null=>false
|
76
|
+
column :features, "text"
|
77
|
+
|
78
|
+
index [:account_id]
|
79
|
+
index [:is_public]
|
80
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
81
|
+
end
|
82
|
+
|
83
|
+
create_table(:instance_security_groups) do
|
84
|
+
primary_key :id, :type=>"int(11)"
|
85
|
+
column :instance_id, "int(11)", :null=>false
|
86
|
+
column :security_group_id, "int(11)", :null=>false
|
87
|
+
|
88
|
+
index [:instance_id]
|
89
|
+
index [:security_group_id]
|
90
|
+
end
|
91
|
+
|
92
|
+
create_table(:instance_nics) do
|
93
|
+
primary_key :id, :type=>"int(11)"
|
94
|
+
column :uuid, "varchar(255)", :null=>false
|
95
|
+
column :instance_id, "int(11)", :null=>false
|
96
|
+
column :network_id, "int(11)", :null=>false
|
97
|
+
column :nat_network_id, "int(11)"
|
98
|
+
column :mac_addr, "varchar(12)", :null=>false
|
99
|
+
column :device_index, "int(11)", :null=>false
|
100
|
+
column :deleted_at, "datetime"
|
101
|
+
column :created_at, "datetime", :null=>false
|
102
|
+
column :updated_at, "datetime", :null=>false
|
103
|
+
|
104
|
+
index [:deleted_at]
|
105
|
+
index [:instance_id]
|
106
|
+
index [:mac_addr]
|
107
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
108
|
+
end
|
109
|
+
|
110
|
+
create_table(:instance_specs) do
|
111
|
+
primary_key :id, :type=>"int(11)"
|
112
|
+
column :account_id, "varchar(255)", :null=>false
|
113
|
+
column :uuid, "varchar(255)", :null=>false
|
114
|
+
column :hypervisor, "varchar(255)", :null=>false
|
115
|
+
column :arch, "varchar(255)", :null=>false
|
116
|
+
column :cpu_cores, "int(11)", :null=>false
|
117
|
+
column :memory_size, "int(11)", :null=>false
|
118
|
+
column :quota_weight, "double", :default=>1.0, :null=>false
|
119
|
+
column :vifs, "text", :default=>''
|
120
|
+
column :drives, "text", :default=>''
|
121
|
+
column :config, "text", :null=>false, :default=>''
|
122
|
+
column :created_at, "datetime", :null=>false
|
123
|
+
column :updated_at, "datetime", :null=>false
|
124
|
+
|
125
|
+
index [:account_id]
|
126
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
127
|
+
end
|
128
|
+
|
129
|
+
create_table(:instances) do
|
130
|
+
primary_key :id, :type=>"int(11)"
|
131
|
+
column :account_id, "varchar(255)", :null=>false
|
132
|
+
column :uuid, "varchar(255)", :null=>false
|
133
|
+
column :host_node_id, "int(11)"
|
134
|
+
column :image_id, "int(11)", :null=>false
|
135
|
+
column :instance_spec_id, "int(11)", :null=>false
|
136
|
+
column :state, "varchar(255)", :default=>"init", :null=>false
|
137
|
+
column :status, "varchar(255)", :default=>"init", :null=>false
|
138
|
+
column :hostname, "varchar(32)", :null=>false
|
139
|
+
column :ssh_key_pair_id, "varchar(255)"
|
140
|
+
column :ha_enabled, "int(11)", :default=>0, :null=>false
|
141
|
+
column :quota_weight, "double", :default=>0.0, :null=>false
|
142
|
+
column :cpu_cores, "int(11)", :null=>false
|
143
|
+
column :memory_size, "int(11)", :null=>false
|
144
|
+
column :user_data, "text", :null=>false
|
145
|
+
column :runtime_config, "text", :null=>false
|
146
|
+
column :ssh_key_data, "text"
|
147
|
+
column :request_params, "text", :null=>false
|
148
|
+
column :terminated_at, "datetime"
|
149
|
+
column :created_at, "datetime", :null=>false
|
150
|
+
column :updated_at, "datetime", :null=>false
|
151
|
+
|
152
|
+
index [:account_id]
|
153
|
+
index [:host_node_id]
|
154
|
+
index [:state]
|
155
|
+
index [:terminated_at]
|
156
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
157
|
+
end
|
158
|
+
|
159
|
+
create_table(:ip_leases) do
|
160
|
+
primary_key :id, :type=>"int(11)"
|
161
|
+
column :instance_nic_id, "int(11)"
|
162
|
+
column :network_id, "int(11)", :null=>false
|
163
|
+
column :ipv4, "varchar(50)"
|
164
|
+
column :alloc_type, "int(11)", :default=>0, :null=>false
|
165
|
+
column :description, "text"
|
166
|
+
column :created_at, "datetime", :null=>false
|
167
|
+
column :updated_at, "datetime", :null=>false
|
168
|
+
|
169
|
+
index [:instance_nic_id, :network_id]
|
170
|
+
index [:network_id, :ipv4], :unique=>true
|
171
|
+
end
|
172
|
+
|
173
|
+
create_table(:job_states) do
|
174
|
+
primary_key :id, :type=>"int(11)"
|
175
|
+
column :job_id, "varchar(80)", :null=>false
|
176
|
+
column :parent_job_id, "varchar(80)"
|
177
|
+
column :node_id, "varchar(255)", :null=>false
|
178
|
+
column :state, "varchar(255)", :null=>false
|
179
|
+
column :message, "text", :null=>false
|
180
|
+
column :created_at, "datetime", :null=>false
|
181
|
+
column :updated_at, "datetime", :null=>false
|
182
|
+
column :started_at, "datetime"
|
183
|
+
column :finished_at, "datetime"
|
184
|
+
|
185
|
+
index [:job_id], :unique=>true
|
186
|
+
end
|
187
|
+
|
188
|
+
create_table(:mac_leases) do
|
189
|
+
primary_key :id, :type=>"int(11)"
|
190
|
+
column :mac_addr, "char(12)", :null=>false
|
191
|
+
column :created_at, "datetime", :null=>false
|
192
|
+
column :updated_at, "datetime", :null=>false
|
193
|
+
|
194
|
+
index [:mac_addr], :unique=>true
|
195
|
+
end
|
196
|
+
|
197
|
+
create_table(:security_groups) do
|
198
|
+
primary_key :id, :type=>"int(11)"
|
199
|
+
column :account_id, "varchar(255)", :null=>false
|
200
|
+
column :uuid, "varchar(255)", :null=>false
|
201
|
+
column :created_at, "datetime", :null=>false
|
202
|
+
column :updated_at, "datetime", :null=>false
|
203
|
+
column :description, "varchar(255)"
|
204
|
+
column :rule, "text"
|
205
|
+
|
206
|
+
index [:account_id]
|
207
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
208
|
+
end
|
209
|
+
|
210
|
+
create_table(:security_group_rules) do
|
211
|
+
primary_key :id, :type=>"int(11)"
|
212
|
+
column :created_at, "datetime", :null=>false
|
213
|
+
column :updated_at, "datetime", :null=>false
|
214
|
+
column :security_group_id, "int(11)", :null=>false
|
215
|
+
column :permission, "varchar(255)", :null=>false
|
216
|
+
|
217
|
+
index [:security_group_id]
|
218
|
+
end
|
219
|
+
|
220
|
+
create_table(:networks) do
|
221
|
+
primary_key :id, :type=>"int(11)"
|
222
|
+
column :account_id, "varchar(255)", :null=>false
|
223
|
+
column :uuid, "varchar(255)", :null=>false
|
224
|
+
column :ipv4_network, "varchar(255)", :null=>false
|
225
|
+
column :ipv4_gw, "varchar(255)"
|
226
|
+
column :prefix, "int(11)", :default=>24, :null=>false
|
227
|
+
column :metric, "int(11)", :default=>100, :null=>false
|
228
|
+
column :domain_name, "varchar(255)"
|
229
|
+
column :dns_server, "varchar(255)"
|
230
|
+
column :dhcp_server, "varchar(255)"
|
231
|
+
column :metadata_server, "varchar(255)"
|
232
|
+
column :metadata_server_port, "int(11)"
|
233
|
+
column :bandwidth, "int(11)"
|
234
|
+
column :vlan_lease_id, "int(11)", :default=>0, :null=>false
|
235
|
+
column :nat_network_id, "int(11)"
|
236
|
+
column :physical_network_id, "int(11)"
|
237
|
+
column :link_interface, "varchar(255)", :null=>false
|
238
|
+
column :description, "text"
|
239
|
+
column :created_at, "datetime", :null=>false
|
240
|
+
column :updated_at, "datetime", :null=>false
|
241
|
+
|
242
|
+
index [:account_id]
|
243
|
+
index [:nat_network_id]
|
244
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
245
|
+
end
|
246
|
+
|
247
|
+
create_table(:dhcp_ranges) do
|
248
|
+
primary_key :id, :type=>"int(11)"
|
249
|
+
column :network_id, "int(11)", :null=>false
|
250
|
+
column :range_begin, "varchar(255)", :null=>false
|
251
|
+
column :range_end, "varchar(255)", :null=>false
|
252
|
+
column :created_at, "datetime", :null=>false
|
253
|
+
column :updated_at, "datetime", :null=>false
|
254
|
+
index [:network_id]
|
255
|
+
end
|
256
|
+
|
257
|
+
create_table(:physical_networks) do
|
258
|
+
primary_key :id, :type=>"int(11)"
|
259
|
+
column :name, "varchar(255)", :null=>false
|
260
|
+
column :interface, "varchar(255)"
|
261
|
+
column :description, "text"
|
262
|
+
column :created_at, "datetime", :null=>false
|
263
|
+
column :updated_at, "datetime", :null=>false
|
264
|
+
index [:name], :unique=>true
|
265
|
+
end
|
266
|
+
|
267
|
+
create_table(:node_states) do
|
268
|
+
primary_key :id, :type=>"int(11)"
|
269
|
+
column :node_id, "varchar(80)", :null=>false
|
270
|
+
column :boot_token, "varchar(10)", :null=>false
|
271
|
+
column :state, "varchar(10)"
|
272
|
+
column :created_at, "datetime", :null=>false
|
273
|
+
column :updated_at, "datetime", :null=>false
|
274
|
+
column :last_ping_at, "datetime", :null=>false
|
275
|
+
|
276
|
+
index [:node_id], :unique=>true
|
277
|
+
end
|
278
|
+
|
279
|
+
create_table(:quotas) do
|
280
|
+
primary_key :id, :type=>"int(11)"
|
281
|
+
column :account_id, "int(11)", :null=>false
|
282
|
+
column :instance_total_weight, "double"
|
283
|
+
column :volume_total_size, "int(11)"
|
284
|
+
column :created_at, "datetime", :null=>false
|
285
|
+
column :updated_at, "datetime", :null=>false
|
286
|
+
|
287
|
+
index [:account_id], :unique=>true
|
288
|
+
end
|
289
|
+
|
290
|
+
create_table(:request_logs) do
|
291
|
+
primary_key :id, :type=>"int(11)"
|
292
|
+
column :request_id, "varchar(40)", :null=>false
|
293
|
+
column :frontend_system_id, "varchar(40)", :null=>false
|
294
|
+
column :account_id, "varchar(40)", :null=>false
|
295
|
+
column :requester_token, "varchar(255)"
|
296
|
+
column :request_method, "varchar(10)", :null=>false
|
297
|
+
column :api_path, "varchar(255)", :null=>false
|
298
|
+
column :params, "text", :null=>false
|
299
|
+
column :response_status, "int(11)", :null=>false
|
300
|
+
column :response_msg, "text"
|
301
|
+
column :requested_at, "datetime", :null=>false
|
302
|
+
column :requested_at_usec, "int(11)", :null=>false
|
303
|
+
column :responded_at, "datetime", :null=>false
|
304
|
+
column :responded_at_usec, "int(11)", :null=>false
|
305
|
+
|
306
|
+
index [:request_id], :unique=>true, :name=>:request_id
|
307
|
+
end
|
308
|
+
|
309
|
+
create_table(:ssh_key_pairs) do
|
310
|
+
primary_key :id, :type=>"int(11)"
|
311
|
+
column :account_id, "varchar(255)", :null=>false
|
312
|
+
column :uuid, "char(8)", :null=>false
|
313
|
+
column :finger_print, "varchar(100)", :null=>false
|
314
|
+
column :public_key, "text", :null=>false
|
315
|
+
column :private_key, "text"
|
316
|
+
column :description, "text"
|
317
|
+
column :created_at, "datetime", :null=>false
|
318
|
+
column :updated_at, "datetime", :null=>false
|
319
|
+
|
320
|
+
index [:account_id]
|
321
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
322
|
+
end
|
323
|
+
|
324
|
+
create_table(:storage_nodes) do
|
325
|
+
primary_key :id, :type=>"int(11)"
|
326
|
+
column :account_id, "varchar(255)", :null=>false
|
327
|
+
column :uuid, "varchar(255)", :null=>false
|
328
|
+
column :node_id, "varchar(255)", :null=>false
|
329
|
+
column :export_path, "varchar(255)", :null=>false
|
330
|
+
column :offering_disk_space, "int(11)", :null=>false
|
331
|
+
column :transport_type, "varchar(255)", :null=>false
|
332
|
+
column :storage_type, "varchar(255)", :null=>false
|
333
|
+
column :ipaddr, "varchar(255)", :null=>false
|
334
|
+
column :snapshot_base_path, "varchar(255)", :null=>false
|
335
|
+
column :created_at, "datetime", :null=>false
|
336
|
+
column :updated_at, "datetime", :null=>false
|
337
|
+
|
338
|
+
index [:account_id]
|
339
|
+
index [:node_id]
|
340
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
341
|
+
end
|
342
|
+
|
343
|
+
create_table(:tag_mappings) do
|
344
|
+
primary_key :id, :type=>"int(11)"
|
345
|
+
column :tag_id, "int(11)", :null=>false
|
346
|
+
column :uuid, "varchar(255)", :null=>false
|
347
|
+
|
348
|
+
index [:tag_id]
|
349
|
+
index [:uuid]
|
350
|
+
end
|
351
|
+
|
352
|
+
create_table(:tags) do
|
353
|
+
primary_key :id, :type=>"int(11)"
|
354
|
+
column :account_id, "varchar(255)", :null=>false
|
355
|
+
column :uuid, "varchar(255)", :null=>false
|
356
|
+
column :type_id, "int(11)", :null=>false
|
357
|
+
column :name, "varchar(255)", :null=>false
|
358
|
+
column :attributes, "varchar(255)"
|
359
|
+
column :created_at, "datetime", :null=>false
|
360
|
+
column :updated_at, "datetime", :null=>false
|
361
|
+
|
362
|
+
index [:account_id]
|
363
|
+
index [:account_id, :type_id, :name], :unique=>true
|
364
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
365
|
+
end
|
366
|
+
|
367
|
+
create_table(:vlan_leases) do
|
368
|
+
primary_key :id, :type=>"int(11)"
|
369
|
+
column :account_id, "varchar(255)", :null=>false
|
370
|
+
column :uuid, "varchar(255)", :null=>false
|
371
|
+
column :tag_id, "int(11)", :null=>false
|
372
|
+
column :created_at, "datetime", :null=>false
|
373
|
+
column :updated_at, "datetime", :null=>false
|
374
|
+
|
375
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
376
|
+
index [:account_id]
|
377
|
+
index [:tag_id], :unique=>true
|
378
|
+
end
|
379
|
+
|
380
|
+
create_table(:volume_snapshots) do
|
381
|
+
primary_key :id, :type=>"int(11)"
|
382
|
+
column :account_id, "varchar(255)", :null=>false
|
383
|
+
column :uuid, "varchar(255)", :null=>false
|
384
|
+
column :storage_node_id, "int(11)", :null=>false
|
385
|
+
column :origin_volume_id, "varchar(255)", :null=>false
|
386
|
+
column :size, "int(11)", :null=>false
|
387
|
+
column :status, "int(11)", :default=>0, :null=>false
|
388
|
+
column :state, "varchar(255)", :default=>"initialized", :null=>false
|
389
|
+
column :destination_key, "varchar(255)", :null=>false
|
390
|
+
column :deleted_at, "datetime"
|
391
|
+
column :created_at, "datetime", :null=>false
|
392
|
+
column :updated_at, "datetime", :null=>false
|
393
|
+
|
394
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
395
|
+
index [:account_id]
|
396
|
+
index [:deleted_at]
|
397
|
+
index [:storage_node_id]
|
398
|
+
end
|
399
|
+
|
400
|
+
create_table(:volumes) do
|
401
|
+
primary_key :id, :type=>"int(11)"
|
402
|
+
column :account_id, "varchar(255)", :null=>false
|
403
|
+
column :uuid, "varchar(255)", :null=>false
|
404
|
+
column :storage_node_id, "int(11)"
|
405
|
+
column :status, "varchar(255)", :default=>"initialized", :null=>false
|
406
|
+
column :state, "varchar(255)", :default=>"initialized", :null=>false
|
407
|
+
column :size, "int(11)", :null=>false
|
408
|
+
column :instance_id, "int(11)"
|
409
|
+
column :boot_dev, "int(11)", :default=>0, :null=>false
|
410
|
+
column :snapshot_id, "varchar(255)"
|
411
|
+
column :host_device_name, "varchar(255)"
|
412
|
+
column :guest_device_name, "varchar(255)"
|
413
|
+
column :export_path, "varchar(255)", :null=>false
|
414
|
+
column :transport_information, "text"
|
415
|
+
column :request_params, "text", :null=>false
|
416
|
+
column :deleted_at, "datetime"
|
417
|
+
column :attached_at, "datetime"
|
418
|
+
column :detached_at, "datetime"
|
419
|
+
column :created_at, "datetime", :null=>false
|
420
|
+
column :updated_at, "datetime", :null=>false
|
421
|
+
|
422
|
+
index [:uuid], :unique=>true, :name=>:uuid
|
423
|
+
index [:account_id]
|
424
|
+
index [:deleted_at]
|
425
|
+
index [:instance_id]
|
426
|
+
index [:snapshot_id]
|
427
|
+
index [:storage_node_id]
|
428
|
+
end
|
429
|
+
|
430
|
+
self[:accounts].insert(:id=>100, :uuid=>'00000000', :description=>'datacenter system account', :updated_at=>Time.now, :created_at=>Time.now)
|
431
|
+
self[:accounts].insert(:id=>101, :uuid=>'shpoolxx', :description=>'system account for shared resources', :updated_at=>Time.now, :created_at=>Time.now)
|
432
|
+
self[:quotas].insert(:id=>1, :account_id=>100,
|
433
|
+
:instance_total_weight=>Dcmgr.conf.account_instance_total_weight, :volume_total_size=>Dcmgr.conf.account_volume_total_size,
|
434
|
+
:updated_at=>Time.now, :created_at=>Time.now)
|
435
|
+
self[:quotas].insert(:id=>2, :account_id=>101,
|
436
|
+
:instance_total_weight=>Dcmgr.conf.account_instance_total_weight, :volume_total_size=>Dcmgr.conf.account_volume_total_size,
|
437
|
+
:updated_at=>Time.now, :created_at=>Time.now)
|
438
|
+
self[:tags].insert(:id=>1, :uuid=>'shhost', :account_id=>'a-shpoolxx', :type_id=>11, :name=>"default_shared_hosts", :updated_at=>Time.now, :created_at=>Time.now)
|
439
|
+
self[:tags].insert(:id=>2, :uuid=>'shnet', :account_id=>'a-shpoolxx', :type_id=>10,:name=>"default_shared_networks", :updated_at=>Time.now, :created_at=>Time.now)
|
440
|
+
self[:tags].insert(:id=>3, :uuid=>'shstor', :account_id=>'a-shpoolxx', :type_id=>12, :name=>"default_shared_storage", :updated_at=>Time.now, :created_at=>Time.now)
|
441
|
+
end
|
442
|
+
|
443
|
+
down do
|
444
|
+
drop_table(:accounts, :frontend_systems, :histories, :host_nodes, :hostname_leases, :images, :instance_security_groups, :instance_nics, :instance_specs, :instances, :ip_leases, :job_states, :mac_leases, :security_groups, :security_group_rules, :networks, :node_states, :quotas, :request_logs, :ssh_key_pairs, :storage_nodes, :tag_mappings, :tags, :vlan_leases, :volume_snapshots, :volumes, :dhcp_ranges, :physical_networks)
|
445
|
+
end
|
446
|
+
end
|