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.
Files changed (252) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +27 -0
  3. data/.travis.yml +19 -0
  4. data/CONTRIBUTING.md +6 -6
  5. data/Gemfile +1 -1
  6. data/LICENSE.md +1 -1
  7. data/README.md +3 -1
  8. data/Rakefile +10 -1
  9. data/fog-xenserver.gemspec +6 -4
  10. data/gemfiles/Gemfile.1.8.7 +7 -0
  11. data/gemfiles/Gemfile.1.9.2+ +6 -0
  12. data/lib/fog.rb +1 -1
  13. data/lib/fog/collection.rb +37 -0
  14. data/lib/fog/compute/xen_server.rb +132 -0
  15. data/lib/fog/compute/xen_server/mock.rb +27 -0
  16. data/lib/fog/compute/xen_server/models.rb +78 -0
  17. data/lib/fog/compute/xen_server/models/blob.rb +24 -0
  18. data/lib/fog/compute/xen_server/models/blobs.rb +11 -0
  19. data/lib/fog/compute/xen_server/models/bond.rb +26 -0
  20. data/lib/fog/compute/xen_server/models/bonds.rb +11 -0
  21. data/lib/fog/compute/xen_server/models/console.rb +23 -0
  22. data/lib/fog/compute/xen_server/models/consoles.rb +11 -0
  23. data/lib/fog/compute/xen_server/models/crash_dump.rb +22 -0
  24. data/lib/fog/compute/xen_server/models/crash_dumps.rb +11 -0
  25. data/lib/fog/compute/xen_server/models/dr_task.rb +20 -0
  26. data/lib/fog/compute/xen_server/models/dr_tasks.rb +11 -0
  27. data/lib/fog/compute/xen_server/models/gpu_group.rb +25 -0
  28. data/lib/fog/compute/xen_server/models/gpu_groups.rb +11 -0
  29. data/lib/fog/compute/xen_server/models/guest_metrics.rb +28 -0
  30. data/lib/fog/compute/xen_server/models/guests_metrics.rb +11 -0
  31. data/lib/fog/compute/xen_server/models/host.rb +121 -0
  32. data/lib/fog/compute/xen_server/models/host_cpu.rb +31 -0
  33. data/lib/fog/compute/xen_server/models/host_cpus.rb +11 -0
  34. data/lib/fog/compute/xen_server/models/host_crash_dump.rb +23 -0
  35. data/lib/fog/compute/xen_server/models/host_crash_dumps.rb +11 -0
  36. data/lib/fog/compute/xen_server/models/host_metrics.rb +28 -0
  37. data/lib/fog/compute/xen_server/models/host_patch.rb +28 -0
  38. data/lib/fog/compute/xen_server/models/host_patchs.rb +11 -0
  39. data/lib/fog/compute/xen_server/models/hosts.rb +11 -0
  40. data/lib/fog/compute/xen_server/models/hosts_metrics.rb +11 -0
  41. data/lib/fog/compute/xen_server/models/network.rb +65 -0
  42. data/lib/fog/compute/xen_server/models/networks.rb +11 -0
  43. data/lib/fog/compute/xen_server/models/pbd.rb +30 -0
  44. data/lib/fog/compute/xen_server/models/pbds.rb +11 -0
  45. data/lib/fog/compute/xen_server/models/pci.rb +25 -0
  46. data/lib/fog/compute/xen_server/models/pcis.rb +11 -0
  47. data/lib/fog/compute/xen_server/models/pgpu.rb +23 -0
  48. data/lib/fog/compute/xen_server/models/pgpus.rb +11 -0
  49. data/lib/fog/compute/xen_server/models/pif.rb +49 -0
  50. data/lib/fog/compute/xen_server/models/pif_metrics.rb +30 -0
  51. data/lib/fog/compute/xen_server/models/pifs.rb +11 -0
  52. data/lib/fog/compute/xen_server/models/pifs_metrics.rb +9 -0
  53. data/lib/fog/compute/xen_server/models/pool.rb +47 -0
  54. data/lib/fog/compute/xen_server/models/pool_patch.rb +27 -0
  55. data/lib/fog/compute/xen_server/models/pool_patchs.rb +11 -0
  56. data/lib/fog/compute/xen_server/models/pools.rb +11 -0
  57. data/lib/fog/compute/xen_server/models/role.rb +22 -0
  58. data/lib/fog/compute/xen_server/models/roles.rb +11 -0
  59. data/lib/fog/compute/xen_server/models/server.rb +203 -0
  60. data/lib/fog/compute/xen_server/models/server_appliance.rb +24 -0
  61. data/lib/fog/compute/xen_server/models/server_appliances.rb +11 -0
  62. data/lib/fog/compute/xen_server/models/server_metrics.rb +29 -0
  63. data/lib/fog/compute/xen_server/models/servers.rb +38 -0
  64. data/lib/fog/compute/xen_server/models/servers_metrics.rb +11 -0
  65. data/lib/fog/compute/xen_server/models/storage_manager.rb +30 -0
  66. data/lib/fog/compute/xen_server/models/storage_managers.rb +11 -0
  67. data/lib/fog/compute/xen_server/models/storage_repositories.rb +11 -0
  68. data/lib/fog/compute/xen_server/models/storage_repository.rb +77 -0
  69. data/lib/fog/compute/xen_server/models/tunnel.rb +23 -0
  70. data/lib/fog/compute/xen_server/models/tunnels.rb +11 -0
  71. data/lib/fog/compute/xen_server/models/vbd.rb +64 -0
  72. data/lib/fog/compute/xen_server/models/vbd_metrics.rb +27 -0
  73. data/lib/fog/compute/xen_server/models/vbds.rb +11 -0
  74. data/lib/fog/compute/xen_server/models/vbds_metrics.rb +11 -0
  75. data/lib/fog/compute/xen_server/models/vdi.rb +75 -0
  76. data/lib/fog/compute/xen_server/models/vdis.rb +11 -0
  77. data/lib/fog/compute/xen_server/models/vif.rb +53 -0
  78. data/lib/fog/compute/xen_server/models/vif_metrics.rb +22 -0
  79. data/lib/fog/compute/xen_server/models/vifs.rb +11 -0
  80. data/lib/fog/compute/xen_server/models/vifs_metrics.rb +11 -0
  81. data/lib/fog/compute/xen_server/models/vlan.rb +65 -0
  82. data/lib/fog/compute/xen_server/models/vlans.rb +11 -0
  83. data/lib/fog/compute/xen_server/models/vmpp.rb +38 -0
  84. data/lib/fog/compute/xen_server/models/vmpps.rb +11 -0
  85. data/lib/fog/compute/xen_server/models/vtpm.rb +21 -0
  86. data/lib/fog/compute/xen_server/models/vtpms.rb +11 -0
  87. data/lib/fog/compute/xen_server/real.rb +36 -0
  88. data/lib/fog/compute/xen_server/requests/builtin_templates.rb +21 -0
  89. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/clone_server.rb +1 -5
  90. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_network.rb +1 -6
  91. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_server.rb +1 -14
  92. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_sr.rb +1 -7
  93. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_vbd.rb +1 -6
  94. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_vdi.rb +1 -6
  95. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_vif.rb +1 -6
  96. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/create_vlan.rb +1 -6
  97. data/lib/fog/compute/xen_server/requests/custom_templates.rb +21 -0
  98. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_network.rb +1 -6
  99. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_server.rb +1 -6
  100. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_sr.rb +1 -6
  101. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_vdi.rb +1 -6
  102. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_vif.rb +1 -6
  103. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/destroy_vlan.rb +1 -6
  104. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/disable_host.rb +1 -7
  105. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/eject_vbd.rb +1 -6
  106. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/enable_host.rb +1 -7
  107. data/lib/fog/compute/xen_server/requests/get_record.rb +41 -0
  108. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/get_records.rb +1 -9
  109. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/insert_vbd.rb +1 -6
  110. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/provision_server.rb +1 -5
  111. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/reboot_host.rb +2 -8
  112. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/reboot_server.rb +2 -8
  113. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/scan_sr.rb +1 -6
  114. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/set_affinity.rb +1 -9
  115. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/set_attribute.rb +1 -9
  116. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/shutdown_host.rb +2 -8
  117. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/shutdown_server.rb +2 -8
  118. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/snapshot_revert.rb +1 -6
  119. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/snapshot_server.rb +1 -6
  120. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/start_server.rb +1 -7
  121. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/start_vm.rb +2 -8
  122. data/lib/fog/compute/xen_server/requests/templates.rb +21 -0
  123. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/unplug_pbd.rb +1 -6
  124. data/lib/fog/{xenserver/requests/compute → compute/xen_server/requests}/unplug_vbd.rb +1 -6
  125. data/lib/fog/model.rb +48 -0
  126. data/lib/fog/parsers/xen_server.rb +15 -0
  127. data/lib/fog/{xenserver/parser.rb → parsers/xen_server/base.rb} +1 -3
  128. data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_hosts.rb +1 -4
  129. data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_networks.rb +1 -4
  130. data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_pools.rb +1 -4
  131. data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_records.rb +1 -4
  132. data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_storage_repositories.rb +1 -4
  133. data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_vbds.rb +2 -5
  134. data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_vifs.rb +2 -5
  135. data/lib/fog/{xenserver/parsers → parsers/xen_server}/get_vms.rb +1 -5
  136. data/lib/fog/{xenserver/utilities.rb → utilities.rb} +0 -0
  137. data/lib/fog/{xenserver/core.rb → xen_server/connection.rb} +2 -40
  138. data/lib/fog/xen_server/invalid_login.rb +5 -0
  139. data/lib/fog/xen_server/nokogiri_stream_parser.rb +20 -0
  140. data/lib/fog/xen_server/not_found.rb +5 -0
  141. data/lib/fog/xen_server/request_failed.rb +5 -0
  142. data/lib/fog/xen_server/version.rb +5 -0
  143. data/lib/fog/xenserver.rb +27 -1
  144. data/lib/fog/xenserver/compute.rb +0 -176
  145. data/test/fog/compute/xen_server/models/blob_test.rb +40 -0
  146. data/test/fog/compute/xen_server/models/bond_test.rb +42 -0
  147. data/test/fog/compute/xen_server/models/console_test.rb +38 -0
  148. data/test/fog/compute/xen_server/models/crash_dump_test.rb +39 -0
  149. data/test/fog/compute/xen_server/models/dr_task_test.rb +35 -0
  150. data/test/fog/compute/xen_server/models/gpu_group_test.rb +45 -0
  151. data/test/fog/compute/xen_server/models/guest_metrics_test.rb +44 -0
  152. data/test/fog/compute/xen_server/models/host_cpu_test.rb +46 -0
  153. data/test/fog/compute/xen_server/models/host_crash_dump_test.rb +37 -0
  154. data/test/fog/compute/xen_server/models/host_metrics_test.rb +38 -0
  155. data/test/fog/compute/xen_server/models/host_patch_test.rb +45 -0
  156. data/test/fog/compute/xen_server/models/host_test.rb +102 -0
  157. data/test/fog/compute/xen_server/models/network_test.rb +51 -0
  158. data/test/fog/compute/xen_server/models/pbd_test.rb +40 -0
  159. data/test/fog/compute/xen_server/models/pci_test.rb +40 -0
  160. data/test/fog/compute/xen_server/models/pgpu_test.rb +41 -0
  161. data/test/fog/compute/xen_server/models/pif_metrics_test.rb +45 -0
  162. data/test/fog/compute/xen_server/models/pif_test.rb +81 -0
  163. data/test/fog/compute/xen_server/models/pool_patch_test.rb +43 -0
  164. data/test/fog/compute/xen_server/models/pool_test.rb +69 -0
  165. data/test/fog/compute/xen_server/models/role_test.rb +38 -0
  166. data/test/fog/compute/xen_server/models/server_appliance_test.rb +41 -0
  167. data/test/fog/compute/xen_server/models/server_metrics_test.rb +48 -0
  168. data/test/fog/compute/xen_server/models/server_test.rb +149 -0
  169. data/test/fog/compute/xen_server/models/storage_manger_test.rb +46 -0
  170. data/test/fog/compute/xen_server/models/storage_repository_test.rb +56 -0
  171. data/test/fog/compute/xen_server/models/tunnel_test.rb +40 -0
  172. data/test/fog/compute/xen_server/models/vbd_metrics_test.rb +37 -0
  173. data/test/fog/compute/xen_server/models/vbd_test.rb +58 -0
  174. data/test/fog/compute/xen_server/models/vdi_test.rb +71 -0
  175. data/test/fog/compute/xen_server/models/vif_metrics_test.rb +37 -0
  176. data/test/fog/compute/xen_server/models/vif_test.rb +59 -0
  177. data/test/fog/compute/xen_server/models/vlan_test.rb +40 -0
  178. data/test/fog/compute/xen_server/models/vmpp_test.rb +55 -0
  179. data/test/fog/compute/xen_server/models/vtpm_test.rb +36 -0
  180. data/test/minitest_helper.rb +28 -0
  181. metadata +239 -120
  182. data/lib/fog/compute.rb +0 -7
  183. data/lib/fog/xenserver/examples/README.md +0 -11
  184. data/lib/fog/xenserver/examples/chage_default_storage_repository.md +0 -99
  185. data/lib/fog/xenserver/examples/creating_servers.md +0 -168
  186. data/lib/fog/xenserver/examples/getting_started.md +0 -163
  187. data/lib/fog/xenserver/examples/networks-and-vlans.rb +0 -45
  188. data/lib/fog/xenserver/examples/storage_repositories.md +0 -94
  189. data/lib/fog/xenserver/models/compute/blob.rb +0 -22
  190. data/lib/fog/xenserver/models/compute/blobs.rb +0 -25
  191. data/lib/fog/xenserver/models/compute/bond.rb +0 -23
  192. data/lib/fog/xenserver/models/compute/bonds.rb +0 -25
  193. data/lib/fog/xenserver/models/compute/console.rb +0 -29
  194. data/lib/fog/xenserver/models/compute/consoles.rb +0 -25
  195. data/lib/fog/xenserver/models/compute/crash_dump.rb +0 -19
  196. data/lib/fog/xenserver/models/compute/crash_dumps.rb +0 -25
  197. data/lib/fog/xenserver/models/compute/dr_task.rb +0 -17
  198. data/lib/fog/xenserver/models/compute/dr_tasks.rb +0 -25
  199. data/lib/fog/xenserver/models/compute/gpu_group.rb +0 -22
  200. data/lib/fog/xenserver/models/compute/gpu_groups.rb +0 -25
  201. data/lib/fog/xenserver/models/compute/guest_metrics.rb +0 -29
  202. data/lib/fog/xenserver/models/compute/host.rb +0 -159
  203. data/lib/fog/xenserver/models/compute/host_cpu.rb +0 -38
  204. data/lib/fog/xenserver/models/compute/host_crash_dump.rb +0 -20
  205. data/lib/fog/xenserver/models/compute/host_crash_dumps.rb +0 -25
  206. data/lib/fog/xenserver/models/compute/host_metrics.rb +0 -29
  207. data/lib/fog/xenserver/models/compute/host_patch.rb +0 -25
  208. data/lib/fog/xenserver/models/compute/host_patchs.rb +0 -25
  209. data/lib/fog/xenserver/models/compute/hosts.rb +0 -29
  210. data/lib/fog/xenserver/models/compute/network.rb +0 -92
  211. data/lib/fog/xenserver/models/compute/networks.rb +0 -33
  212. data/lib/fog/xenserver/models/compute/pbd.rb +0 -40
  213. data/lib/fog/xenserver/models/compute/pbds.rb +0 -33
  214. data/lib/fog/xenserver/models/compute/pci.rb +0 -22
  215. data/lib/fog/xenserver/models/compute/pcis.rb +0 -25
  216. data/lib/fog/xenserver/models/compute/pgpu.rb +0 -20
  217. data/lib/fog/xenserver/models/compute/pgpus.rb +0 -25
  218. data/lib/fog/xenserver/models/compute/pif.rb +0 -57
  219. data/lib/fog/xenserver/models/compute/pif_metrics.rb +0 -28
  220. data/lib/fog/xenserver/models/compute/pifs.rb +0 -33
  221. data/lib/fog/xenserver/models/compute/pifs_metrics.rb +0 -25
  222. data/lib/fog/xenserver/models/compute/pool.rb +0 -79
  223. data/lib/fog/xenserver/models/compute/pool_patch.rb +0 -24
  224. data/lib/fog/xenserver/models/compute/pool_patchs.rb +0 -25
  225. data/lib/fog/xenserver/models/compute/pools.rb +0 -33
  226. data/lib/fog/xenserver/models/compute/role.rb +0 -19
  227. data/lib/fog/xenserver/models/compute/roles.rb +0 -25
  228. data/lib/fog/xenserver/models/compute/server.rb +0 -250
  229. data/lib/fog/xenserver/models/compute/server_appliance.rb +0 -21
  230. data/lib/fog/xenserver/models/compute/server_appliances.rb +0 -25
  231. data/lib/fog/xenserver/models/compute/servers.rb +0 -68
  232. data/lib/fog/xenserver/models/compute/storage_manager.rb +0 -28
  233. data/lib/fog/xenserver/models/compute/storage_managers.rb +0 -25
  234. data/lib/fog/xenserver/models/compute/storage_repositories.rb +0 -31
  235. data/lib/fog/xenserver/models/compute/storage_repository.rb +0 -93
  236. data/lib/fog/xenserver/models/compute/tunnel.rb +0 -20
  237. data/lib/fog/xenserver/models/compute/tunnels.rb +0 -25
  238. data/lib/fog/xenserver/models/compute/vbd.rb +0 -91
  239. data/lib/fog/xenserver/models/compute/vbd_metrics.rb +0 -27
  240. data/lib/fog/xenserver/models/compute/vbds.rb +0 -33
  241. data/lib/fog/xenserver/models/compute/vdi.rb +0 -105
  242. data/lib/fog/xenserver/models/compute/vdis.rb +0 -29
  243. data/lib/fog/xenserver/models/compute/vif.rb +0 -60
  244. data/lib/fog/xenserver/models/compute/vifs.rb +0 -29
  245. data/lib/fog/xenserver/models/compute/vlan.rb +0 -81
  246. data/lib/fog/xenserver/models/compute/vlans.rb +0 -39
  247. data/lib/fog/xenserver/models/compute/vmpp.rb +0 -35
  248. data/lib/fog/xenserver/models/compute/vmpps.rb +0 -25
  249. data/lib/fog/xenserver/models/compute/vtpm.rb +0 -18
  250. data/lib/fog/xenserver/models/compute/vtpms.rb +0 -25
  251. data/lib/fog/xenserver/requests/compute/get_record.rb +0 -29
  252. data/lib/fog/xenserver/version.rb +0 -5
