tengine_resource 0.5.15 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -27
- data/Gemfile.lock +60 -73
- data/README.rdoc +2 -2
- data/bin/create_indexes_for_tengine_resource +18 -0
- data/lib/tengine/resource/config/resource.rb +0 -3
- data/lib/tengine/resource/credential.rb +16 -17
- data/lib/tengine/resource/net_ssh.rb +22 -10
- data/lib/tengine/resource/physical_server.rb +8 -0
- data/lib/tengine/resource/provider.rb +206 -35
- data/lib/tengine/resource/server.rb +3 -3
- data/lib/tengine/resource/virtual_server.rb +1 -1
- data/lib/tengine/resource/virtual_server_image.rb +8 -8
- data/lib/tengine/resource/virtual_server_type.rb +2 -2
- data/lib/tengine/resource/watcher.rb +39 -9
- data/tmp/.gitkeep +0 -0
- metadata +92 -141
- data/.document +0 -5
- data/.rspec +0 -1
- data/Rakefile +0 -42
- data/VERSION +0 -1
- data/config/.gitignore +0 -2
- data/lib/tengine/resource/credential/ec2.rb +0 -5
- data/lib/tengine/resource/credential/ec2/dummy.rb +0 -148
- data/lib/tengine/resource/credential/ec2/launch_options.rb +0 -179
- data/lib/tengine/resource/provider/ec2.rb +0 -187
- data/lib/tengine/resource/provider/wakame.rb +0 -638
- data/spec/fixtures/goku_at_ec2_ap_northeast.rb +0 -177
- data/spec/mongoid.yml +0 -35
- data/spec/mongoid_en.yml +0 -48
- data/spec/spec_helper.rb +0 -43
- data/spec/support/ec2.rb +0 -129
- data/spec/support/mongo_index_key_log.rb +0 -91
- data/spec/tengine/resource/bugfix/watcher_for_wakame_spec.rb +0 -232
- data/spec/tengine/resource/credential_spec.rb +0 -205
- data/spec/tengine/resource/drivers/resource_control_driver_spec.rb +0 -84
- data/spec/tengine/resource/net_ssh_spec.rb +0 -148
- data/spec/tengine/resource/physical_server_spec.rb +0 -47
- data/spec/tengine/resource/provider/ec2_spec.rb +0 -473
- data/spec/tengine/resource/provider/test_files/describe_host_nodes.json +0 -22
- data/spec/tengine/resource/provider/test_files/describe_images.json +0 -23
- data/spec/tengine/resource/provider/test_files/describe_instance_specs.json +0 -23
- data/spec/tengine/resource/provider/test_files/describe_instances.json +0 -56
- data/spec/tengine/resource/provider/test_files/run_instances.json +0 -30
- data/spec/tengine/resource/provider/test_files/terminate_instances.json +0 -3
- data/spec/tengine/resource/provider/wakame/00_describe_host_nodes_0_physical_servers.json +0 -8
- data/spec/tengine/resource/provider/wakame/01_describe_host_nodes_10_physical_servers.json +0 -139
- data/spec/tengine/resource/provider/wakame/02_describe_host_nodes_60_physical_servers.json +0 -795
- data/spec/tengine/resource/provider/wakame/10_describe_instances_0_virtual_servers.json +0 -8
- data/spec/tengine/resource/provider/wakame/11_describe_instances_10_virtual_servers.json +0 -469
- data/spec/tengine/resource/provider/wakame/12_describe_instances_after_run_instances.json +0 -280
- data/spec/tengine/resource/provider/wakame/13_describe_instances_after_terminate_instances.json +0 -279
- data/spec/tengine/resource/provider/wakame/20_describe_images_0_virtual_server_images.json +0 -8
- data/spec/tengine/resource/provider/wakame/21_describe_images_5_virtual_server_images.json +0 -84
- data/spec/tengine/resource/provider/wakame/22_describe_images_60_virtual_server_images.json +0 -856
- data/spec/tengine/resource/provider/wakame/30_describe_instance_specs_0_virtual_server_specs.json +0 -8
- data/spec/tengine/resource/provider/wakame/31_describe_instance_specs_4_virtual_server_specs.json +0 -66
- data/spec/tengine/resource/provider/wakame/40_run_instances_0_virtual_servers.json +0 -1
- data/spec/tengine/resource/provider/wakame/41_run_instances_1_virtual_servers.json +0 -22
- data/spec/tengine/resource/provider/wakame/42_run_instances_5_virtual_servers.json +0 -106
- data/spec/tengine/resource/provider/wakame/50_terminate_instances_0_virtual_servers.json +0 -1
- data/spec/tengine/resource/provider/wakame/51_terminate_instances_3_virtual_servers.json +0 -5
- data/spec/tengine/resource/provider/wakame/sync_physical_servers_spec.rb +0 -114
- data/spec/tengine/resource/provider/wakame/sync_virtual_server_images_spec.rb +0 -116
- data/spec/tengine/resource/provider/wakame/sync_virtual_server_types_spec.rb +0 -116
- data/spec/tengine/resource/provider/wakame/sync_virtual_servers_spec.rb +0 -216
- data/spec/tengine/resource/provider/wakame_api_spec.rb +0 -319
- data/spec/tengine/resource/provider/wakame_spec.rb +0 -339
- data/spec/tengine/resource/provider_spec.rb +0 -252
- data/spec/tengine/resource/server_spec.rb +0 -195
- data/spec/tengine/resource/test_files/.gitignore +0 -6
- data/spec/tengine/resource/test_files/00_describe_host_nodes_0_physical_servers.json +0 -8
- data/spec/tengine/resource/test_files/01_describe_host_nodes_10_physical_servers.json +0 -139
- data/spec/tengine/resource/test_files/02_describe_host_nodes_60_physical_servers.json +0 -795
- data/spec/tengine/resource/test_files/10_describe_instances_0_virtual_servers.json +0 -8
- data/spec/tengine/resource/test_files/11_describe_instances_10_virtual_servers.json +0 -469
- data/spec/tengine/resource/test_files/12_describe_instances_after_run_instances.json +0 -280
- data/spec/tengine/resource/test_files/13_describe_instances_after_terminate_instances.json +0 -279
- data/spec/tengine/resource/test_files/14_describe_instances_after_run_1_instance.json +0 -55
- data/spec/tengine/resource/test_files/20_describe_images_0_virtual_server_images.json +0 -8
- data/spec/tengine/resource/test_files/21_describe_images_5_virtual_server_images.json +0 -84
- data/spec/tengine/resource/test_files/22_describe_images_60_virtual_server_images.json +0 -856
- data/spec/tengine/resource/test_files/30_describe_instance_specs_0_virtual_server_specs.json +0 -8
- data/spec/tengine/resource/test_files/31_describe_instance_specs_4_virtual_server_specs.json +0 -66
- data/spec/tengine/resource/test_files/40_run_instances_0_virtual_servers.json +0 -1
- data/spec/tengine/resource/test_files/41_run_instances_1_virtual_servers.json +0 -22
- data/spec/tengine/resource/test_files/42_run_instances_5_virtual_servers.json +0 -106
- data/spec/tengine/resource/test_files/43_run_instances_1_virtual_servers_without_aws_availability_zone.json +0 -22
- data/spec/tengine/resource/test_files/50_terminate_instances_0_virtual_servers.json +0 -1
- data/spec/tengine/resource/test_files/51_terminate_instances_3_virtual_servers.json +0 -5
- data/spec/tengine/resource/virtual_server_image_spec.rb +0 -94
- data/spec/tengine/resource/virtual_server_spec.rb +0 -116
- data/spec/tengine/resource/virtual_server_type_spec.rb +0 -4
- data/spec/tengine/resource/watcher_spec.rb +0 -1027
- data/spec/tengine_resource_spec.rb +0 -5
- data/tengine_resource.gemspec +0 -172
- data/tmp/log/.gitignore +0 -1
@@ -1,1027 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'eventmachine'
|
4
|
-
require 'amqp'
|
5
|
-
require 'tengine/mq/suite'
|
6
|
-
require 'apis/wakame'
|
7
|
-
require 'controllers/controller'
|
8
|
-
|
9
|
-
describe Tengine::Resource::Watcher do
|
10
|
-
|
11
|
-
before do
|
12
|
-
@mq_config = {
|
13
|
-
:connection => {
|
14
|
-
:host => "localhost", :port => 5672, :vhost => "/",
|
15
|
-
:user => "guest", :pass => "guest", :logging => false,
|
16
|
-
:heartbeat_interval => 0,
|
17
|
-
:insist => false, :auto_reconnect_delay => 1
|
18
|
-
},
|
19
|
-
:exchange => {
|
20
|
-
:name => "tengine_event_exchange", :type => "direct", :durable => true
|
21
|
-
},
|
22
|
-
:queue => {
|
23
|
-
:name => "tengine_event_queue", :durable => true
|
24
|
-
},
|
25
|
-
:sender => {
|
26
|
-
:keep_connection => true
|
27
|
-
},
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
after :all do
|
32
|
-
Mongoid.instance_eval do
|
33
|
-
observers.each do |i|
|
34
|
-
i.instance.send(:observed_classes).each do |j|
|
35
|
-
Mongoid::Callbacks::CALLBACKS.each do |k|
|
36
|
-
x, y = k.to_s.split '_', 2
|
37
|
-
j.send :reset_callbacks, y#, x
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe :initialize do
|
45
|
-
it "default" do
|
46
|
-
Tengine::Core::MethodTraceable.stub(:disabled=)
|
47
|
-
watcher = Tengine::Resource::Watcher.new(%w[--log-common-level warn])
|
48
|
-
watcher.config[:process]['daemon'].should == false
|
49
|
-
watcher.config[:process][:daemon].should == false
|
50
|
-
watcher.config[:event_queue][:connection][:host].should == "localhost"
|
51
|
-
watcher.config['event_queue']['connection']['host'].should == "localhost"
|
52
|
-
watcher.config[:event_queue][:queue][:name].should == "tengine_event_queue"
|
53
|
-
watcher.config['event_queue']['queue']['name'].should == "tengine_event_queue"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe :sender do
|
58
|
-
before do
|
59
|
-
@watcher = Tengine::Resource::Watcher.new(%w[--log-common-level warn])
|
60
|
-
EM.should_receive(:run).and_yield
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
it "生成したmq_suiteが設定されている" do
|
65
|
-
mock_mq = Tengine::Mq::Suite.new(@mq_config)
|
66
|
-
Tengine::Mq::Suite.should_receive(:new).
|
67
|
-
with(@mq_config).and_return(mock_mq)
|
68
|
-
|
69
|
-
@watcher.sender.should_receive(:wait_for_connection)
|
70
|
-
@watcher.start
|
71
|
-
@watcher.mq_suite.should == mock_mq
|
72
|
-
end
|
73
|
-
|
74
|
-
it "生成したsenderが設定されている" do
|
75
|
-
mock_mq = Tengine::Mq::Suite.new(@mq_config)
|
76
|
-
Tengine::Mq::Suite.should_receive(:new).
|
77
|
-
with(@mq_config).and_return(mock_mq)
|
78
|
-
|
79
|
-
mock_sender = mock(:sender)
|
80
|
-
Tengine::Event::Sender.should_receive(:new).with(mock_mq).and_return(mock_sender)
|
81
|
-
|
82
|
-
@watcher.sender.should_receive(:wait_for_connection)
|
83
|
-
@watcher.start
|
84
|
-
@watcher.sender.should == mock_sender
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe :start do
|
89
|
-
before do
|
90
|
-
@watcher = Tengine::Resource::Watcher.new(%w[--log-common-level warn])
|
91
|
-
EM.should_receive(:run).and_yield
|
92
|
-
EM.stub(:schedule).and_yield
|
93
|
-
|
94
|
-
# コネクションの mock を生成
|
95
|
-
@mock_mq = Tengine::Mq::Suite.new(@mq_config)
|
96
|
-
Tengine::Mq::Suite.should_receive(:new).
|
97
|
-
with(@mq_config).and_return(@mock_mq)
|
98
|
-
|
99
|
-
Tengine::Resource::Provider.delete_all
|
100
|
-
@provider_ec2 = Tengine::Resource::Provider::Ec2.create!({
|
101
|
-
:name => "amazon-ec2",
|
102
|
-
:description => "",
|
103
|
-
:properties => {
|
104
|
-
},
|
105
|
-
:polling_interval => 5,
|
106
|
-
:connection_settings => {
|
107
|
-
:access_key => "",
|
108
|
-
:secret_access_key => "",
|
109
|
-
:options => {
|
110
|
-
:server => "ec2.amazonaws.com",
|
111
|
-
:port => 443,
|
112
|
-
:protocol => "https",
|
113
|
-
:multi_thread => false,
|
114
|
-
:logger => nil,
|
115
|
-
:signature_version => '1',
|
116
|
-
:cache => false,
|
117
|
-
}
|
118
|
-
}
|
119
|
-
})
|
120
|
-
@provider_wakame = Tengine::Resource::Provider::Wakame.create!({
|
121
|
-
:name => "wakame-vdc",
|
122
|
-
:description => "",
|
123
|
-
:properties => {
|
124
|
-
:key_name => "ssh-xxxxx"
|
125
|
-
},
|
126
|
-
:polling_interval => 5,
|
127
|
-
:connection_settings => {
|
128
|
-
:account => "tama_account1",
|
129
|
-
:ec2_host => "10.10.10.10",
|
130
|
-
:ec2_port => 80,
|
131
|
-
:ec2_protocol => "https",
|
132
|
-
:wakame_host => "192.168.0.10",
|
133
|
-
:wakame_port => 8080,
|
134
|
-
:wakame_protocol => "http",
|
135
|
-
},
|
136
|
-
})
|
137
|
-
end
|
138
|
-
|
139
|
-
it "flow" do
|
140
|
-
@watcher.sender.should_receive(:wait_for_connection).and_yield
|
141
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_wakame, @provider_ec2])
|
142
|
-
|
143
|
-
@provider_wakame.should_receive(:virtual_server_type_watch)
|
144
|
-
EM.should_receive(:add_periodic_timer).with(@provider_wakame.polling_interval).and_yield
|
145
|
-
# EM.should_receive(:defer).twice.and_yield
|
146
|
-
@provider_wakame.should_receive(:physical_server_watch)
|
147
|
-
@provider_wakame.should_receive(:virtual_server_watch)
|
148
|
-
@provider_wakame.should_receive(:virtual_server_image_watch)
|
149
|
-
|
150
|
-
@provider_ec2.should_receive(:virtual_server_type_watch)
|
151
|
-
EM.should_receive(:add_periodic_timer).with(@provider_ec2.polling_interval).and_yield
|
152
|
-
@provider_ec2.should_receive(:physical_server_watch)
|
153
|
-
@provider_ec2.should_receive(:virtual_server_watch)
|
154
|
-
@provider_ec2.should_receive(:virtual_server_image_watch)
|
155
|
-
|
156
|
-
@watcher.start
|
157
|
-
end
|
158
|
-
|
159
|
-
# 仮想サーバタイプ
|
160
|
-
describe :virtual_server_type_watch do
|
161
|
-
before do
|
162
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
163
|
-
"Tengine::Resource::VirtualServerType.created.tengine_resource_watchd",
|
164
|
-
anything())
|
165
|
-
|
166
|
-
Tengine::Resource::VirtualServerType.delete_all
|
167
|
-
@virtual_server_type_wakame = @provider_wakame.virtual_server_types.create!({
|
168
|
-
:provided_id => "is-demospec",
|
169
|
-
:caption => "is-demospec",
|
170
|
-
:cpu_cores => 2,
|
171
|
-
:memory_size => 512,
|
172
|
-
:properties => {
|
173
|
-
:arch => "x86_64",
|
174
|
-
:hypervisor => "kvm",
|
175
|
-
:account_id => "a-shpoolxx",
|
176
|
-
:vifs => "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
|
177
|
-
:quota_weight => "1.0",
|
178
|
-
:drives => "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n",
|
179
|
-
:created_at => "2011-10-28T02:58:57Z",
|
180
|
-
:updated_at => "2011-10-28T02:58:57Z",
|
181
|
-
}
|
182
|
-
})
|
183
|
-
|
184
|
-
@watcher.sender.should_receive(:wait_for_connection).and_yield
|
185
|
-
end
|
186
|
-
|
187
|
-
context "wakame" do
|
188
|
-
before do
|
189
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_wakame])
|
190
|
-
EM.should_receive(:add_periodic_timer).with(@provider_wakame.polling_interval)
|
191
|
-
|
192
|
-
@tama_controller_factory = mock(::Tama::Controllers::ControllerFactory.allocate)
|
193
|
-
::Tama::Controllers::ControllerFactory.
|
194
|
-
should_receive(:create_controller).
|
195
|
-
with("tama_account1", "10.10.10.10", 80, "https", "192.168.0.10", 8080, "http").
|
196
|
-
and_return(@tama_controller_factory)
|
197
|
-
end
|
198
|
-
|
199
|
-
it "更新対象があったら更新完了後イベントを発火する" do
|
200
|
-
@tama_controller_factory.
|
201
|
-
should_receive(:describe_instance_specs).with([]).
|
202
|
-
and_return(UPDATE_WAKAME_INSTANCE_SPECS)
|
203
|
-
|
204
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
205
|
-
"Tengine::Resource::VirtualServerType.updated.tengine_resource_watchd",
|
206
|
-
anything())
|
207
|
-
|
208
|
-
@virtual_server_type_wakame.cpu_cores.should == 2
|
209
|
-
@virtual_server_type_wakame.memory_size.should == 512
|
210
|
-
|
211
|
-
@watcher.start
|
212
|
-
|
213
|
-
@provider_wakame.reload
|
214
|
-
new_server_type = @provider_wakame.virtual_server_types.first
|
215
|
-
new_server_type.cpu_cores.should == 1
|
216
|
-
new_server_type.memory_size.should == 256
|
217
|
-
end
|
218
|
-
|
219
|
-
it "更新対象がなかったらイベントは発火しない" do
|
220
|
-
@tama_controller_factory.
|
221
|
-
should_receive(:describe_instance_specs).with([]).
|
222
|
-
and_return(ORIGINAL_WAKAME_INSTANCE_SPECS)
|
223
|
-
|
224
|
-
Tengine::Event.default_sender.should_not_receive(:fire)
|
225
|
-
|
226
|
-
@virtual_server_type_wakame.cpu_cores.should == 2
|
227
|
-
@virtual_server_type_wakame.memory_size.should == 512
|
228
|
-
|
229
|
-
@watcher.start
|
230
|
-
|
231
|
-
@provider_wakame.reload
|
232
|
-
new_server_type = @provider_wakame.virtual_server_types.first
|
233
|
-
new_server_type.cpu_cores.should == 2
|
234
|
-
new_server_type.memory_size.should == 512
|
235
|
-
end
|
236
|
-
|
237
|
-
it "登録対象があったら登録完了後イベントを発火する" do
|
238
|
-
@tama_controller_factory.
|
239
|
-
should_receive(:describe_instance_specs).with([]).
|
240
|
-
and_return(CREATE_WAKAME_INSTANCE_SPECS)
|
241
|
-
|
242
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
243
|
-
"Tengine::Resource::VirtualServerType.created.tengine_resource_watchd",
|
244
|
-
anything())
|
245
|
-
|
246
|
-
expect { @watcher.start }.should change(
|
247
|
-
@provider_wakame.virtual_server_types, :count).by(1)
|
248
|
-
end
|
249
|
-
|
250
|
-
it "削除対象があったら削除完了後イベントを発火する" do
|
251
|
-
@tama_controller_factory.
|
252
|
-
should_receive(:describe_instance_specs).with([]).
|
253
|
-
and_return([])
|
254
|
-
|
255
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
256
|
-
"Tengine::Resource::VirtualServerType.destroyed.tengine_resource_watchd",
|
257
|
-
anything())
|
258
|
-
|
259
|
-
expect { @watcher.start }.should change(
|
260
|
-
@provider_wakame.virtual_server_types, :size).by(-1)
|
261
|
-
end
|
262
|
-
end # end to wakame
|
263
|
-
|
264
|
-
context "ec2" do
|
265
|
-
before do
|
266
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_ec2])
|
267
|
-
EM.should_receive(:add_periodic_timer).with(@provider_ec2.polling_interval)
|
268
|
-
end
|
269
|
-
|
270
|
-
it "実行されない" do
|
271
|
-
@provider_ec2.should_not_receive(:describe_instance_specs_for_api)
|
272
|
-
@watcher.start
|
273
|
-
end
|
274
|
-
end # end to ec2
|
275
|
-
end # end to :virtual_server_type_watch
|
276
|
-
|
277
|
-
# 物理サーバ
|
278
|
-
describe :physical_server_watch do
|
279
|
-
before do
|
280
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
281
|
-
"Tengine::Resource::PhysicalServer.created.tengine_resource_watchd",
|
282
|
-
anything())
|
283
|
-
|
284
|
-
Tengine::Resource::PhysicalServer.delete_all
|
285
|
-
@physical_server_wakame = @provider_wakame.physical_servers.create!({
|
286
|
-
:name => "demohost",
|
287
|
-
:description => "",
|
288
|
-
:provided_id => "hp-demohost",
|
289
|
-
:status => "online",
|
290
|
-
:addresses => {},
|
291
|
-
:address_order => [],
|
292
|
-
:cpu_cores => 100,
|
293
|
-
:memory_size => 400000,
|
294
|
-
:properties => {
|
295
|
-
:uuid => "hp-demohost",
|
296
|
-
:account_id => "a-shpoolxx",
|
297
|
-
:arch => "x86_64",
|
298
|
-
:hypervisor => "kvm",
|
299
|
-
:created_at => "2011-10-18T03:53:24Z",
|
300
|
-
:updated_at => "2011-10-18T03:53:24Z",
|
301
|
-
}
|
302
|
-
})
|
303
|
-
|
304
|
-
@watcher.sender.should_receive(:wait_for_connection).and_yield
|
305
|
-
end
|
306
|
-
|
307
|
-
context "wakame" do
|
308
|
-
before do
|
309
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_wakame])
|
310
|
-
@provider_wakame.should_receive(:virtual_server_type_watch)
|
311
|
-
EM.should_receive(:add_periodic_timer).with(@provider_wakame.polling_interval).and_yield
|
312
|
-
# EM.should_receive(:defer).and_yield
|
313
|
-
@provider_wakame.should_receive(:virtual_server_watch)
|
314
|
-
@provider_wakame.should_receive(:virtual_server_image_watch)
|
315
|
-
|
316
|
-
@tama_controller_factory = mock(::Tama::Controllers::ControllerFactory.allocate)
|
317
|
-
::Tama::Controllers::ControllerFactory.
|
318
|
-
should_receive(:create_controller).
|
319
|
-
with("tama_account1", "10.10.10.10", 80, "https", "192.168.0.10", 8080, "http").
|
320
|
-
and_return(@tama_controller_factory)
|
321
|
-
end
|
322
|
-
|
323
|
-
it "更新対象があったら更新完了後イベントを発火する" do
|
324
|
-
@tama_controller_factory.
|
325
|
-
should_receive(:describe_host_nodes).and_return(UPDATE_WAKAME_HOST_NODES)
|
326
|
-
|
327
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
328
|
-
"Tengine::Resource::PhysicalServer.updated.tengine_resource_watchd",
|
329
|
-
anything())
|
330
|
-
|
331
|
-
@physical_server_wakame.cpu_cores.should == 100
|
332
|
-
@physical_server_wakame.memory_size.should == 400000
|
333
|
-
|
334
|
-
@watcher.start
|
335
|
-
|
336
|
-
@provider_wakame.reload
|
337
|
-
new_server = @provider_wakame.physical_servers.first
|
338
|
-
new_server.cpu_cores.should == 75
|
339
|
-
new_server.memory_size.should == 350000
|
340
|
-
end
|
341
|
-
|
342
|
-
it "更新対象がなかったらイベントは発火しない" do
|
343
|
-
@tama_controller_factory.
|
344
|
-
should_receive(:describe_host_nodes).and_return(ORIGINAL_WAKAME_HOST_NODES)
|
345
|
-
|
346
|
-
Tengine::Event.default_sender.should_not_receive(:fire)
|
347
|
-
|
348
|
-
@physical_server_wakame.cpu_cores.should == 100
|
349
|
-
@physical_server_wakame.memory_size.should == 400000
|
350
|
-
|
351
|
-
@watcher.start
|
352
|
-
|
353
|
-
@provider_wakame.reload
|
354
|
-
new_server = @provider_wakame.physical_servers.first
|
355
|
-
new_server.cpu_cores.should == 100
|
356
|
-
new_server.memory_size.should == 400000
|
357
|
-
end
|
358
|
-
|
359
|
-
it "登録対象があったら登録完了後イベントを発火する" do
|
360
|
-
@tama_controller_factory.
|
361
|
-
should_receive(:describe_host_nodes).and_return(CREATE_WAKAME_HOST_NODES)
|
362
|
-
|
363
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
364
|
-
"Tengine::Resource::PhysicalServer.created.tengine_resource_watchd",
|
365
|
-
anything())
|
366
|
-
|
367
|
-
expect { @watcher.start }.should change(
|
368
|
-
@provider_wakame.physical_servers, :count).by(1)
|
369
|
-
end
|
370
|
-
|
371
|
-
it "削除対象があったら削除完了後イベントを発火する" do
|
372
|
-
@tama_controller_factory.
|
373
|
-
should_receive(:describe_host_nodes).and_return([])
|
374
|
-
|
375
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
376
|
-
"Tengine::Resource::PhysicalServer.destroyed.tengine_resource_watchd",
|
377
|
-
anything())
|
378
|
-
|
379
|
-
expect { @watcher.start }.should change(
|
380
|
-
@provider_wakame.physical_servers, :size).by(-1)
|
381
|
-
end
|
382
|
-
end # end to :wakame
|
383
|
-
|
384
|
-
context "ec2" do
|
385
|
-
before do
|
386
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_ec2])
|
387
|
-
@provider_ec2.should_receive(:virtual_server_type_watch)
|
388
|
-
EM.should_receive(:add_periodic_timer).with(@provider_ec2.polling_interval).and_yield
|
389
|
-
# EM.should_receive(:defer).and_yield
|
390
|
-
# @provider_ec2.should_receive(:physical_server_watch)
|
391
|
-
# @provider_ec2.should_receive(:virtual_server_image_watch)
|
392
|
-
end
|
393
|
-
|
394
|
-
it "更新対象があったら更新完了後イベントを発火する" do
|
395
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
396
|
-
end
|
397
|
-
it "削除対象があったら削除完了後イベントを発火する" do
|
398
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
399
|
-
end
|
400
|
-
it "更新対象がなかったらイベントは発火しない" do
|
401
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
402
|
-
end
|
403
|
-
it "登録対象があったら登録完了後イベントを発火する" do
|
404
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
405
|
-
end
|
406
|
-
end # end to ec2
|
407
|
-
end # end to :phyical_server_watch
|
408
|
-
|
409
|
-
# 仮想サーバ
|
410
|
-
describe :virtual_server_watch do
|
411
|
-
before do
|
412
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
413
|
-
"Tengine::Resource::PhysicalServer.created.tengine_resource_watchd",
|
414
|
-
anything())
|
415
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
416
|
-
"Tengine::Resource::VirtualServer.created.tengine_resource_watchd",
|
417
|
-
anything())
|
418
|
-
|
419
|
-
Tengine::Resource::PhysicalServer.delete_all
|
420
|
-
@physical_server_wakame = @provider_wakame.physical_servers.create!({
|
421
|
-
:name => "demohost",
|
422
|
-
:description => "",
|
423
|
-
:provided_id => "hp-demohost",
|
424
|
-
:status => "online",
|
425
|
-
:addresses => {},
|
426
|
-
:address_order => [],
|
427
|
-
:cpu_cores => 100,
|
428
|
-
:memory_size => 400000,
|
429
|
-
:properties => {
|
430
|
-
:uuid => "hp-demohost",
|
431
|
-
:account_id => "a-shpoolxx",
|
432
|
-
:arch => "x86_64",
|
433
|
-
:hypervisor => "kvm",
|
434
|
-
:created_at => "2011-10-18T03:53:24Z",
|
435
|
-
:updated_at => "2011-10-18T03:53:24Z",
|
436
|
-
}
|
437
|
-
})
|
438
|
-
Tengine::Resource::VirtualServer.delete_all
|
439
|
-
@virtual_server_wakame = @provider_wakame.virtual_servers.create!({
|
440
|
-
:name => "vhost",
|
441
|
-
:description => "",
|
442
|
-
:provided_id => "i-jria301q",
|
443
|
-
:provided_image_id => "wmi-lucid5",
|
444
|
-
:provided_type_id => "is-demospec",
|
445
|
-
:host_server => @physical_server_wakame,
|
446
|
-
:status => "running",
|
447
|
-
:addresses => {
|
448
|
-
"private_ip_address" => "192.168.2.188",
|
449
|
-
"nw-data" => "192.168.2.188",
|
450
|
-
},
|
451
|
-
:address_order => ["private_ip_address"],
|
452
|
-
:properties => {
|
453
|
-
:aws_kernel_id => "",
|
454
|
-
:aws_launch_time => "2011-10-18T06:51:16Z",
|
455
|
-
:tags => {},
|
456
|
-
:aws_reservation_id => "",
|
457
|
-
:aws_owner => "a-shpoolxx",
|
458
|
-
:instance_lifecycle => "",
|
459
|
-
:block_device_mappings => [{
|
460
|
-
:ebs_volume_id => "",
|
461
|
-
:ebs_status => "",
|
462
|
-
:ebs_attach_time => "",
|
463
|
-
:ebs_delete_on_termination => false,
|
464
|
-
:device_name => ""
|
465
|
-
}],
|
466
|
-
:ami_launch_index => "",
|
467
|
-
:root_device_name => "",
|
468
|
-
:aws_ramdisk_id => "",
|
469
|
-
:aws_availability_zone => "hp-demohost",
|
470
|
-
:aws_groups => nil,
|
471
|
-
:spot_instance_request_id => "",
|
472
|
-
:ssh_key_name => nil,
|
473
|
-
:virtualization_type => "",
|
474
|
-
:placement_group_name => "",
|
475
|
-
:requester_id => "",
|
476
|
-
:aws_product_codes => [],
|
477
|
-
:client_token => "",
|
478
|
-
:architecture => "x86_64",
|
479
|
-
:aws_state_code => 0,
|
480
|
-
:root_device_type => "",
|
481
|
-
:monitoring_state => "",
|
482
|
-
:aws_reason => ""
|
483
|
-
}
|
484
|
-
})
|
485
|
-
|
486
|
-
@watcher.sender.should_receive(:wait_for_connection).and_yield
|
487
|
-
end
|
488
|
-
|
489
|
-
context "wakame" do
|
490
|
-
before do
|
491
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_wakame])
|
492
|
-
@provider_wakame.should_receive(:virtual_server_type_watch)
|
493
|
-
EM.should_receive(:add_periodic_timer).with(@provider_wakame.polling_interval).and_yield
|
494
|
-
# EM.should_receive(:defer).and_yield
|
495
|
-
@provider_wakame.should_receive(:physical_server_watch)
|
496
|
-
@provider_wakame.should_receive(:virtual_server_image_watch)
|
497
|
-
|
498
|
-
@tama_controller_factory = mock(::Tama::Controllers::ControllerFactory.allocate)
|
499
|
-
::Tama::Controllers::ControllerFactory.
|
500
|
-
should_receive(:create_controller).
|
501
|
-
with("tama_account1", "10.10.10.10", 80, "https", "192.168.0.10", 8080, "http").
|
502
|
-
and_return(@tama_controller_factory)
|
503
|
-
end
|
504
|
-
|
505
|
-
it "更新対象があったら更新完了後イベントを発火する" do
|
506
|
-
@tama_controller_factory.
|
507
|
-
should_receive(:describe_instances).with([]).
|
508
|
-
and_return(UPDATE_WAKAME_INSTANCES)
|
509
|
-
|
510
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
511
|
-
"Tengine::Resource::VirtualServer.updated.tengine_resource_watchd",
|
512
|
-
anything())
|
513
|
-
|
514
|
-
@virtual_server_wakame.status.should == "running"
|
515
|
-
|
516
|
-
@watcher.start
|
517
|
-
|
518
|
-
@provider_wakame.reload
|
519
|
-
new_server = @provider_wakame.virtual_servers.first
|
520
|
-
new_server.status.should == "terminated"
|
521
|
-
end
|
522
|
-
|
523
|
-
it "更新対象がなかったらイベントは発火しない" do
|
524
|
-
@tama_controller_factory.
|
525
|
-
should_receive(:describe_instances).with([]).
|
526
|
-
and_return(ORIGINAL_WAKAME_INSTANCES)
|
527
|
-
|
528
|
-
Tengine::Event.default_sender.should_not_receive(:fire)
|
529
|
-
|
530
|
-
@watcher.start
|
531
|
-
end
|
532
|
-
|
533
|
-
it "登録対象があったら登録完了後イベントを発火する" do
|
534
|
-
@tama_controller_factory.
|
535
|
-
should_receive(:describe_instances).with([]).
|
536
|
-
and_return(CREATE_WAKAME_INSTANCES)
|
537
|
-
|
538
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
539
|
-
"Tengine::Resource::VirtualServer.created.tengine_resource_watchd",
|
540
|
-
anything())
|
541
|
-
|
542
|
-
expect {
|
543
|
-
@watcher.start
|
544
|
-
new_virtual_server = (@provider_wakame.virtual_servers - [@virtual_server_wakame]).first
|
545
|
-
new_virtual_server.host_server.provided_id.should == CREATE_WAKAME_INSTANCES[0][:aws_availability_zone]
|
546
|
-
new_virtual_server.host_server.provided_id.should == "hp-demohost"
|
547
|
-
new_virtual_server.hostname_or_ipv4.should == "192.168.2.189"
|
548
|
-
new_virtual_server.host_server.should == @physical_server_wakame
|
549
|
-
}.should change(@provider_wakame.virtual_servers, :count).by(1)
|
550
|
-
end
|
551
|
-
|
552
|
-
it "削除対象があったら削除完了後イベントを発火する" do
|
553
|
-
@tama_controller_factory.
|
554
|
-
should_receive(:describe_instances).with([]).
|
555
|
-
and_return([])
|
556
|
-
|
557
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
558
|
-
"Tengine::Resource::VirtualServer.destroyed.tengine_resource_watchd",
|
559
|
-
anything())
|
560
|
-
|
561
|
-
expect { @watcher.start }.should change(
|
562
|
-
@provider_wakame.virtual_servers, :size).by(-1)
|
563
|
-
end
|
564
|
-
end # end to wakame
|
565
|
-
|
566
|
-
context "ec2" do
|
567
|
-
before do
|
568
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_ec2])
|
569
|
-
@provider_ec2.should_receive(:virtual_server_type_watch)
|
570
|
-
EM.should_receive(:add_periodic_timer).with(@provider_ec2.polling_interval).and_yield
|
571
|
-
# EM.should_receive(:defer).and_yield
|
572
|
-
# @provider_ec2.should_receive(:virtual_server_watch)
|
573
|
-
# @provider_ec2.should_receive(:virtual_server_image_watch)
|
574
|
-
end
|
575
|
-
|
576
|
-
it "更新対象があったら更新完了後イベントを発火する" do
|
577
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
578
|
-
end
|
579
|
-
it "削除対象があったら削除完了後イベントを発火する" do
|
580
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
581
|
-
end
|
582
|
-
it "更新対象がなかったらイベントは発火しない" do
|
583
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
584
|
-
end
|
585
|
-
it "登録対象があったら登録完了後イベントを発火する" do
|
586
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
587
|
-
end
|
588
|
-
end # end to ec2
|
589
|
-
end # end to :virtual_server_watch
|
590
|
-
|
591
|
-
# 仮想サーバイメージ
|
592
|
-
describe :virtual_server_image_watch do
|
593
|
-
before do
|
594
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
595
|
-
"Tengine::Resource::VirtualServerImage.created.tengine_resource_watchd",
|
596
|
-
anything())
|
597
|
-
|
598
|
-
Tengine::Resource::VirtualServerImage.delete_all
|
599
|
-
@virtual_server_image_wakame = @provider_wakame.virtual_server_images.create!({
|
600
|
-
:name => "vimage",
|
601
|
-
:description => "",
|
602
|
-
:provided_id => "wmi-lucid6",
|
603
|
-
:provided_description => "ubuntu-10.04_with-metadata_kvm_i386.raw volume",
|
604
|
-
})
|
605
|
-
@watcher.sender.should_receive(:wait_for_connection).and_yield
|
606
|
-
end
|
607
|
-
|
608
|
-
context "wakame" do
|
609
|
-
before do
|
610
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_wakame])
|
611
|
-
@provider_wakame.should_receive(:virtual_server_type_watch)
|
612
|
-
EM.should_receive(:add_periodic_timer).with(@provider_wakame.polling_interval).and_yield
|
613
|
-
# EM.should_receive(:defer).and_yield
|
614
|
-
@provider_wakame.should_receive(:physical_server_watch)
|
615
|
-
@provider_wakame.should_receive(:virtual_server_watch)
|
616
|
-
|
617
|
-
@tama_controller_factory = mock(::Tama::Controllers::ControllerFactory.allocate)
|
618
|
-
::Tama::Controllers::ControllerFactory.
|
619
|
-
should_receive(:create_controller).
|
620
|
-
with("tama_account1", "10.10.10.10", 80, "https", "192.168.0.10", 8080, "http").
|
621
|
-
and_return(@tama_controller_factory)
|
622
|
-
end
|
623
|
-
|
624
|
-
it "更新対象があったら更新完了後イベントを発火する" do
|
625
|
-
@tama_controller_factory.
|
626
|
-
should_receive(:describe_images).with([]).
|
627
|
-
and_return(UPDATE_WAKAME_IMAGES)
|
628
|
-
|
629
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
630
|
-
"Tengine::Resource::VirtualServerImage.updated.tengine_resource_watchd",
|
631
|
-
anything())
|
632
|
-
|
633
|
-
@virtual_server_image_wakame.provided_description.should ==
|
634
|
-
"ubuntu-10.04_with-metadata_kvm_i386.raw volume"
|
635
|
-
|
636
|
-
@watcher.start
|
637
|
-
|
638
|
-
@provider_wakame.reload
|
639
|
-
new_image = @provider_wakame.virtual_server_images.first
|
640
|
-
new_image.provided_description.should ==
|
641
|
-
"ubuntu-10.04_with-metadata_kvm_i386.raw"
|
642
|
-
end
|
643
|
-
|
644
|
-
it "更新対象がなかったらイベントは発火しない" do
|
645
|
-
@tama_controller_factory.
|
646
|
-
should_receive(:describe_images).with([]).
|
647
|
-
and_return(ORIGINAL_WAKAME_IMAGES)
|
648
|
-
|
649
|
-
Tengine::Event.default_sender.should_not_receive(:fire)
|
650
|
-
|
651
|
-
@watcher.start
|
652
|
-
end
|
653
|
-
|
654
|
-
it "登録対象があったら登録完了後イベントを発火する" do
|
655
|
-
@tama_controller_factory.
|
656
|
-
should_receive(:describe_images).with([]).
|
657
|
-
and_return(CREATE_WAKAME_IMAGES)
|
658
|
-
|
659
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
660
|
-
"Tengine::Resource::VirtualServerImage.created.tengine_resource_watchd",
|
661
|
-
anything())
|
662
|
-
|
663
|
-
expect { @watcher.start }.should change(
|
664
|
-
@provider_wakame.virtual_server_images, :count).by(1)
|
665
|
-
end
|
666
|
-
|
667
|
-
it "削除対象があったら削除完了後イベントを発火する" do
|
668
|
-
@tama_controller_factory.
|
669
|
-
should_receive(:describe_images).with([]).
|
670
|
-
and_return([])
|
671
|
-
|
672
|
-
Tengine::Event.default_sender.should_receive(:fire).with(
|
673
|
-
"Tengine::Resource::VirtualServerImage.destroyed.tengine_resource_watchd",
|
674
|
-
anything())
|
675
|
-
|
676
|
-
expect { @watcher.start }.should change(
|
677
|
-
@provider_wakame.virtual_server_images, :size).by(-1)
|
678
|
-
end
|
679
|
-
end # end to wakame
|
680
|
-
|
681
|
-
context "ec2" do
|
682
|
-
before do
|
683
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_ec2])
|
684
|
-
@provider_ec2.should_receive(:virtual_server_type_watch)
|
685
|
-
EM.should_receive(:add_periodic_timer).with(@provider_ec2.polling_interval).and_yield
|
686
|
-
# EM.should_receive(:defer).and_yield
|
687
|
-
# @provider_ec2.should_receive(:physical_server_watch)
|
688
|
-
# @provider_ec2.should_receive(:virtual_server_watch)
|
689
|
-
end
|
690
|
-
|
691
|
-
it "更新対象があったら更新完了後イベントを発火する" do
|
692
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
693
|
-
end
|
694
|
-
it "削除対象があったら削除完了後イベントを発火する" do
|
695
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
696
|
-
end
|
697
|
-
it "更新対象がなかったらイベントは発火しない" do
|
698
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
699
|
-
end
|
700
|
-
it "登録対象があったら登録完了後イベントを発火する" do
|
701
|
-
expect { @watcher.start }.should raise_error(NotImplementedError)
|
702
|
-
end
|
703
|
-
end # end to ec2
|
704
|
-
end # end to :virtual_server_image_watch
|
705
|
-
|
706
|
-
# polling_interval
|
707
|
-
describe :polling_interval do
|
708
|
-
it 'polling_intervalが0より大きい場合は、問い合わせを行う', :current => true do
|
709
|
-
@provider_wakame.polling_interval = 1
|
710
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_wakame])
|
711
|
-
|
712
|
-
@watcher.sender.should_receive(:wait_for_connection).and_yield
|
713
|
-
@provider_wakame.should_receive(:virtual_server_type_watch)
|
714
|
-
EM.should_receive(:add_periodic_timer).with(@provider_wakame.polling_interval).and_yield
|
715
|
-
@provider_wakame.should_receive(:physical_server_watch)
|
716
|
-
@provider_wakame.should_receive(:virtual_server_watch)
|
717
|
-
@provider_wakame.should_receive(:virtual_server_image_watch)
|
718
|
-
@watcher.start
|
719
|
-
end
|
720
|
-
|
721
|
-
it 'polling_intervalが0の場合は、問い合わせを行わない', :current => true do
|
722
|
-
@provider_wakame.polling_interval = 0
|
723
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_wakame])
|
724
|
-
|
725
|
-
@watcher.sender.should_receive(:wait_for_connection).and_yield
|
726
|
-
@provider_wakame.should_not_receive(:virtual_server_type_watch)
|
727
|
-
EM.should_not_receive(:add_periodic_timer).with(@provider_wakame.polling_interval).and_yield
|
728
|
-
@provider_wakame.should_not_receive(:physical_server_watch)
|
729
|
-
@provider_wakame.should_not_receive(:virtual_server_watch)
|
730
|
-
@provider_wakame.should_not_receive(:virtual_server_image_watch)
|
731
|
-
@watcher.start
|
732
|
-
end
|
733
|
-
|
734
|
-
it 'polling_intervalがマイナスの場合は、問い合わせを行わない', :current => true do
|
735
|
-
@provider_wakame.polling_interval = -1
|
736
|
-
Tengine::Resource::Provider.should_receive(:all).and_return([@provider_wakame])
|
737
|
-
|
738
|
-
@watcher.sender.should_receive(:wait_for_connection).and_yield
|
739
|
-
@provider_wakame.should_not_receive(:virtual_server_type_watch)
|
740
|
-
EM.should_not_receive(:add_periodic_timer).with(@provider_wakame.polling_interval).and_yield
|
741
|
-
@provider_wakame.should_not_receive(:physical_server_watch)
|
742
|
-
@provider_wakame.should_not_receive(:virtual_server_watch)
|
743
|
-
@provider_wakame.should_not_receive(:virtual_server_image_watch)
|
744
|
-
@watcher.start
|
745
|
-
end
|
746
|
-
end # end to :polling_interval
|
747
|
-
|
748
|
-
end # end to :start
|
749
|
-
|
750
|
-
ORIGINAL_WAKAME_INSTANCE_SPECS = [{
|
751
|
-
:cpu_cores => 2,
|
752
|
-
:memory_size => 512,
|
753
|
-
:arch => "x86_64",
|
754
|
-
:hypervisor => "kvm",
|
755
|
-
:updated_at => "2011-10-28T02:58:57Z",
|
756
|
-
:account_id => "a-shpoolxx",
|
757
|
-
:vifs => "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
|
758
|
-
:quota_weight => 1.0,
|
759
|
-
:id => "is-demospec",
|
760
|
-
:created_at => "2011-10-28T02:58:57Z",
|
761
|
-
:drives => "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n",
|
762
|
-
:uuid => "is-demospec"
|
763
|
-
}]
|
764
|
-
UPDATE_WAKAME_INSTANCE_SPECS = [{
|
765
|
-
:cpu_cores => 1,
|
766
|
-
:memory_size => 256,
|
767
|
-
:arch => "x86_64",
|
768
|
-
:hypervisor => "kvm",
|
769
|
-
:updated_at => "2011-10-28T02:58:57Z",
|
770
|
-
:account_id => "a-shpoolxx",
|
771
|
-
:vifs => "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
|
772
|
-
:quota_weight => 1.0,
|
773
|
-
:id => "is-demospec",
|
774
|
-
:created_at => "2011-10-28T02:58:57Z",
|
775
|
-
:drives => "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n",
|
776
|
-
:uuid => "is-demospec"
|
777
|
-
}]
|
778
|
-
CREATE_WAKAME_INSTANCE_SPECS = [{
|
779
|
-
:cpu_cores => 2,
|
780
|
-
:memory_size => 1024,
|
781
|
-
:arch => "x86_64",
|
782
|
-
:hypervisor => "kvm",
|
783
|
-
:updated_at => "2011-10-28T02:58:57Z",
|
784
|
-
:account_id => "b-shpoolxx",
|
785
|
-
:vifs => "--- \neth0: \n :bandwidth: 100000\n :index: 0\n",
|
786
|
-
:quota_weight => 1.0,
|
787
|
-
:id => "is-demospec2",
|
788
|
-
:created_at => "2011-10-28T02:58:57Z",
|
789
|
-
:drives => "--- \nephemeral1: \n :type: :local\n :size: 100\n :index: 0\n",
|
790
|
-
:uuid => "is-demospec2"
|
791
|
-
}] + ORIGINAL_WAKAME_INSTANCE_SPECS
|
792
|
-
|
793
|
-
ORIGINAL_WAKAME_HOST_NODES = [{
|
794
|
-
:status => "online",
|
795
|
-
:updated_at => "2011-10-18T03:53:24Z",
|
796
|
-
:account_id => "a-shpoolxx",
|
797
|
-
:offering_cpu_cores => 100,
|
798
|
-
:offering_memory_size => 400000,
|
799
|
-
:arch => "x86_64",
|
800
|
-
:hypervisor => "kvm",
|
801
|
-
:created_at => "2011-10-18T03:53:24Z",
|
802
|
-
:name => "demohost",
|
803
|
-
:uuid => "hp-demohost",
|
804
|
-
:id => "hp-demohost"
|
805
|
-
}]
|
806
|
-
UPDATE_WAKAME_HOST_NODES = [{
|
807
|
-
:status => "online",
|
808
|
-
:updated_at => "2011-10-18T03:53:24Z",
|
809
|
-
:account_id => "a-shpoolxx",
|
810
|
-
:offering_cpu_cores => 75,
|
811
|
-
:offering_memory_size => 350000,
|
812
|
-
:arch => "x86_64",
|
813
|
-
:hypervisor => "kvm",
|
814
|
-
:created_at => "2011-10-18T03:53:24Z",
|
815
|
-
:name => "demohost",
|
816
|
-
:uuid => "hp-demohost",
|
817
|
-
:id => "hp-demohost"
|
818
|
-
}]
|
819
|
-
CREATE_WAKAME_HOST_NODES = [{
|
820
|
-
:status => "online",
|
821
|
-
:updated_at => "2011-10-18T03:53:24Z",
|
822
|
-
:account_id => "a-shpoolxx",
|
823
|
-
:offering_cpu_cores => 75,
|
824
|
-
:offering_memory_size => 350000,
|
825
|
-
:arch => "x86_64",
|
826
|
-
:hypervisor => "kvm",
|
827
|
-
:created_at => "2011-10-18T03:53:24Z",
|
828
|
-
:name => "demohost2",
|
829
|
-
:uuid => "hp-demohost2",
|
830
|
-
:id => "hp-demohost2"
|
831
|
-
}] + ORIGINAL_WAKAME_HOST_NODES
|
832
|
-
|
833
|
-
ORIGINAL_WAKAME_INSTANCES = [{
|
834
|
-
:aws_kernel_id => "",
|
835
|
-
:aws_launch_time => "2011-10-18T06:51:16Z",
|
836
|
-
:tags => {},
|
837
|
-
:aws_reservation_id => "",
|
838
|
-
:aws_owner => "a-shpoolxx",
|
839
|
-
:instance_lifecycle => "",
|
840
|
-
:block_device_mappings => [{
|
841
|
-
:ebs_volume_id => "",
|
842
|
-
:ebs_status => "",
|
843
|
-
:ebs_attach_time => "",
|
844
|
-
:ebs_delete_on_termination => false,
|
845
|
-
:device_name => ""
|
846
|
-
}],
|
847
|
-
:ami_launch_index => "",
|
848
|
-
:root_device_name => "",
|
849
|
-
:aws_ramdisk_id => "",
|
850
|
-
:aws_availability_zone => "hp-demohost",
|
851
|
-
#:aws_groups => nil,
|
852
|
-
:spot_instance_request_id => "",
|
853
|
-
#:ssh_key_name => nil,
|
854
|
-
:virtualization_type => "",
|
855
|
-
:placement_group_name => "",
|
856
|
-
:requester_id => "",
|
857
|
-
:aws_instance_id => "i-jria301q",
|
858
|
-
:aws_product_codes => [],
|
859
|
-
:client_token => "",
|
860
|
-
:private_ip_address => "192.168.2.188",
|
861
|
-
:architecture => "x86_64",
|
862
|
-
:aws_state_code => 0,
|
863
|
-
:aws_image_id => "wmi-lucid5",
|
864
|
-
:root_device_type => "",
|
865
|
-
:ip_address => "nw-data=192.168.2.188",
|
866
|
-
:dns_name => "nw-data=jria301q.shpoolxx.vdc.local",
|
867
|
-
:monitoring_state => "",
|
868
|
-
:aws_instance_type => "is-demospec",
|
869
|
-
:aws_state => "running",
|
870
|
-
:private_dns_name => "jria301q.shpoolxx.vdc.local",
|
871
|
-
:aws_reason => ""
|
872
|
-
}]
|
873
|
-
UPDATE_WAKAME_INSTANCES = [{
|
874
|
-
:aws_kernel_id => "",
|
875
|
-
:aws_launch_time => "2011-10-18T06:51:16Z",
|
876
|
-
:tags => {},
|
877
|
-
:aws_reservation_id => "",
|
878
|
-
:aws_owner => "a-shpoolxx",
|
879
|
-
:instance_lifecycle => "",
|
880
|
-
:block_device_mappings => [{
|
881
|
-
:ebs_volume_id => "",
|
882
|
-
:ebs_status => "",
|
883
|
-
:ebs_attach_time => "",
|
884
|
-
:ebs_delete_on_termination => false,
|
885
|
-
:device_name => ""
|
886
|
-
}],
|
887
|
-
:ami_launch_index => "",
|
888
|
-
:root_device_name => "",
|
889
|
-
:aws_ramdisk_id => "",
|
890
|
-
:aws_availability_zone => "hp-demohost",
|
891
|
-
#:aws_groups => nil,
|
892
|
-
:spot_instance_request_id => "",
|
893
|
-
#:ssh_key_name => nil,
|
894
|
-
:virtualization_type => "",
|
895
|
-
:placement_group_name => "",
|
896
|
-
:requester_id => "",
|
897
|
-
:aws_instance_id => "i-jria301q",
|
898
|
-
:aws_product_codes => [],
|
899
|
-
:client_token => "",
|
900
|
-
:private_ip_address => "192.168.2.188",
|
901
|
-
:architecture => "x86_64",
|
902
|
-
:aws_state_code => 1,
|
903
|
-
:aws_image_id => "wmi-lucid5",
|
904
|
-
:root_device_type => "",
|
905
|
-
:ip_address => "nw-data=192.168.2.188",
|
906
|
-
:dns_name => "nw-data=jria301q.shpoolxx.vdc.local",
|
907
|
-
:monitoring_state => "",
|
908
|
-
:aws_instance_type => "is-demospec",
|
909
|
-
:aws_state => "terminated",
|
910
|
-
:private_dns_name => "jria301q.shpoolxx.vdc.local",
|
911
|
-
:aws_reason => ""
|
912
|
-
}]
|
913
|
-
CREATE_WAKAME_INSTANCES = [{
|
914
|
-
:aws_kernel_id => "",
|
915
|
-
:aws_launch_time => "2011-10-18T06:51:16Z",
|
916
|
-
:tags => {},
|
917
|
-
:aws_reservation_id => "",
|
918
|
-
:aws_owner => "a-shpoolxx",
|
919
|
-
:instance_lifecycle => "",
|
920
|
-
:block_device_mappings => [{
|
921
|
-
:ebs_volume_id => "",
|
922
|
-
:ebs_status => "",
|
923
|
-
:ebs_attach_time => "",
|
924
|
-
:ebs_delete_on_termination => false,
|
925
|
-
:device_name => ""
|
926
|
-
}],
|
927
|
-
:ami_launch_index => "",
|
928
|
-
:root_device_name => "",
|
929
|
-
:aws_ramdisk_id => "",
|
930
|
-
:aws_availability_zone => "hp-demohost",
|
931
|
-
#:aws_groups => nil,
|
932
|
-
:spot_instance_request_id => "",
|
933
|
-
#:ssh_key_name => nil,
|
934
|
-
:virtualization_type => "",
|
935
|
-
:placement_group_name => "",
|
936
|
-
:requester_id => "",
|
937
|
-
:aws_instance_id => "i-jria302q",
|
938
|
-
:aws_product_codes => [],
|
939
|
-
:client_token => "",
|
940
|
-
:private_ip_address => "192.168.2.189",
|
941
|
-
:architecture => "x86_64",
|
942
|
-
:aws_state_code => 0,
|
943
|
-
:aws_image_id => "wmi-lucid5",
|
944
|
-
:root_device_type => "",
|
945
|
-
:ip_address => "nw-data=192.168.2.189",
|
946
|
-
:dns_name => "nw-data=jria302q.shpoolxx.vdc.local",
|
947
|
-
:monitoring_state => "",
|
948
|
-
:aws_instance_type => "is-demospec",
|
949
|
-
:aws_state => "running",
|
950
|
-
:private_dns_name => "jria302q.shpoolxx.vdc.local",
|
951
|
-
:aws_reason => ""
|
952
|
-
}] + ORIGINAL_WAKAME_INSTANCES
|
953
|
-
|
954
|
-
ORIGINAL_WAKAME_IMAGES = [{
|
955
|
-
:root_device_name => "",
|
956
|
-
:aws_ramdisk_id => "",
|
957
|
-
:block_device_mappings => [{
|
958
|
-
:ebs_snapshot_id => "",
|
959
|
-
:ebs_volume_size => 0,
|
960
|
-
:ebs_delete_on_termination => false,
|
961
|
-
:device_name => ""
|
962
|
-
}],
|
963
|
-
:aws_is_public => false,
|
964
|
-
:virtualization_type => "",
|
965
|
-
:image_owner_alias => "",
|
966
|
-
:aws_id => "wmi-lucid6",
|
967
|
-
:aws_architecture => "x86",
|
968
|
-
:root_device_type => "",
|
969
|
-
:aws_location => "--- \n:snapshot_id: snap-lucid6\n",
|
970
|
-
:aws_image_type => "",
|
971
|
-
:name => "",
|
972
|
-
:aws_state => "init",
|
973
|
-
:description => "ubuntu-10.04_with-metadata_kvm_i386.raw volume",
|
974
|
-
:aws_kernel_id => "",
|
975
|
-
:tags => {},
|
976
|
-
:aws_owner => "a-shpoolxx"
|
977
|
-
}]
|
978
|
-
UPDATE_WAKAME_IMAGES = [{
|
979
|
-
:root_device_name => "",
|
980
|
-
:aws_ramdisk_id => "",
|
981
|
-
:block_device_mappings => [{
|
982
|
-
:ebs_snapshot_id => "",
|
983
|
-
:ebs_volume_size => 0,
|
984
|
-
:ebs_delete_on_termination => false,
|
985
|
-
:device_name => ""
|
986
|
-
}],
|
987
|
-
:aws_is_public => true,
|
988
|
-
:virtualization_type => "",
|
989
|
-
:image_owner_alias => "",
|
990
|
-
:aws_id => "wmi-lucid6",
|
991
|
-
:aws_architecture => "x86",
|
992
|
-
:root_device_type => "",
|
993
|
-
:aws_location => "--- \n:snapshot_id: snap-lucid6\n",
|
994
|
-
:aws_image_type => "",
|
995
|
-
:name => "",
|
996
|
-
:aws_state => "init",
|
997
|
-
:description => "ubuntu-10.04_with-metadata_kvm_i386.raw",
|
998
|
-
:aws_kernel_id => "",
|
999
|
-
:tags => {},
|
1000
|
-
:aws_owner => "a-shpoolxx"
|
1001
|
-
}]
|
1002
|
-
CREATE_WAKAME_IMAGES = [{
|
1003
|
-
:root_device_name => "",
|
1004
|
-
:aws_ramdisk_id => "",
|
1005
|
-
:block_device_mappings => [{
|
1006
|
-
:ebs_snapshot_id => "",
|
1007
|
-
:ebs_volume_size => 0,
|
1008
|
-
:ebs_delete_on_termination => false,
|
1009
|
-
:device_name => ""
|
1010
|
-
}],
|
1011
|
-
:aws_is_public => false,
|
1012
|
-
:virtualization_type => "",
|
1013
|
-
:image_owner_alias => "",
|
1014
|
-
:aws_id => "wmi-lucid7",
|
1015
|
-
:aws_architecture => "x86",
|
1016
|
-
:root_device_type => "",
|
1017
|
-
:aws_location => "--- \n:snapshot_id: snap-lucid7\n",
|
1018
|
-
:aws_image_type => "",
|
1019
|
-
:name => "",
|
1020
|
-
:aws_state => "init",
|
1021
|
-
:description => "ubuntu-10.04_with-metadata_kvm_i386.raw volume",
|
1022
|
-
:aws_kernel_id => "",
|
1023
|
-
:tags => {},
|
1024
|
-
:aws_owner => "a-shpoolxx"
|
1025
|
-
}] + ORIGINAL_WAKAME_IMAGES
|
1026
|
-
|
1027
|
-
end
|