wakame-vdc-agents 10.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. data/LICENSE +202 -0
  2. data/NOTICE +1 -0
  3. data/Rakefile +142 -0
  4. data/bin/hva +972 -0
  5. data/bin/nsa +147 -0
  6. data/bin/sta +182 -0
  7. data/config/hva.conf.example +10 -0
  8. data/config/initializers/isono.rb +43 -0
  9. data/config/initializers/passenger.rb +6 -0
  10. data/config/initializers/sequel.rb +21 -0
  11. data/config/nsa.conf.example +9 -0
  12. data/config/path_resolver.rb +12 -0
  13. data/lib/dcmgr.rb +115 -0
  14. data/lib/dcmgr/endpoints/core_api.rb +1004 -0
  15. data/lib/dcmgr/endpoints/core_api_mock.rb +816 -0
  16. data/lib/dcmgr/endpoints/errors.rb +55 -0
  17. data/lib/dcmgr/endpoints/metadata.rb +129 -0
  18. data/lib/dcmgr/logger.rb +44 -0
  19. data/lib/dcmgr/models/account.rb +104 -0
  20. data/lib/dcmgr/models/account_resource.rb +16 -0
  21. data/lib/dcmgr/models/base.rb +69 -0
  22. data/lib/dcmgr/models/base_new.rb +371 -0
  23. data/lib/dcmgr/models/frontend_system.rb +38 -0
  24. data/lib/dcmgr/models/host_pool.rb +102 -0
  25. data/lib/dcmgr/models/image.rb +46 -0
  26. data/lib/dcmgr/models/instance.rb +255 -0
  27. data/lib/dcmgr/models/instance_netfilter_group.rb +16 -0
  28. data/lib/dcmgr/models/instance_nic.rb +68 -0
  29. data/lib/dcmgr/models/instance_spec.rb +21 -0
  30. data/lib/dcmgr/models/ip_lease.rb +42 -0
  31. data/lib/dcmgr/models/netfilter_group.rb +88 -0
  32. data/lib/dcmgr/models/netfilter_rule.rb +21 -0
  33. data/lib/dcmgr/models/network.rb +32 -0
  34. data/lib/dcmgr/models/physical_host.rb +67 -0
  35. data/lib/dcmgr/models/request_log.rb +25 -0
  36. data/lib/dcmgr/models/ssh_key_pair.rb +55 -0
  37. data/lib/dcmgr/models/storage_pool.rb +134 -0
  38. data/lib/dcmgr/models/tag.rb +126 -0
  39. data/lib/dcmgr/models/tag_mapping.rb +28 -0
  40. data/lib/dcmgr/models/volume.rb +130 -0
  41. data/lib/dcmgr/models/volume_snapshot.rb +47 -0
  42. data/lib/dcmgr/node_modules/hva_collector.rb +134 -0
  43. data/lib/dcmgr/node_modules/sta_collector.rb +72 -0
  44. data/lib/dcmgr/scheduler.rb +12 -0
  45. data/lib/dcmgr/scheduler/find_last.rb +16 -0
  46. data/lib/dcmgr/scheduler/find_random.rb +16 -0
  47. data/lib/dcmgr/stm/instance.rb +25 -0
  48. data/lib/dcmgr/stm/snapshot_context.rb +33 -0
  49. data/lib/dcmgr/stm/volume_context.rb +65 -0
  50. data/lib/dcmgr/web/base.rb +21 -0
  51. data/lib/sinatra/accept_media_types.rb +128 -0
  52. data/lib/sinatra/lazy_auth.rb +56 -0
  53. data/lib/sinatra/rabbit.rb +278 -0
  54. data/lib/sinatra/respond_to.rb +272 -0
  55. data/lib/sinatra/sequel_transaction.rb +27 -0
  56. data/lib/sinatra/static_assets.rb +83 -0
  57. data/lib/sinatra/url_for.rb +44 -0
  58. metadata +270 -0
