fog-xenserver 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +15 -0
- data/.rubocop.yml +1158 -0
- data/.travis.yml +10 -1
- data/fog-xenserver.gemspec +12 -4
- data/lib/fog/compute/xen_server.rb +11 -0
- data/lib/fog/compute/xen_server/models.rb +2 -0
- data/lib/fog/compute/xen_server/models/event.rb +32 -0
- data/lib/fog/compute/xen_server/models/events.rb +11 -0
- data/lib/fog/compute/xen_server/real.rb +4 -0
- data/lib/fog/compute/xen_server/requests/create_pbd.rb +11 -0
- data/lib/fog/compute/xen_server/requests/from_event.rb +11 -0
- data/lib/fog/compute/xen_server/requests/get_current_id_event.rb +11 -0
- data/lib/fog/compute/xen_server/requests/inject_event.rb +11 -0
- data/lib/fog/compute/xen_server/requests/next_event.rb +11 -0
- data/lib/fog/compute/xen_server/requests/register_event.rb +11 -0
- data/lib/fog/compute/xen_server/requests/unregister_event.rb +11 -0
- data/lib/fog/utilities.rb +1 -1
- data/lib/fog/xen_server/connection.rb +2 -0
- data/lib/fog/xenserver/version.rb +1 -1
- data/spec/fog/compute/xen_server/models/event_spec.rb +56 -0
- data/spec/fog/compute/xen_server/models/events_spec.rb +9 -0
- metadata +22 -8
- data/.rubocop +0 -23
data/.travis.yml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
before_install:
|
2
|
+
- gem install bundler
|
3
|
+
|
1
4
|
matrix:
|
2
5
|
include:
|
3
6
|
- rvm: 1.8.7
|
@@ -8,7 +11,13 @@ matrix:
|
|
8
11
|
gemfile: gemfiles/Gemfile.1.9.2+
|
9
12
|
- rvm: 2.0.0
|
10
13
|
gemfile: gemfiles/Gemfile.1.9.2+
|
11
|
-
- rvm: 2.1.
|
14
|
+
- rvm: 2.1.10
|
15
|
+
gemfile: gemfiles/Gemfile.1.9.2+
|
16
|
+
- rvm: 2.2.6
|
17
|
+
gemfile: gemfiles/Gemfile.1.9.2+
|
18
|
+
- rvm: 2.3.3
|
19
|
+
gemfile: gemfiles/Gemfile.1.9.2+
|
20
|
+
- rvm: 2.4.0
|
12
21
|
gemfile: gemfiles/Gemfile.1.9.2+
|
13
22
|
env: COVERAGE=true
|
14
23
|
- rvm: ree
|
data/fog-xenserver.gemspec
CHANGED
@@ -24,11 +24,19 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_dependency 'fog-xml'
|
26
26
|
spec.add_dependency 'fog-core'
|
27
|
-
spec.
|
27
|
+
spec.add_dependency 'xmlrpc' if RUBY_VERSION =~ /^2\.[^0-3].*$/
|
28
|
+
|
29
|
+
spec.add_development_dependency 'coveralls'
|
30
|
+
spec.add_development_dependency 'json' if RUBY_VERSION =~ /^1\.8.*$/
|
28
31
|
spec.add_development_dependency 'minitest'
|
29
|
-
spec.add_development_dependency '
|
32
|
+
spec.add_development_dependency 'rake'
|
30
33
|
spec.add_development_dependency 'pry'
|
31
|
-
spec.add_development_dependency '
|
34
|
+
spec.add_development_dependency 'turn'
|
32
35
|
spec.add_development_dependency 'webmock'
|
33
|
-
|
36
|
+
|
37
|
+
if RUBY_VERSION =~ /^1\.(8.*|9.[0-2])$/
|
38
|
+
spec.add_development_dependency 'vcr', '< 3.0.0'
|
39
|
+
else
|
40
|
+
spec.add_development_dependency 'vcr'
|
41
|
+
end
|
34
42
|
end
|
@@ -24,6 +24,8 @@ module Fog
|
|
24
24
|
collection :crash_dumps
|
25
25
|
model :dr_task
|
26
26
|
collection :dr_tasks
|
27
|
+
model :event
|
28
|
+
collection :events
|
27
29
|
model :gpu_group
|
28
30
|
collection :gpu_groups
|
29
31
|
model :guest_metrics
|
@@ -87,6 +89,14 @@ module Fog
|
|
87
89
|
|
88
90
|
request_path "fog/compute/xen_server/requests"
|
89
91
|
|
92
|
+
# event
|
93
|
+
request :from_event
|
94
|
+
request :get_current_id_event
|
95
|
+
request :inject_event
|
96
|
+
request :next_event
|
97
|
+
request :register_event
|
98
|
+
request :unregister_event
|
99
|
+
|
90
100
|
# host
|
91
101
|
request :apply_edition_host
|
92
102
|
request :assert_can_evacuate_host
|
@@ -142,6 +152,7 @@ module Fog
|
|
142
152
|
request :set_default_locking_mode_network
|
143
153
|
|
144
154
|
# PBD
|
155
|
+
request :create_pbd
|
145
156
|
request :plug_pbd
|
146
157
|
request :set_device_config_pbd
|
147
158
|
request :unplug_pbd
|
@@ -14,6 +14,8 @@ module Fog
|
|
14
14
|
autoload :CrashDumps, File.expand_path("../models/crash_dumps", __FILE__)
|
15
15
|
autoload :DrTask, File.expand_path("../models/dr_task", __FILE__)
|
16
16
|
autoload :DrTasks, File.expand_path("../models/dr_tasks", __FILE__)
|
17
|
+
autoload :Event, File.expand_path("../models/event", __FILE__)
|
18
|
+
autoload :Events, File.expand_path("../models/events", __FILE__)
|
17
19
|
autoload :GpuGroup, File.expand_path("../models/gpu_group", __FILE__)
|
18
20
|
autoload :GpuGroups, File.expand_path("../models/gpu_groups", __FILE__)
|
19
21
|
autoload :GuestMetrics, File.expand_path("../models/guest_metrics", __FILE__)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class XenServer
|
4
|
+
module Models
|
5
|
+
class Event < Model
|
6
|
+
# API Reference here:
|
7
|
+
# http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=event
|
8
|
+
|
9
|
+
provider_class :event
|
10
|
+
collection_name :events
|
11
|
+
|
12
|
+
identity :reference
|
13
|
+
|
14
|
+
attribute :klass, :aliases => :class, :as => :class
|
15
|
+
attribute :id
|
16
|
+
attribute :obj_uuid
|
17
|
+
attribute :operation
|
18
|
+
attribute :ref
|
19
|
+
attribute :timestamp
|
20
|
+
|
21
|
+
def register(classes)
|
22
|
+
service.register_event(classes)
|
23
|
+
end
|
24
|
+
|
25
|
+
def next
|
26
|
+
service.next_event
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class XenServer
|
4
|
+
class Real
|
5
|
+
def create_pbd(host_uuid, sr_uuid, device_config = {})
|
6
|
+
@connection.request({ :parser => Fog::Parsers::XenServer::Base.new, :method => "PBD.create" }, host_uuid, sr_uuid, device_config)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/fog/utilities.rb
CHANGED
@@ -29,6 +29,8 @@ module Fog
|
|
29
29
|
response = @factory.call(method, @credentials, params.first)
|
30
30
|
elsif params.length.eql?(2) and params.last.is_a?(Array)
|
31
31
|
response = @factory.call(method, @credentials, params.first, params.last)
|
32
|
+
elsif params.length.eql?(1) and params.last.is_a?(Array)
|
33
|
+
response = @factory.call(method, @credentials, params.first)
|
32
34
|
else
|
33
35
|
response = eval("@factory.call('#{method}', '#{@credentials}', #{params.map {|p| p.is_a?(String) ? "'#{p}'" : p}.join(',')})")
|
34
36
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Fog::Compute::XenServer::Models::Event do
|
4
|
+
let(:event_class) do
|
5
|
+
class Fog::Compute::XenServer::Models::Event
|
6
|
+
def self.read_identity
|
7
|
+
instance_variable_get('@identity')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
Fog::Compute::XenServer::Models::Event
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should associate to a provider class' do
|
14
|
+
event_class.provider_class.must_equal('event')
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should have a collection name' do
|
18
|
+
event_class.collection_name.must_equal(:events)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should have an unique id' do
|
22
|
+
event_class.read_identity.must_equal(:reference)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should have 7 attributes' do
|
26
|
+
event_class.attributes.must_equal([ :reference,
|
27
|
+
:klass,
|
28
|
+
:id,
|
29
|
+
:obj_uuid,
|
30
|
+
:operation,
|
31
|
+
:ref,
|
32
|
+
:timestamp ])
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have 7 masks' do
|
36
|
+
event_class.masks.must_equal(:reference => :reference,
|
37
|
+
:klass => :class,
|
38
|
+
:id => :id,
|
39
|
+
:obj_uuid => :obj_uuid,
|
40
|
+
:operation => :operation,
|
41
|
+
:ref => :ref,
|
42
|
+
:timestamp => :timestamp)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "shouldn't have aliases" do
|
46
|
+
event_class.aliases.must_equal({ :class=>:klass })
|
47
|
+
end
|
48
|
+
|
49
|
+
it "shouldn't have default values" do
|
50
|
+
event_class.default_values.must_equal({})
|
51
|
+
end
|
52
|
+
|
53
|
+
it "shouldn't require attributes before save" do
|
54
|
+
event_class.require_before_save.must_equal([])
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Fog::Compute::XenServer::Models::Events do
|
4
|
+
let(:events_class) { Fog::Compute::XenServer::Models::Events }
|
5
|
+
|
6
|
+
it 'should be a collection of Blobs' do
|
7
|
+
events_class.model.must_equal(Fog::Compute::XenServer::Models::Event)
|
8
|
+
end
|
9
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-xenserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paulo Henrique Lopes Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-xml
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: coveralls
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: turn
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -123,7 +123,7 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: vcr
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -142,8 +142,9 @@ executables: []
|
|
142
142
|
extensions: []
|
143
143
|
extra_rdoc_files: []
|
144
144
|
files:
|
145
|
+
- ".codeclimate.yml"
|
145
146
|
- ".gitignore"
|
146
|
-
- ".rubocop"
|
147
|
+
- ".rubocop.yml"
|
147
148
|
- ".ruby-gemset"
|
148
149
|
- ".ruby-version"
|
149
150
|
- ".travis.yml"
|
@@ -172,6 +173,8 @@ files:
|
|
172
173
|
- lib/fog/compute/xen_server/models/crash_dumps.rb
|
173
174
|
- lib/fog/compute/xen_server/models/dr_task.rb
|
174
175
|
- lib/fog/compute/xen_server/models/dr_tasks.rb
|
176
|
+
- lib/fog/compute/xen_server/models/event.rb
|
177
|
+
- lib/fog/compute/xen_server/models/events.rb
|
175
178
|
- lib/fog/compute/xen_server/models/gpu_group.rb
|
176
179
|
- lib/fog/compute/xen_server/models/gpu_groups.rb
|
177
180
|
- lib/fog/compute/xen_server/models/guest_metrics.rb
|
@@ -274,6 +277,7 @@ files:
|
|
274
277
|
- lib/fog/compute/xen_server/requests/create_new_blob_pool.rb
|
275
278
|
- lib/fog/compute/xen_server/requests/create_new_blob_server.rb
|
276
279
|
- lib/fog/compute/xen_server/requests/create_new_blob_sr.rb
|
280
|
+
- lib/fog/compute/xen_server/requests/create_pbd.rb
|
277
281
|
- lib/fog/compute/xen_server/requests/create_server.rb
|
278
282
|
- lib/fog/compute/xen_server/requests/create_sr.rb
|
279
283
|
- lib/fog/compute/xen_server/requests/create_vbd.rb
|
@@ -323,9 +327,11 @@ files:
|
|
323
327
|
- lib/fog/compute/xen_server/requests/forget_pif.rb
|
324
328
|
- lib/fog/compute/xen_server/requests/forget_sr.rb
|
325
329
|
- lib/fog/compute/xen_server/requests/forget_vdi.rb
|
330
|
+
- lib/fog/compute/xen_server/requests/from_event.rb
|
326
331
|
- lib/fog/compute/xen_server/requests/get_allowed_vbd_devices_server.rb
|
327
332
|
- lib/fog/compute/xen_server/requests/get_allowed_vif_devices_server.rb
|
328
333
|
- lib/fog/compute/xen_server/requests/get_boot_record_server.rb
|
334
|
+
- lib/fog/compute/xen_server/requests/get_current_id_event.rb
|
329
335
|
- lib/fog/compute/xen_server/requests/get_data_sources_host.rb
|
330
336
|
- lib/fog/compute/xen_server/requests/get_data_sources_server.rb
|
331
337
|
- lib/fog/compute/xen_server/requests/get_license_state_pool.rb
|
@@ -348,6 +354,7 @@ files:
|
|
348
354
|
- lib/fog/compute/xen_server/requests/hard_reboot_server.rb
|
349
355
|
- lib/fog/compute/xen_server/requests/hard_shutdown_server.rb
|
350
356
|
- lib/fog/compute/xen_server/requests/import_convert_server.rb
|
357
|
+
- lib/fog/compute/xen_server/requests/inject_event.rb
|
351
358
|
- lib/fog/compute/xen_server/requests/insert_vbd.rb
|
352
359
|
- lib/fog/compute/xen_server/requests/introduce_pif.rb
|
353
360
|
- lib/fog/compute/xen_server/requests/introduce_sr.rb
|
@@ -361,6 +368,7 @@ files:
|
|
361
368
|
- lib/fog/compute/xen_server/requests/maximise_memory_server.rb
|
362
369
|
- lib/fog/compute/xen_server/requests/migrate_receive_host.rb
|
363
370
|
- lib/fog/compute/xen_server/requests/migrate_send_server.rb
|
371
|
+
- lib/fog/compute/xen_server/requests/next_event.rb
|
364
372
|
- lib/fog/compute/xen_server/requests/open_database_vdi.rb
|
365
373
|
- lib/fog/compute/xen_server/requests/pause_server.rb
|
366
374
|
- lib/fog/compute/xen_server/requests/plug_pbd.rb
|
@@ -386,6 +394,7 @@ files:
|
|
386
394
|
- lib/fog/compute/xen_server/requests/recover_server.rb
|
387
395
|
- lib/fog/compute/xen_server/requests/recover_slaves_pool.rb
|
388
396
|
- lib/fog/compute/xen_server/requests/refresh_pack_info_host.rb
|
397
|
+
- lib/fog/compute/xen_server/requests/register_event.rb
|
389
398
|
- lib/fog/compute/xen_server/requests/remove_ipv4_allowed_vif.rb
|
390
399
|
- lib/fog/compute/xen_server/requests/remove_ipv6_allowed_vif.rb
|
391
400
|
- lib/fog/compute/xen_server/requests/reset_cpu_features_host.rb
|
@@ -472,6 +481,7 @@ files:
|
|
472
481
|
- lib/fog/compute/xen_server/requests/unplug_pbd.rb
|
473
482
|
- lib/fog/compute/xen_server/requests/unplug_vbd.rb
|
474
483
|
- lib/fog/compute/xen_server/requests/unplug_vif.rb
|
484
|
+
- lib/fog/compute/xen_server/requests/unregister_event.rb
|
475
485
|
- lib/fog/compute/xen_server/requests/update_sr.rb
|
476
486
|
- lib/fog/compute/xen_server/requests/update_vdi.rb
|
477
487
|
- lib/fog/parsers/xen_server.rb
|
@@ -520,6 +530,8 @@ files:
|
|
520
530
|
- spec/fog/compute/xen_server/models/crash_dumps_spec.rb
|
521
531
|
- spec/fog/compute/xen_server/models/dr_task_spec.rb
|
522
532
|
- spec/fog/compute/xen_server/models/dr_tasks_spec.rb
|
533
|
+
- spec/fog/compute/xen_server/models/event_spec.rb
|
534
|
+
- spec/fog/compute/xen_server/models/events_spec.rb
|
523
535
|
- spec/fog/compute/xen_server/models/gpu_group_spec.rb
|
524
536
|
- spec/fog/compute/xen_server/models/gpu_groups_spec.rb
|
525
537
|
- spec/fog/compute/xen_server/models/guest_metrics_spec.rb
|
@@ -610,7 +622,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
610
622
|
version: '0'
|
611
623
|
requirements: []
|
612
624
|
rubyforge_project:
|
613
|
-
rubygems_version: 2.
|
625
|
+
rubygems_version: 2.2.2
|
614
626
|
signing_key:
|
615
627
|
specification_version: 4
|
616
628
|
summary: This library can be used as a module for `fog` or as standalone provider
|
@@ -650,6 +662,8 @@ test_files:
|
|
650
662
|
- spec/fog/compute/xen_server/models/crash_dumps_spec.rb
|
651
663
|
- spec/fog/compute/xen_server/models/dr_task_spec.rb
|
652
664
|
- spec/fog/compute/xen_server/models/dr_tasks_spec.rb
|
665
|
+
- spec/fog/compute/xen_server/models/event_spec.rb
|
666
|
+
- spec/fog/compute/xen_server/models/events_spec.rb
|
653
667
|
- spec/fog/compute/xen_server/models/gpu_group_spec.rb
|
654
668
|
- spec/fog/compute/xen_server/models/gpu_groups_spec.rb
|
655
669
|
- spec/fog/compute/xen_server/models/guest_metrics_spec.rb
|