fog-xenserver 0.0.1.alpha2 → 0.0.1.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +27 -0
- data/.travis.yml +19 -0
- data/CONTRIBUTING.md +6 -6
- data/Gemfile +1 -1
- data/LICENSE.md +1 -1
- data/README.md +3 -1
- data/Rakefile +10 -1
- data/fog-xenserver.gemspec +6 -4
- data/gemfiles/Gemfile.1.8.7 +7 -0
- data/gemfiles/Gemfile.1.9.2+ +6 -0
- data/lib/fog.rb +1 -1
- data/lib/fog/collection.rb +37 -0
- data/lib/fog/compute/xen_server.rb +132 -0
- data/lib/fog/compute/xen_server/mock.rb +27 -0
- data/lib/fog/compute/xen_server/models.rb +78 -0
- data/lib/fog/compute/xen_server/models/blob.rb +24 -0
- data/lib/fog/compute/xen_server/models/blobs.rb +11 -0
- data/lib/fog/compute/xen_server/models/bond.rb +26 -0
- data/lib/fog/compute/xen_server/models/bonds.rb +11 -0
- data/lib/fog/compute/xen_server/models/console.rb +23 -0
- data/lib/fog/compute/xen_server/models/consoles.rb +11 -0
- data/lib/fog/compute/xen_server/models/crash_dump.rb +22 -0
- data/lib/fog/compute/xen_server/models/crash_dumps.rb +11 -0
- data/lib/fog/compute/xen_server/models/dr_task.rb +20 -0
- data/lib/fog/compute/xen_server/models/dr_tasks.rb +11 -0
- data/lib/fog/compute/xen_server/models/gpu_group.rb +25 -0
- data/lib/fog/compute/xen_server/models/gpu_groups.rb +11 -0
- data/lib/fog/compute/xen_server/models/guest_metrics.rb +28 -0
- data/lib/fog/compute/xen_server/models/guests_metrics.rb +11 -0
- data/lib/fog/compute/xen_server/models/host.rb +121 -0
- data/lib/fog/compute/xen_server/models/host_cpu.rb +31 -0
- data/lib/fog/compute/xen_server/models/host_cpus.rb +11 -0
- data/lib/fog/compute/xen_server/models/host_crash_dump.rb +23 -0
- data/lib/fog/compute/xen_server/models/host_crash_dumps.rb +11 -0
- data/lib/fog/compute/xen_server/models/host_metrics.rb +28 -0
- data/lib/fog/compute/xen_server/models/host_patch.rb +28 -0
- data/lib/fog/compute/xen_server/models/host_patchs.rb +11 -0
- data/lib/fog/compute/xen_server/models/hosts.rb +11 -0
- data/lib/fog/compute/xen_server/models/hosts_metrics.rb +11 -0
- data/lib/fog/compute/xen_server/models/network.rb +65 -0
- data/lib/fog/compute/xen_server/models/networks.rb +11 -0
- data/lib/fog/compute/xen_server/models/pbd.rb +30 -0
- data/lib/fog/compute/xen_server/models/pbds.rb +11 -0
- data/lib/fog/compute/xen_server/models/pci.rb +25 -0
- data/lib/fog/compute/xen_server/models/pcis.rb +11 -0
- data/lib/fog/compute/xen_server/models/pgpu.rb +23 -0
- data/lib/fog/compute/xen_server/models/pgpus.rb +11 -0
- data/lib/fog/compute/xen_server/models/pif.rb +49 -0
- data/lib/fog/compute/xen_server/models/pif_metrics.rb +30 -0
- data/lib/fog/compute/xen_server/models/pifs.rb +11 -0
- data/lib/fog/compute/xen_server/models/pifs_metrics.rb +9 -0
- data/lib/fog/compute/xen_server/models/pool.rb +47 -0
- data/lib/fog/compute/xen_server/models/pool_patch.rb +27 -0
- data/lib/fog/compute/xen_server/models/pool_patchs.rb +11 -0
- data/lib/fog/compute/xen_server/models/pools.rb +11 -0
- data/lib/fog/compute/xen_server/models/role.rb +22 -0
- data/lib/fog/compute/xen_server/models/roles.rb +11 -0
- data/lib/fog/compute/xen_server/models/server.rb +203 -0
- data/lib/fog/compute/xen_server/models/server_appliance.rb +24 -0
- data/lib/fog/compute/xen_server/models/server_appliances.rb +11 -0
- data/lib/fog/compute/xen_server/models/server_metrics.rb +29 -0
- data/lib/fog/compute/xen_server/models/servers.rb +38 -0
- data/lib/fog/compute/xen_server/models/servers_metrics.rb +11 -0
- data/lib/fog/compute/xen_server/models/storage_manager.rb +30 -0
- data/lib/fog/compute/xen_server/models/storage_managers.rb +11 -0
- data/lib/fog/compute/xen_server/models/storage_repositories.rb +11 -0
- data/lib/fog/compute/xen_server/models/storage_repository.rb +77 -0
- data/lib/fog/compute/xen_server/models/tunnel.rb +23 -0
- data/lib/fog/compute/xen_server/models/tunnels.rb +11 -0
- data/lib/fog/compute/xen_server/models/vbd.rb +64 -0
- data/lib/fog/compute/xen_server/models/vbd_metrics.rb +27 -0
- data/lib/fog/compute/xen_server/models/vbds.rb +11 -0
- data/lib/fog/compute/xen_server/models/vbds_metrics.rb +11 -0
- data/lib/fog/compute/xen_server/models/vdi.rb +75 -0
- data/lib/fog/compute/xen_server/models/vdis.rb +11 -0
- data/lib/fog/compute/xen_server/models/vif.rb +53 -0
- data/lib/fog/compute/xen_server/models/vif_metrics.rb +22 -0
- data/lib/fog/compute/xen_server/models/vifs.rb +11 -0
- data/lib/fog/compute/xen_server/models/vifs_metrics.rb +11 -0
- data/lib/fog/compute/xen_server/models/vlan.rb +65 -0
- data/lib/fog/compute/xen_server/models/vlans.rb +11 -0
- data/lib/fog/compute/xen_server/models/vmpp.rb +38 -0
- data/lib/fog/compute/xen_server/models/vmpps.rb +11 -0
- data/lib/fog/compute/xen_server/models/vtpm.rb +21 -0
- data/lib/fog/compute/xen_server/models/vtpms.rb +11 -0
- data/lib/fog/compute/xen_server/real.rb +36 -0
- data/lib/fog/compute/xen_server/requests/builtin_templates.rb +21 -0
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/clone_server.rb +1 -5
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_network.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_server.rb +1 -14
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_sr.rb +1 -7
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_vbd.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_vdi.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_vif.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_vlan.rb +1 -6
- data/lib/fog/compute/xen_server/requests/custom_templates.rb +21 -0
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_network.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_server.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_sr.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_vdi.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_vif.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_vlan.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/disable_host.rb +1 -7
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/eject_vbd.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/enable_host.rb +1 -7
- data/lib/fog/compute/xen_server/requests/get_record.rb +41 -0
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/get_records.rb +1 -9
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/insert_vbd.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/provision_server.rb +1 -5
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/reboot_host.rb +2 -8
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/reboot_server.rb +2 -8
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/scan_sr.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/set_affinity.rb +1 -9
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/set_attribute.rb +1 -9
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/shutdown_host.rb +2 -8
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/shutdown_server.rb +2 -8
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/snapshot_revert.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/snapshot_server.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/start_server.rb +1 -7
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/start_vm.rb +2 -8
- data/lib/fog/compute/xen_server/requests/templates.rb +21 -0
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/unplug_pbd.rb +1 -6
- data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/unplug_vbd.rb +1 -6
- data/lib/fog/model.rb +48 -0
- data/lib/fog/parsers/xen_server.rb +15 -0
- data/lib/fog/{xenserver/parser.rb → parsers/xen_server/base.rb} +1 -3
- data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_hosts.rb +1 -4
- data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_networks.rb +1 -4
- data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_pools.rb +1 -4
- data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_records.rb +1 -4
- data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_storage_repositories.rb +1 -4
- data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_vbds.rb +2 -5
- data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_vifs.rb +2 -5
- data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_vms.rb +1 -5
- data/lib/fog/{xenserver/utilities.rb → utilities.rb} +0 -0
- data/lib/fog/{xenserver/core.rb → xen_server/connection.rb} +2 -40
- data/lib/fog/xen_server/invalid_login.rb +5 -0
- data/lib/fog/xen_server/nokogiri_stream_parser.rb +20 -0
- data/lib/fog/xen_server/not_found.rb +5 -0
- data/lib/fog/xen_server/request_failed.rb +5 -0
- data/lib/fog/xen_server/version.rb +5 -0
- data/lib/fog/xenserver.rb +27 -1
- data/lib/fog/xenserver/compute.rb +0 -176
- data/test/fog/compute/xen_server/models/blob_test.rb +40 -0
- data/test/fog/compute/xen_server/models/bond_test.rb +42 -0
- data/test/fog/compute/xen_server/models/console_test.rb +38 -0
- data/test/fog/compute/xen_server/models/crash_dump_test.rb +39 -0
- data/test/fog/compute/xen_server/models/dr_task_test.rb +35 -0
- data/test/fog/compute/xen_server/models/gpu_group_test.rb +45 -0
- data/test/fog/compute/xen_server/models/guest_metrics_test.rb +44 -0
- data/test/fog/compute/xen_server/models/host_cpu_test.rb +46 -0
- data/test/fog/compute/xen_server/models/host_crash_dump_test.rb +37 -0
- data/test/fog/compute/xen_server/models/host_metrics_test.rb +38 -0
- data/test/fog/compute/xen_server/models/host_patch_test.rb +45 -0
- data/test/fog/compute/xen_server/models/host_test.rb +102 -0
- data/test/fog/compute/xen_server/models/network_test.rb +51 -0
- data/test/fog/compute/xen_server/models/pbd_test.rb +40 -0
- data/test/fog/compute/xen_server/models/pci_test.rb +40 -0
- data/test/fog/compute/xen_server/models/pgpu_test.rb +41 -0
- data/test/fog/compute/xen_server/models/pif_metrics_test.rb +45 -0
- data/test/fog/compute/xen_server/models/pif_test.rb +81 -0
- data/test/fog/compute/xen_server/models/pool_patch_test.rb +43 -0
- data/test/fog/compute/xen_server/models/pool_test.rb +69 -0
- data/test/fog/compute/xen_server/models/role_test.rb +38 -0
- data/test/fog/compute/xen_server/models/server_appliance_test.rb +41 -0
- data/test/fog/compute/xen_server/models/server_metrics_test.rb +48 -0
- data/test/fog/compute/xen_server/models/server_test.rb +149 -0
- data/test/fog/compute/xen_server/models/storage_manger_test.rb +46 -0
- data/test/fog/compute/xen_server/models/storage_repository_test.rb +56 -0
- data/test/fog/compute/xen_server/models/tunnel_test.rb +40 -0
- data/test/fog/compute/xen_server/models/vbd_metrics_test.rb +37 -0
- data/test/fog/compute/xen_server/models/vbd_test.rb +58 -0
- data/test/fog/compute/xen_server/models/vdi_test.rb +71 -0
- data/test/fog/compute/xen_server/models/vif_metrics_test.rb +37 -0
- data/test/fog/compute/xen_server/models/vif_test.rb +59 -0
- data/test/fog/compute/xen_server/models/vlan_test.rb +40 -0
- data/test/fog/compute/xen_server/models/vmpp_test.rb +55 -0
- data/test/fog/compute/xen_server/models/vtpm_test.rb +36 -0
- data/test/minitest_helper.rb +28 -0
- metadata +239 -120
- data/lib/fog/compute.rb +0 -7
- data/lib/fog/xenserver/examples/README.md +0 -11
- data/lib/fog/xenserver/examples/chage_default_storage_repository.md +0 -99
- data/lib/fog/xenserver/examples/creating_servers.md +0 -168
- data/lib/fog/xenserver/examples/getting_started.md +0 -163
- data/lib/fog/xenserver/examples/networks-and-vlans.rb +0 -45
- data/lib/fog/xenserver/examples/storage_repositories.md +0 -94
- data/lib/fog/xenserver/models/compute/blob.rb +0 -22
- data/lib/fog/xenserver/models/compute/blobs.rb +0 -25
- data/lib/fog/xenserver/models/compute/bond.rb +0 -23
- data/lib/fog/xenserver/models/compute/bonds.rb +0 -25
- data/lib/fog/xenserver/models/compute/console.rb +0 -29
- data/lib/fog/xenserver/models/compute/consoles.rb +0 -25
- data/lib/fog/xenserver/models/compute/crash_dump.rb +0 -19
- data/lib/fog/xenserver/models/compute/crash_dumps.rb +0 -25
- data/lib/fog/xenserver/models/compute/dr_task.rb +0 -17
- data/lib/fog/xenserver/models/compute/dr_tasks.rb +0 -25
- data/lib/fog/xenserver/models/compute/gpu_group.rb +0 -22
- data/lib/fog/xenserver/models/compute/gpu_groups.rb +0 -25
- data/lib/fog/xenserver/models/compute/guest_metrics.rb +0 -29
- data/lib/fog/xenserver/models/compute/host.rb +0 -159
- data/lib/fog/xenserver/models/compute/host_cpu.rb +0 -38
- data/lib/fog/xenserver/models/compute/host_crash_dump.rb +0 -20
- data/lib/fog/xenserver/models/compute/host_crash_dumps.rb +0 -25
- data/lib/fog/xenserver/models/compute/host_metrics.rb +0 -29
- data/lib/fog/xenserver/models/compute/host_patch.rb +0 -25
- data/lib/fog/xenserver/models/compute/host_patchs.rb +0 -25
- data/lib/fog/xenserver/models/compute/hosts.rb +0 -29
- data/lib/fog/xenserver/models/compute/network.rb +0 -92
- data/lib/fog/xenserver/models/compute/networks.rb +0 -33
- data/lib/fog/xenserver/models/compute/pbd.rb +0 -40
- data/lib/fog/xenserver/models/compute/pbds.rb +0 -33
- data/lib/fog/xenserver/models/compute/pci.rb +0 -22
- data/lib/fog/xenserver/models/compute/pcis.rb +0 -25
- data/lib/fog/xenserver/models/compute/pgpu.rb +0 -20
- data/lib/fog/xenserver/models/compute/pgpus.rb +0 -25
- data/lib/fog/xenserver/models/compute/pif.rb +0 -57
- data/lib/fog/xenserver/models/compute/pif_metrics.rb +0 -28
- data/lib/fog/xenserver/models/compute/pifs.rb +0 -33
- data/lib/fog/xenserver/models/compute/pifs_metrics.rb +0 -25
- data/lib/fog/xenserver/models/compute/pool.rb +0 -79
- data/lib/fog/xenserver/models/compute/pool_patch.rb +0 -24
- data/lib/fog/xenserver/models/compute/pool_patchs.rb +0 -25
- data/lib/fog/xenserver/models/compute/pools.rb +0 -33
- data/lib/fog/xenserver/models/compute/role.rb +0 -19
- data/lib/fog/xenserver/models/compute/roles.rb +0 -25
- data/lib/fog/xenserver/models/compute/server.rb +0 -250
- data/lib/fog/xenserver/models/compute/server_appliance.rb +0 -21
- data/lib/fog/xenserver/models/compute/server_appliances.rb +0 -25
- data/lib/fog/xenserver/models/compute/servers.rb +0 -68
- data/lib/fog/xenserver/models/compute/storage_manager.rb +0 -28
- data/lib/fog/xenserver/models/compute/storage_managers.rb +0 -25
- data/lib/fog/xenserver/models/compute/storage_repositories.rb +0 -31
- data/lib/fog/xenserver/models/compute/storage_repository.rb +0 -93
- data/lib/fog/xenserver/models/compute/tunnel.rb +0 -20
- data/lib/fog/xenserver/models/compute/tunnels.rb +0 -25
- data/lib/fog/xenserver/models/compute/vbd.rb +0 -91
- data/lib/fog/xenserver/models/compute/vbd_metrics.rb +0 -27
- data/lib/fog/xenserver/models/compute/vbds.rb +0 -33
- data/lib/fog/xenserver/models/compute/vdi.rb +0 -105
- data/lib/fog/xenserver/models/compute/vdis.rb +0 -29
- data/lib/fog/xenserver/models/compute/vif.rb +0 -60
- data/lib/fog/xenserver/models/compute/vifs.rb +0 -29
- data/lib/fog/xenserver/models/compute/vlan.rb +0 -81
- data/lib/fog/xenserver/models/compute/vlans.rb +0 -39
- data/lib/fog/xenserver/models/compute/vmpp.rb +0 -35
- data/lib/fog/xenserver/models/compute/vmpps.rb +0 -25
- data/lib/fog/xenserver/models/compute/vtpm.rb +0 -18
- data/lib/fog/xenserver/models/compute/vtpms.rb +0 -25
- data/lib/fog/xenserver/requests/compute/get_record.rb +0 -29
- data/lib/fog/xenserver/version.rb +0 -5
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Parsers
|
3
3
|
module XenServer
|
4
4
|
class GetStorageRepositories < Fog::Parsers::XenServer::Base
|
5
|
-
|
6
5
|
def reset
|
7
6
|
@response = []
|
8
7
|
end
|
@@ -11,9 +10,7 @@ module Fog
|
|
11
10
|
parser = Fog::Parsers::XenServer::Base.new
|
12
11
|
data.each_pair {|reference, sr_hash| @response << parser.parse( sr_hash ).merge(:reference => reference) }
|
13
12
|
end
|
14
|
-
|
15
13
|
end
|
16
|
-
|
17
14
|
end
|
18
15
|
end
|
19
|
-
end
|
16
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Parsers
|
3
3
|
module XenServer
|
4
|
-
class
|
5
|
-
|
4
|
+
class GetVbds < Fog::Parsers::XenServer::Base
|
6
5
|
def reset
|
7
6
|
@response = []
|
8
7
|
end
|
@@ -11,9 +10,7 @@ module Fog
|
|
11
10
|
parser = Fog::Parsers::XenServer::Base.new
|
12
11
|
data.each_pair {|reference, hash| @response << parser.parse( hash ).merge(:reference => reference) }
|
13
12
|
end
|
14
|
-
|
15
13
|
end
|
16
|
-
|
17
14
|
end
|
18
15
|
end
|
19
|
-
end
|
16
|
+
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Parsers
|
3
3
|
module XenServer
|
4
|
-
class
|
5
|
-
|
4
|
+
class GetVifs < Fog::Parsers::XenServer::Base
|
6
5
|
def reset
|
7
6
|
@response = []
|
8
7
|
end
|
@@ -11,9 +10,7 @@ module Fog
|
|
11
10
|
parser = Fog::Parsers::XenServer::Base.new
|
12
11
|
data.each_pair {|reference, vif_hash| @response << parser.parse( vif_hash ).merge(:reference => reference) }
|
13
12
|
end
|
14
|
-
|
15
13
|
end
|
16
|
-
|
17
14
|
end
|
18
15
|
end
|
19
|
-
end
|
16
|
+
end
|
@@ -1,9 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Parsers
|
3
3
|
module XenServer
|
4
|
-
|
5
4
|
class GetVms < Fog::Parsers::XenServer::Base
|
6
|
-
|
7
5
|
def reset
|
8
6
|
@response = []
|
9
7
|
end
|
@@ -12,9 +10,7 @@ module Fog
|
|
12
10
|
parser = Fog::Parsers::XenServer::Base.new
|
13
11
|
data.each_pair {|reference, vm_hash| @response << parser.parse( vm_hash ).merge(:reference => reference) }
|
14
12
|
end
|
15
|
-
|
16
13
|
end
|
17
|
-
|
18
14
|
end
|
19
15
|
end
|
20
|
-
end
|
16
|
+
end
|
File without changes
|
@@ -1,19 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require 'fog/xml'
|
1
|
+
require 'xmlrpc/client'
|
3
2
|
|
4
3
|
module Fog
|
5
4
|
module XenServer
|
6
|
-
|
7
|
-
class InvalidLogin < Fog::Errors::Error; end
|
8
|
-
class NotFound < Fog::Errors::Error; end
|
9
|
-
class RequestFailed < Fog::Errors::Error; end
|
10
|
-
|
11
|
-
extend Fog::Provider
|
12
|
-
|
13
|
-
service(:compute, 'Compute')
|
14
|
-
|
15
5
|
class Connection
|
16
|
-
require 'xmlrpc/client'
|
17
6
|
|
18
7
|
def initialize(host, timeout)
|
19
8
|
@factory = XMLRPC::Client.new(host, '/')
|
@@ -53,32 +42,5 @@ module Fog
|
|
53
42
|
end
|
54
43
|
end
|
55
44
|
end
|
56
|
-
|
57
|
-
class NokogiriStreamParser < XMLRPC::XMLParser::AbstractStreamParser
|
58
|
-
|
59
|
-
def initialize
|
60
|
-
require 'nokogiri/xml/sax/document'
|
61
|
-
require 'nokogiri/xml/sax/parser'
|
62
|
-
|
63
|
-
@parser_class = Class.new(Nokogiri::XML::SAX::Document) do
|
64
|
-
|
65
|
-
include XMLRPC::XMLParser::StreamParserMixin
|
66
|
-
|
67
|
-
alias_method :start_element, :startElement
|
68
|
-
alias_method :end_element, :endElement
|
69
|
-
alias_method :characters, :character
|
70
|
-
alias_method :cdata_block, :character
|
71
|
-
|
72
|
-
def parse(str)
|
73
|
-
Nokogiri::XML::SAX::Parser.new(self).parse(str)
|
74
|
-
end
|
75
|
-
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
45
|
end
|
82
|
-
end
|
83
|
-
|
84
|
-
|
46
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'nokogiri/xml/sax/document'
|
2
|
+
require 'nokogiri/xml/sax/parser'
|
3
|
+
|
4
|
+
class NokogiriStreamParser < XMLRPC::XMLParser::AbstractStreamParser
|
5
|
+
def initialize
|
6
|
+
@parser_class = Class.new(Nokogiri::XML::SAX::Document) do
|
7
|
+
|
8
|
+
include XMLRPC::XMLParser::StreamParserMixin
|
9
|
+
|
10
|
+
alias_method :start_element, :startElement
|
11
|
+
alias_method :end_element, :endElement
|
12
|
+
alias_method :characters, :character
|
13
|
+
alias_method :cdata_block, :character
|
14
|
+
|
15
|
+
def parse(str)
|
16
|
+
Nokogiri::XML::SAX::Parser.new(self).parse(str)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/fog/xenserver.rb
CHANGED
@@ -1 +1,27 @@
|
|
1
|
-
require
|
1
|
+
require 'fog/core'
|
2
|
+
require 'fog/xml'
|
3
|
+
require 'fog/utilities'
|
4
|
+
require 'fog/model'
|
5
|
+
require 'fog/collection'
|
6
|
+
|
7
|
+
module Fog
|
8
|
+
module XenServer
|
9
|
+
autoload :Connection, 'fog/xen_server/connection'
|
10
|
+
autoload :InvalidLogin, 'fog/xen_server/invalid_login'
|
11
|
+
autoload :NokogiriStreamParser, 'fog/xen_server/nokogiri_stream_parser'
|
12
|
+
autoload :NotFound, 'fog/xen_server/not_found'
|
13
|
+
autoload :RequestFailed, 'fog/xen_server/request_failed'
|
14
|
+
|
15
|
+
extend Fog::Provider
|
16
|
+
|
17
|
+
service(:compute, 'Compute')
|
18
|
+
end
|
19
|
+
|
20
|
+
module Compute
|
21
|
+
autoload :XenServer, 'fog/compute/xen_server'
|
22
|
+
end
|
23
|
+
|
24
|
+
module Parsers
|
25
|
+
autoload :XenServer, 'fog/parsers/xen_server'
|
26
|
+
end
|
27
|
+
end
|
@@ -1,176 +0,0 @@
|
|
1
|
-
require 'fog/xenserver/core'
|
2
|
-
|
3
|
-
module Fog
|
4
|
-
module Compute
|
5
|
-
class XenServer < Fog::Service
|
6
|
-
|
7
|
-
require 'fog/xenserver/utilities'
|
8
|
-
require 'fog/xenserver/parser'
|
9
|
-
|
10
|
-
requires :xenserver_username
|
11
|
-
requires :xenserver_password
|
12
|
-
requires :xenserver_url
|
13
|
-
recognizes :xenserver_defaults
|
14
|
-
recognizes :xenserver_timeout
|
15
|
-
|
16
|
-
model_path 'fog/xenserver/models/compute'
|
17
|
-
model :blob
|
18
|
-
collection :blobs
|
19
|
-
model :bond
|
20
|
-
collection :bonds
|
21
|
-
model :crash_dump
|
22
|
-
collection :crash_dumps
|
23
|
-
model :dr_task
|
24
|
-
collection :dr_tasks
|
25
|
-
model :gpu_group
|
26
|
-
collection :gpu_groups
|
27
|
-
model :host_crash_dump
|
28
|
-
collection :host_crash_dumps
|
29
|
-
model :host_patch
|
30
|
-
collection :host_patchs
|
31
|
-
model :pci
|
32
|
-
collection :pcis
|
33
|
-
model :pgpu
|
34
|
-
collection :pgpus
|
35
|
-
model :pif_metrics
|
36
|
-
collection :pifs_metrics
|
37
|
-
model :pool_patch
|
38
|
-
collection :pool_patchs
|
39
|
-
model :role
|
40
|
-
collection :roles
|
41
|
-
model :server
|
42
|
-
collection :servers
|
43
|
-
model :server_appliance
|
44
|
-
collection :server_appliances
|
45
|
-
model :storage_manager
|
46
|
-
collection :storage_managers
|
47
|
-
model :tunnel
|
48
|
-
collection :tunnels
|
49
|
-
model :vmpp
|
50
|
-
collection :vmpps
|
51
|
-
model :vtpm
|
52
|
-
collection :vtpms
|
53
|
-
model :host
|
54
|
-
collection :hosts
|
55
|
-
collection :vifs
|
56
|
-
model :vif
|
57
|
-
collection :storage_repositories
|
58
|
-
model :storage_repository
|
59
|
-
collection :pools
|
60
|
-
model :pool
|
61
|
-
collection :vbds
|
62
|
-
model :vbd
|
63
|
-
collection :vdis
|
64
|
-
model :vdi
|
65
|
-
collection :networks
|
66
|
-
model :network
|
67
|
-
collection :pifs
|
68
|
-
model :pif
|
69
|
-
collection :pbds
|
70
|
-
model :pbd
|
71
|
-
model :guest_metrics
|
72
|
-
model :vbd_metrics
|
73
|
-
model :host_metrics
|
74
|
-
model :host_cpu
|
75
|
-
model :vlan
|
76
|
-
collection :vlans
|
77
|
-
model :console
|
78
|
-
collection :consoles
|
79
|
-
|
80
|
-
request_path 'fog/xenserver/requests/compute'
|
81
|
-
request :create_server
|
82
|
-
request :create_vif
|
83
|
-
request :create_vdi
|
84
|
-
request :create_vbd
|
85
|
-
request :destroy_vif
|
86
|
-
request :clone_server
|
87
|
-
request :destroy_server
|
88
|
-
request :unplug_vbd
|
89
|
-
request :eject_vbd
|
90
|
-
request :insert_vbd
|
91
|
-
request :destroy_vdi
|
92
|
-
request :shutdown_server
|
93
|
-
request :start_vm
|
94
|
-
request :start_server
|
95
|
-
request :get_record
|
96
|
-
request :get_records
|
97
|
-
request :set_affinity
|
98
|
-
request :set_attribute
|
99
|
-
request :reboot_server
|
100
|
-
request :provision_server
|
101
|
-
request :scan_sr
|
102
|
-
request :unplug_pbd
|
103
|
-
request :destroy_sr
|
104
|
-
request :create_sr
|
105
|
-
request :reboot_host
|
106
|
-
request :disable_host
|
107
|
-
request :enable_host
|
108
|
-
request :shutdown_host
|
109
|
-
request :create_network
|
110
|
-
request :destroy_network
|
111
|
-
request :create_vlan
|
112
|
-
request :destroy_vlan
|
113
|
-
request :snapshot_server
|
114
|
-
request :snapshot_revert
|
115
|
-
|
116
|
-
class Real
|
117
|
-
|
118
|
-
def initialize(options={})
|
119
|
-
@host = options[:xenserver_url]
|
120
|
-
@username = options[:xenserver_username]
|
121
|
-
@password = options[:xenserver_password]
|
122
|
-
@defaults = options[:xenserver_defaults] || {}
|
123
|
-
@timeout = options[:xenserver_timeout] || 30
|
124
|
-
@connection = Fog::XenServer::Connection.new(@host, @timeout)
|
125
|
-
@connection.authenticate(@username, @password)
|
126
|
-
end
|
127
|
-
|
128
|
-
def reload
|
129
|
-
@connection.authenticate(@username, @password)
|
130
|
-
end
|
131
|
-
|
132
|
-
def default_template=(name)
|
133
|
-
@defaults[:template] = name
|
134
|
-
end
|
135
|
-
|
136
|
-
def default_template
|
137
|
-
return nil if @defaults[:template].nil?
|
138
|
-
(servers.custom_templates + servers.builtin_templates).find do |s|
|
139
|
-
(s.name == @defaults[:template]) or (s.uuid == @defaults[:template])
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
def default_network
|
144
|
-
networks.find { |n| n.name == (@defaults[:network] || "Pool-wide network associated with eth0") }
|
145
|
-
end
|
146
|
-
|
147
|
-
end
|
148
|
-
|
149
|
-
class Mock
|
150
|
-
|
151
|
-
def self.data
|
152
|
-
@data ||= Hash.new do |hash, key|
|
153
|
-
hash[key] = {}
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def self.reset_data(keys=data.keys)
|
158
|
-
for key in [*keys]
|
159
|
-
data.delete(key)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
def initialize(options={})
|
164
|
-
@host = options[:xenserver_pool_master]
|
165
|
-
@username = options[:xenserver_username]
|
166
|
-
@password = options[:xenserver_password]
|
167
|
-
@connection = Fog::XML::Connection.new(@host)
|
168
|
-
@connection.authenticate(@username, @password)
|
169
|
-
end
|
170
|
-
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Fog::Compute::XenServer::Models::Blob do
|
4
|
+
let(:blob_class) do
|
5
|
+
class Fog::Compute::XenServer::Models::Blob
|
6
|
+
def self.read_identity
|
7
|
+
instance_variable_get('@identity')
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.read_provider_class
|
11
|
+
instance_variable_get('@provider_class')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
Fog::Compute::XenServer::Models::Blob
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should associate to a provider class' do
|
18
|
+
blob_class.read_provider_class.must_equal('blob')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should have an unique id' do
|
22
|
+
blob_class.read_identity.must_equal(:reference)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should have 8 attributes' do
|
26
|
+
blob_class.attributes.must_equal([ :reference,
|
27
|
+
:description,
|
28
|
+
:last_updated,
|
29
|
+
:mime_type,
|
30
|
+
:name,
|
31
|
+
:public,
|
32
|
+
:size,
|
33
|
+
:uuid ])
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should have 2 aliases' do
|
37
|
+
blob_class.aliases.must_equal({ :name_description => :description,
|
38
|
+
:name_label => :name })
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'minitest_helper'
|
2
|
+
|
3
|
+
describe Fog::Compute::XenServer::Models::Bond do
|
4
|
+
let(:bond_class) do
|
5
|
+
class Fog::Compute::XenServer::Models::Bond
|
6
|
+
def self.read_identity
|
7
|
+
instance_variable_get('@identity')
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.read_provider_class
|
11
|
+
instance_variable_get('@provider_class')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
Fog::Compute::XenServer::Models::Bond
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should associate to a provider class' do
|
18
|
+
bond_class.read_provider_class.must_equal('Bond')
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should have an unique id' do
|
22
|
+
bond_class.read_identity.must_equal(:reference)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should have 9 attributes' do
|
26
|
+
bond_class.attributes.must_equal([ :reference,
|
27
|
+
:links_up,
|
28
|
+
:mode,
|
29
|
+
:other_config,
|
30
|
+
:properties,
|
31
|
+
:uuid,
|
32
|
+
:__master,
|
33
|
+
:__primary_slave,
|
34
|
+
:__slaves ])
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should have 3 aliases' do
|
38
|
+
bond_class.aliases.must_equal({ :master => :__master,
|
39
|
+
:primary_slave => :__primary_slave,
|
40
|
+
:slaves => :__slaves })
|
41
|
+
end
|
42
|
+
end
|