@@ -0,0 +1,27 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'sinatra/base'
4
+ require 'sequel'
5
+
6
+ module Sinatra
7
+ # wrap routed request with sequel transaction block.
8
+ module SequelTransaction
9
+ module Helpers
10
+ private
11
+ def route_eval(&block)
12
+ db = Sequel::DATABASES.first
13
+
14
+ ret = nil
15
+ db.transaction do
16
+ ret = instance_eval(&block)
17
+ end
18
+ throw :halt, ret
19
+ end
20
+ end
21
+
22
+ def self.registered(app)
23
+ app.helpers SequelTransaction::Helpers
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,83 @@
1
+ require 'sinatra/base'
2
+ require 'sinatra/url_for'
3
+
4
+ module Sinatra
5
+ module StaticAssets
6
+ module Helpers
7
+ # In HTML <link> and <img> tags have no end tag.
8
+ # In XHTML, on the contrary, these tags must be properly closed.
9
+ #
10
+ # We can choose the appropriate behaviour with +closed+ option:
11
+ #
12
+ # image_tag "/images/foo.png", :alt => "Foo itself", :closed => true
13
+ #
14
+ # The default value of +closed+ option is +false+.
15
+ #
16
+ def image_tag(source, options = {})
17
+ options[:src] = url_for(source)
18
+ tag("img", options)
19
+ end
20
+
21
+ def stylesheet_link_tag(*sources)
22
+ list, options = extract_options(sources)
23
+ list.collect { |source| stylesheet_tag(source, options) }.join("\n")
24
+ end
25
+
26
+ def javascript_script_tag(*sources)
27
+ list, options = extract_options(sources)
28
+ list.collect { |source| javascript_tag(source, options) }.join("\n")
29
+ end
30
+
31
+ def link_to(desc, url, options = {})
32
+ tag("a", options.merge(:href => url_for(url))) do
33
+ desc
34
+ end
35
+ end
36
+
37
+ private
38
+
39
+ def tag(name, local_options = {})
40
+ start_tag = "<#{name}#{tag_options(local_options) if local_options}"
41
+ if block_given?
42
+ content = yield
43
+ "#{start_tag}>#{content}</#{name}>"
44
+ else
45
+ "#{start_tag}#{"/" if options.xhtml}>"
46
+ end
47
+ end
48
+
49
+ def tag_options(options)
50
+ unless options.empty?
51
+ attrs = []
52
+ attrs = options.map { |key, value| %(#{key}="#{Rack::Utils.escape_html(value)}") }
53
+ " #{attrs.sort * ' '}" unless attrs.empty?
54
+ end
55
+ end
56
+
57
+ def stylesheet_tag(source, options = {})
58
+ tag("link", { :type => "text/css",
59
+ :charset => "utf-8", :media => "screen", :rel => "stylesheet",
60
+ :href => url_for(source) }.merge(options))
61
+ end
62
+
63
+ def javascript_tag(source, options = {})
64
+ tag("script", { :type => "text/javascript", :charset => "utf-8",
65
+ :src => url_for(source) }.merge(options)) do
66
+ end
67
+ end
68
+
69
+ def extract_options(a)
70
+ opts = a.last.is_a?(::Hash) ? a.pop : {}
71
+ [a, opts]
72
+ end
73
+
74
+ end
75
+
76
+ def self.registered(app)
77
+ app.helpers StaticAssets::Helpers
78
+ app.disable :xhtml
79
+ end
80
+ end
81
+
82
+ register StaticAssets
83
+ end
@@ -0,0 +1,44 @@
1
+ module Sinatra
2
+ module UrlForHelper
3
+ # Construct a link to +url_fragment+, which should be given relative to
4
+ # the base of this Sinatra app. The mode should be either
5
+ # <code>:path_only</code>, which will generate an absolute path within
6
+ # the current domain (the default), or <code>:full</code>, which will
7
+ # include the site name and port number. (The latter is typically
8
+ # necessary for links in RSS feeds.) Example usage:
9
+ #
10
+ # url_for "/" # Returns "/myapp/"
11
+ # url_for "/foo" # Returns "/myapp/foo"
12
+ # url_for "/foo", :full # Returns "http://example.com/myapp/foo"
13
+ #--
14
+ # See README.rdoc for a list of some of the people who helped me clean
15
+ # up earlier versions of this code.
16
+ def url_for url_fragment, mode=:path_only
17
+ case mode
18
+ when :path_only
19
+ base = request.script_name
20
+ when :full
21
+ scheme = request.scheme
22
+ if (scheme == 'http' && request.port == 80 ||
23
+ scheme == 'https' && request.port == 443)
24
+ port = ""
25
+ else
26
+ port = ":#{request.port}"
27
+ end
28
+ request_host = HOSTNAME ? HOSTNAME : request.host
29
+ base = "#{scheme}://#{request_host}#{port}#{request.script_name}"
30
+ else
31
+ raise TypeError, "Unknown url_for mode #{mode}"
32
+ end
33
+ "#{base}#{url_fragment}"
34
+ end
35
+
36
+ def root_url
37
+ url_for '/'
38
+ end
39
+ end
40
+
41
+
42
+
43
+ helpers UrlForHelper
44
+ end
metadata ADDED
@@ -0,0 +1,270 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wakame-vdc-agents
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 10
7
+ - 11
8
+ - 0
9
+ version: 10.11.0
10
+ platform: ruby
11
+ authors:
12
+ - axsh Ltd.
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-11-19 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ name: isono
23
+ type: :runtime
24
+ version_requirements: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 1
31
+ - 0
32
+ version: 0.1.0
33
+ - - <
34
+ - !ruby/object:Gem::Version
35
+ segments:
36
+ - 0
37
+ - 2
38
+ version: "0.2"
39
+ requirement: *id001
40
+ - !ruby/object:Gem::Dependency
41
+ prerelease: false
42
+ name: eventmachine
43
+ type: :runtime
44
+ version_requirements: &id002 !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "="
47
+ - !ruby/object:Gem::Version
48
+ segments:
49
+ - 0
50
+ - 12
51
+ - 10
52
+ version: 0.12.10
53
+ requirement: *id002
54
+ - !ruby/object:Gem::Dependency
55
+ prerelease: false
56
+ name: log4r
57
+ type: :runtime
58
+ version_requirements: &id003 !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ segments:
63
+ - 0
64
+ version: "0"
65
+ requirement: *id003
66
+ - !ruby/object:Gem::Dependency
67
+ prerelease: false
68
+ name: extlib
69
+ type: :runtime
70
+ version_requirements: &id004 !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 0
76
+ - 9
77
+ - 15
78
+ version: 0.9.15
79
+ requirement: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ prerelease: false
82
+ name: configuration
83
+ type: :runtime
84
+ version_requirements: &id005 !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ segments:
89
+ - 0
90
+ version: "0"
91
+ requirement: *id005
92
+ - !ruby/object:Gem::Dependency
93
+ prerelease: false
94
+ name: statemachine
95
+ type: :runtime
96
+ version_requirements: &id006 !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "="
99
+ - !ruby/object:Gem::Version
100
+ segments:
101
+ - 1
102
+ - 1
103
+ - 1
104
+ version: 1.1.1
105
+ requirement: *id006
106
+ - !ruby/object:Gem::Dependency
107
+ prerelease: false
108
+ name: ruby-hmac
109
+ type: :runtime
110
+ version_requirements: &id007 !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ requirement: *id007
118
+ - !ruby/object:Gem::Dependency
119
+ prerelease: false
120
+ name: ipaddress
121
+ type: :runtime
122
+ version_requirements: &id008 !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "="
125
+ - !ruby/object:Gem::Version
126
+ segments:
127
+ - 0
128
+ - 7
129
+ - 0
130
+ version: 0.7.0
131
+ requirement: *id008
132
+ - !ruby/object:Gem::Dependency
133
+ prerelease: false
134
+ name: open4
135
+ type: :runtime
136
+ version_requirements: &id009 !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ segments:
141
+ - 0
142
+ version: "0"
143
+ requirement: *id009
144
+ - !ruby/object:Gem::Dependency
145
+ prerelease: false
146
+ name: bacon
147
+ type: :development
148
+ version_requirements: &id010 !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ segments:
153
+ - 0
154
+ version: "0"
155
+ requirement: *id010
156
+ - !ruby/object:Gem::Dependency
157
+ prerelease: false
158
+ name: rake
159
+ type: :development
160
+ version_requirements: &id011 !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ segments:
165
+ - 0
166
+ version: "0"
167
+ requirement: *id011
168
+ description: ""
169
+ email:
170
+ - dev@axsh.net
171
+ executables:
172
+ - hva
173
+ - sta
174
+ - nsa
175
+ extensions: []
176
+
177
+ extra_rdoc_files: []
178
+
179
+ files:
180
+ - config/path_resolver.rb
181
+ - config/initializers/isono.rb
182
+ - config/initializers/passenger.rb
183
+ - config/initializers/sequel.rb
184
+ - lib/dcmgr.rb
185
+ - lib/sinatra/accept_media_types.rb
186
+ - lib/sinatra/sequel_transaction.rb
187
+ - lib/sinatra/static_assets.rb
188
+ - lib/sinatra/respond_to.rb
189
+ - lib/sinatra/lazy_auth.rb
190
+ - lib/sinatra/rabbit.rb
191
+ - lib/sinatra/url_for.rb
192
+ - lib/dcmgr/web/base.rb
193
+ - lib/dcmgr/logger.rb
194
+ - lib/dcmgr/scheduler/find_random.rb
195
+ - lib/dcmgr/scheduler/find_last.rb
196
+ - lib/dcmgr/node_modules/sta_collector.rb
197
+ - lib/dcmgr/node_modules/hva_collector.rb
198
+ - lib/dcmgr/endpoints/errors.rb
199
+ - lib/dcmgr/endpoints/core_api.rb
200
+ - lib/dcmgr/endpoints/metadata.rb
201
+ - lib/dcmgr/endpoints/core_api_mock.rb
202
+ - lib/dcmgr/stm/instance.rb
203
+ - lib/dcmgr/stm/snapshot_context.rb
204
+ - lib/dcmgr/stm/volume_context.rb
205
+ - lib/dcmgr/models/frontend_system.rb
206
+ - lib/dcmgr/models/storage_pool.rb
207
+ - lib/dcmgr/models/instance_nic.rb
208
+ - lib/dcmgr/models/image.rb
209
+ - lib/dcmgr/models/base.rb
210
+ - lib/dcmgr/models/volume_snapshot.rb
211
+ - lib/dcmgr/models/instance_spec.rb
212
+ - lib/dcmgr/models/instance.rb
213
+ - lib/dcmgr/models/volume.rb
214
+ - lib/dcmgr/models/account_resource.rb
215
+ - lib/dcmgr/models/physical_host.rb
216
+ - lib/dcmgr/models/network.rb
217
+ - lib/dcmgr/models/ip_lease.rb
218
+ - lib/dcmgr/models/host_pool.rb
219
+ - lib/dcmgr/models/ssh_key_pair.rb
220
+ - lib/dcmgr/models/request_log.rb
221
+ - lib/dcmgr/models/tag.rb
222
+ - lib/dcmgr/models/base_new.rb
223
+ - lib/dcmgr/models/tag_mapping.rb
224
+ - lib/dcmgr/models/instance_netfilter_group.rb
225
+ - lib/dcmgr/models/account.rb
226
+ - lib/dcmgr/models/netfilter_group.rb
227
+ - lib/dcmgr/models/netfilter_rule.rb
228
+ - lib/dcmgr/scheduler.rb
229
+ - Rakefile
230
+ - LICENSE
231
+ - NOTICE
232
+ - config/hva.conf.example
233
+ - config/nsa.conf.example
234
+ - bin/hva
235
+ - bin/sta
236
+ - bin/nsa
237
+ has_rdoc: true
238
+ homepage: http://wakame.jp/
239
+ licenses: []
240
+
241
+ post_install_message:
242
+ rdoc_options: []
243
+
244
+ require_paths:
245
+ - lib
246
+ required_ruby_version: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ segments:
251
+ - 1
252
+ - 8
253
+ - 7
254
+ version: 1.8.7
255
+ required_rubygems_version: !ruby/object:Gem::Requirement
256
+ requirements:
257
+ - - ">="
258
+ - !ruby/object:Gem::Version
259
+ segments:
260
+ - 0
261
+ version: "0"
262
+ requirements: []
263
+
264
+ rubyforge_project:
265
+ rubygems_version: 1.3.6
266
+ signing_key:
267
+ specification_version: 3
268
+ summary: "Datacenter management toolkit for IaaS Cloud: agent modules"
269
+ test_files: []
270
+