@@ -1,45 +0,0 @@
1
- require 'fog'
2
-
3
- #
4
- # Create the connection to the XenServer host
5
- #
6
- xenserver = Fog::Compute.new({
7
- :provider => 'XenServer',
8
- :xenserver_url => '1.2.3.4',
9
- :xenserver_username => 'root',
10
- :xenserver_password => 'secret',
11
- })
12
-
13
- # We have a bonded interface in XenServer, bond0 and
14
- # we want to add the VLANs there.
15
- # Note the VLAN ID -1, it is important since you
16
- # will problably have many PIFs with device == bond0
17
- # but we need the one without a proper VLAN ID
18
- #
19
- bondmaster_pif = xenserver.pifs.find do |pif|
20
- pif.vlan == "-1" and pif.device == "bond0"
21
- end
22
-
23
- # Another valid way of finding a PIF, without bonding
24
- # pif = xenserver.pifs.find { |pif| pif.physical and pif.device == 'eth0' }
25
-
26
- # We want to create these new VLANs
27
- vlans = [
28
- { "name" => "VLAN 44", "vlanid" => 44},
29
- { "name" => "VLAN 55", "vlanid" => 55}
30
- ]
31
-
32
-
33
- vlans.each do |vlan|
34
- # Do not create duplicated networks
35
- if xenserver.networks.find { |n| n.name == vlan['name'] }
36
- puts "Network #{vlan['name']} available, skipping"
37
- next
38
- end
39
-
40
- puts "Craeting Network #{vlan['name']}, VLAN ID #{vlan['vlanid']}"
41
- network = xenserver.networks.create :name => vlan['name']
42
- xenserver.vlans.create :tag => vlan['vlanid'],
43
- :network => network,
44
- :pif => bondmaster_pif
45
- end
@@ -1,94 +0,0 @@
1
- # Storage Repositories
2
-
3
- Official storage repository Citrix API documentation:
4
-
5
- http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/?c=SR
6
-
7
- Create the XenServer connection first, as usual:
8
-
9
- ```ruby
10
- require 'fog'
11
- require 'net/scp'
12
- require 'pp'
13
-
14
- xenserver = Fog::Compute.new({
15
- :provider => 'XenServer',
16
- :xenserver_url => 'xenserver-test',
17
- :xenserver_username => 'root',
18
- :xenserver_password => 'secret',
19
- })
20
- ```
21
-
22
- Listing the available storage repositories:
23
-
24
- ```ruby
25
- xenserver.storage_repositories
26
- ```
27
-
28
-
29
- Filter storage repositories by content type:
30
-
31
- ```ruby
32
- xenserver.storage_repositories.select { |sr| sr.content_type == 'iso' }
33
- ```
34
-
35
- Filter storage repositories by allowed operations:
36
-
37
- ```ruby
38
- rw_srs = xenserver.storage_repositories.select do |sr|
39
- # Are we allowed to create a VDI here?
40
- sr.allowed_operations.include? 'vdi_create'
41
- end
42
- ```
43
-
44
- Print some attributes of the first SR found:
45
-
46
- ```ruby
47
- sr = rw_srs.first
48
- puts sr.name
49
- puts sr.description
50
- puts sr.type
51
- puts sr.tags
52
- # in bytes
53
- puts sr.physical_size
54
- puts sr.physical_utilisation
55
- # sum of virtual_sizes of all VDIs in this storage repository (in bytes)
56
- puts sr.virtual_allocation
57
- ```
58
-
59
- List virtual disk images available and print some VDI's attributes:
60
-
61
- ```ruby
62
- sr.vdis.each do |vdi|
63
- # http://docs.vmd.citrix.com/XenServer/6.0.0/1.0/en_gb/api/?c=VDI
64
- puts vdi.uuid
65
- puts vdi.is_a_snapshot
66
- puts vdi.name
67
- # in bytes
68
- puts vdi.physical_utilisation
69
- puts vdi.virtual_size
70
- puts vdi.read_only
71
- # ["update", "resize", "destroy", "clone", "copy", "snapshot"],
72
- puts vdi.allowed_operations
73
- end
74
- ```
75
-
76
- Create a new VDI in this storage repository:
77
-
78
- ```ruby
79
- vdi = xenserver.vdis.create :name => 'super-vdi',
80
- :storage_repository => sr,
81
- :description => 'my super-vdi',
82
- :virtual_size => '1073741824' # 1 GB
83
- ```
84
-
85
- I have an ext3 storage repository and this creates a 1GB VHD file there:
86
-
87
- [root@xenserver ~]# vhd-util query -v -n /var/run/sr-mount/6edd263a-2da1-7533-840c-768417b5be25/4050057d-a3a8-4c00-8f2e-cf5531232921.vhd
88
- 1024
89
-
90
- Destroy the VDI:
91
-
92
- ```ruby
93
- vdi.destroy
94
- ```
@@ -1,22 +0,0 @@
1
- require 'fog/core/model'
2
-
3
- module Fog
4
- module Compute
5
- class XenServer
6
- class Blob < Fog::Model
7
- # API Reference here:
8
- # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=blob
9
-
10
- identity :reference
11
-
12
- attribute :last_updated
13
- attribute :mime_type
14
- attribute :description, :aliases => :name_description
15
- attribute :name, :aliases => :name_label
16
- attribute :public
17
- attribute :size
18
- attribute :uuid
19
- end
20
- end
21
- end
22
- end
@@ -1,25 +0,0 @@
1
- require 'fog/core/collection'
2
- require 'fog/xenserver/models/compute/blob'
3
-
4
- module Fog
5
- module Compute
6
- class XenServer
7
- class Blobs < Fog::Collection
8
- model Fog::Compute::XenServer::Blob
9
-
10
- def all(options={})
11
- data = service.get_records 'blob'
12
- load(data)
13
- end
14
-
15
- def get( blob_ref )
16
- if blob_ref && blob = service.get_record( blob_ref, 'blob' )
17
- new(blob)
18
- else
19
- nil
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,23 +0,0 @@
1
- require 'fog/core/model'
2
-
3
- module Fog
4
- module Compute
5
- class XenServer
6
- class Bond < Fog::Model
7
- # API Reference here:
8
- # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=Bond
9
-
10
- identity :reference
11
-
12
- attribute :links_up
13
- attribute :__master, :aliases => :master
14
- attribute :mode
15
- attribute :other_config
16
- attribute :__primary_slave, :aliases => :primary_slave
17
- attribute :properties
18
- attribute :__slaves, :aliases => :slaves
19
- attribute :uuid
20
- end
21
- end
22
- end
23
- end
@@ -1,25 +0,0 @@
1
- require 'fog/core/collection'
2
- require 'fog/xenserver/models/compute/bond'
3
-
4
- module Fog
5
- module Compute
6
- class XenServer
7
- class Bonds < Fog::Collection
8
- model Fog::Compute::XenServer::Bond
9
-
10
- def all(options={})
11
- data = service.get_records 'Bond'
12
- load(data)
13
- end
14
-
15
- def get( bond_ref )
16
- if bond_ref && bond = service.get_record( bond_ref, 'Bond' )
17
- new(bond)
18
- else
19
- nil
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,29 +0,0 @@
1
- require 'fog/core/model'
2
-
3
- module Fog
4
- module Compute
5
- class XenServer
6
- class Console < Fog::Model
7
- # API Reference here:
8
- # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=console
9
-
10
- identity :reference
11
-
12
- attribute :location
13
- attribute :other_config
14
- attribute :protocol
15
- attribute :uuid
16
- attribute :__vm, aliases: :VM
17
-
18
- def vm
19
- begin
20
- vm = service.servers.get __vm
21
- rescue Fog::XenServer::RequestFailed => e
22
- vm = nil
23
- end
24
- vm
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,25 +0,0 @@
1
- require 'fog/core/collection'
2
- require 'fog/xenserver/models/compute/console'
3
-
4
- module Fog
5
- module Compute
6
- class XenServer
7
- class Consoles < Fog::Collection
8
- model Fog::Compute::XenServer::Console
9
-
10
- def all(options={})
11
- data = service.get_records 'console'
12
- load(data)
13
- end
14
-
15
- def get( console_ref )
16
- if console_ref && console = service.get_record( console_ref, 'console' )
17
- new(console)
18
- else
19
- nil
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,19 +0,0 @@
1
- require 'fog/core/model'
2
-
3
- module Fog
4
- module Compute
5
- class XenServer
6
- class CrashDump < Fog::Model
7
- # API Reference here:
8
- # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=crashdump
9
-
10
- identity :reference
11
-
12
- attribute :other_config
13
- attribute :__vdi, :aliases => :VDI
14
- attribute :__vm, :aliases => :VM
15
- attribute :uuid
16
- end
17
- end
18
- end
19
- end
@@ -1,25 +0,0 @@
1
- require 'fog/core/collection'
2
- require 'fog/xenserver/models/compute/crash_dump'
3
-
4
- module Fog
5
- module Compute
6
- class XenServer
7
- class Bonds < Fog::Collection
8
- model Fog::Compute::XenServer::CrashDump
9
-
10
- def all(options={})
11
- data = service.get_records 'crashdump'
12
- load(data)
13
- end
14
-
15
- def get( crashdump_ref )
16
- if crashdump_ref && crashdump = service.get_record( crashdump_ref, 'crashdump' )
17
- new(crashdump)
18
- else
19
- nil
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,17 +0,0 @@
1
- require 'fog/core/model'
2
-
3
- module Fog
4
- module Compute
5
- class XenServer
6
- class DrTask < Fog::Model
7
- # API Reference here:
8
- # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=DR_task
9
-
10
- identity :reference
11
-
12
- attribute :__introduced_srs, :aliases => :introduced_SRs
13
- attribute :uuid
14
- end
15
- end
16
- end
17
- end
@@ -1,25 +0,0 @@
1
- require 'fog/core/collection'
2
- require 'fog/xenserver/models/compute/dr_task'
3
-
4
- module Fog
5
- module Compute
6
- class XenServer
7
- class DrTasks < Fog::Collection
8
- model Fog::Compute::XenServer::DrTask
9
-
10
- def all(options={})
11
- data = service.get_records 'DR_task'
12
- load(data)
13
- end
14
-
15
- def get( dr_task_ref )
16
- if dr_task_ref && dr_task = service.get_record( dr_task_ref, 'DR_task' )
17
- new(dr_task)
18
- else
19
- nil
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,22 +0,0 @@
1
- require 'fog/core/model'
2
-
3
- module Fog
4
- module Compute
5
- class XenServer
6
- class GpuGroup < Fog::Model
7
- # API Reference here:
8
- # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=GPU_group
9
-
10
- identity :reference
11
-
12
- attribute :gpu_types, :aliases => :GPU_types
13
- attribute :description, :aliases => :name_description
14
- attribute :name, :aliases => :name_label
15
- attribute :other_config
16
- attribute :__pgpus, :aliases => :PGPUs
17
- attribute :__vgpus, :aliases => :VGPUs
18
- attribute :uuid
19
- end
20
- end
21
- end
22
- end
@@ -1,25 +0,0 @@
1
- require 'fog/core/collection'
2
- require 'fog/xenserver/models/compute/gpu_group'
3
-
4
- module Fog
5
- module Compute
6
- class XenServer
7
- class GpuGroups < Fog::Collection
8
- model Fog::Compute::XenServer::GpuGroup
9
-
10
- def all(options={})
11
- data = service.get_records 'GPU_group'
12
- load(data)
13
- end
14
-
15
- def get( gpu_group_ref )
16
- if gpu_group_ref && gpu_group = service.get_record( gpu_group_ref, 'GPU_group' )
17
- new(gpu_group)
18
- else
19
- nil
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end