bosh_vcloud_cpi 0.4.9 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. data/README.md +69 -0
  2. data/lib/cloud/vcloud/cache.rb +20 -0
  3. data/lib/cloud/vcloud/cloud.rb +253 -535
  4. data/lib/cloud/vcloud/errors.rb +9 -0
  5. data/lib/cloud/vcloud/file_uploader.rb +39 -0
  6. data/lib/cloud/vcloud/steps/add_catalog_item.rb +28 -0
  7. data/lib/cloud/vcloud/steps/add_networks.rb +40 -0
  8. data/lib/cloud/vcloud/steps/attach_detach_disk.rb +15 -0
  9. data/lib/cloud/vcloud/steps/create_disk.rb +29 -0
  10. data/lib/cloud/vcloud/steps/create_media.rb +41 -0
  11. data/lib/cloud/vcloud/steps/create_template.rb +27 -0
  12. data/lib/cloud/vcloud/steps/create_update_agent_env.rb +66 -0
  13. data/lib/cloud/vcloud/steps/delete.rb +12 -0
  14. data/lib/cloud/vcloud/steps/delete_catalog_media.rb +23 -0
  15. data/lib/cloud/vcloud/steps/delete_unused_networks.rb +20 -0
  16. data/lib/cloud/vcloud/steps/discard_suspended_state.rb +15 -0
  17. data/lib/cloud/vcloud/steps/eject_catalog_media.rb +29 -0
  18. data/lib/cloud/vcloud/steps/insert_catalog_media.rb +26 -0
  19. data/lib/cloud/vcloud/steps/instantiate.rb +59 -0
  20. data/lib/cloud/vcloud/steps/load_agent_env.rb +14 -0
  21. data/lib/cloud/vcloud/steps/poweroff.rb +21 -0
  22. data/lib/cloud/vcloud/steps/poweron.rb +17 -0
  23. data/lib/cloud/vcloud/steps/reboot.rb +13 -0
  24. data/lib/cloud/vcloud/steps/recompose.rb +19 -0
  25. data/lib/cloud/vcloud/steps/reconfigure_vm.rb +35 -0
  26. data/lib/cloud/vcloud/steps/save_agent_env.rb +43 -0
  27. data/lib/cloud/vcloud/steps/stemcell_info.rb +20 -0
  28. data/lib/cloud/vcloud/steps/undeploy.rb +19 -0
  29. data/lib/cloud/vcloud/steps/upload_media_files.rb +18 -0
  30. data/lib/cloud/vcloud/steps/upload_template_files.rb +29 -0
  31. data/lib/cloud/vcloud/steps.rb +100 -0
  32. data/lib/cloud/vcloud/vcd_client.rb +284 -0
  33. data/lib/cloud/vcloud/version.rb +1 -1
  34. data/lib/cloud/vcloud/xml/constants.rb +428 -0
  35. data/lib/cloud/vcloud/xml/wrapper.rb +292 -0
  36. data/lib/cloud/vcloud/xml/wrapper_classes/admin_catalog.rb +20 -0
  37. data/lib/cloud/vcloud/xml/wrapper_classes/admin_org.rb +15 -0
  38. data/lib/cloud/vcloud/xml/wrapper_classes/catalog.rb +20 -0
  39. data/lib/cloud/vcloud/xml/wrapper_classes/catalog_item.rb +27 -0
  40. data/lib/cloud/vcloud/xml/wrapper_classes/disk.rb +42 -0
  41. data/lib/cloud/vcloud/xml/wrapper_classes/disk_attach_or_detach_params.rb +12 -0
  42. data/lib/cloud/vcloud/xml/wrapper_classes/disk_create_params.rb +47 -0
  43. data/lib/cloud/vcloud/xml/wrapper_classes/entity.rb +11 -0
  44. data/lib/cloud/vcloud/xml/wrapper_classes/file.rb +11 -0
  45. data/lib/cloud/vcloud/xml/wrapper_classes/hard_disk_item_wrapper.rb +56 -0
  46. data/lib/cloud/vcloud/xml/wrapper_classes/instantiate_vapp_template_params.rb +71 -0
  47. data/lib/cloud/vcloud/xml/wrapper_classes/ip_scope.rb +55 -0
  48. data/lib/cloud/vcloud/xml/wrapper_classes/item.rb +32 -0
  49. data/lib/cloud/vcloud/xml/wrapper_classes/link_wrapper.rb +39 -0
  50. data/lib/cloud/vcloud/xml/wrapper_classes/media.rb +57 -0
  51. data/lib/cloud/vcloud/xml/wrapper_classes/media_insert_or_eject_params.rb +17 -0
  52. data/lib/cloud/vcloud/xml/wrapper_classes/metadata_value.rb +15 -0
  53. data/lib/cloud/vcloud/xml/wrapper_classes/network.rb +15 -0
  54. data/lib/cloud/vcloud/xml/wrapper_classes/network_config.rb +27 -0
  55. data/lib/cloud/vcloud/xml/wrapper_classes/network_config_section.rb +25 -0
  56. data/lib/cloud/vcloud/xml/wrapper_classes/network_connection.rb +71 -0
  57. data/lib/cloud/vcloud/xml/wrapper_classes/network_connection_section.rb +67 -0
  58. data/lib/cloud/vcloud/xml/wrapper_classes/nic_item_wrapper.rb +89 -0
  59. data/lib/cloud/vcloud/xml/wrapper_classes/org.rb +21 -0
  60. data/lib/cloud/vcloud/xml/wrapper_classes/org_network.rb +19 -0
  61. data/lib/cloud/vcloud/xml/wrapper_classes/org_vdc_network.rb +11 -0
  62. data/lib/cloud/vcloud/xml/wrapper_classes/recompose_vapp_wrapper.rb +51 -0
  63. data/lib/cloud/vcloud/xml/wrapper_classes/session.rb +24 -0
  64. data/lib/cloud/vcloud/xml/wrapper_classes/supported_versions.rb +19 -0
  65. data/lib/cloud/vcloud/xml/wrapper_classes/task.rb +32 -0
  66. data/lib/cloud/vcloud/xml/wrapper_classes/upload_vapp_template_params.rb +11 -0
  67. data/lib/cloud/vcloud/xml/wrapper_classes/vapp.rb +77 -0
  68. data/lib/cloud/vcloud/xml/wrapper_classes/vapp_template.rb +17 -0
  69. data/lib/cloud/vcloud/xml/wrapper_classes/vcloud.rb +15 -0
  70. data/lib/cloud/vcloud/xml/wrapper_classes/vdc.rb +59 -0
  71. data/lib/cloud/vcloud/xml/wrapper_classes/vdc_storage_profile.rb +15 -0
  72. data/lib/cloud/vcloud/xml/wrapper_classes/virtual_hardware_section.rb +68 -0
  73. data/lib/cloud/vcloud/xml/wrapper_classes/vm.rb +212 -0
  74. data/lib/cloud/vcloud/xml/xml_templates/AdminAllocatedExtIpRecord.xml +1 -0
  75. data/lib/cloud/vcloud/xml/xml_templates/AdminCatalog.xml +1 -0
  76. data/lib/cloud/vcloud/xml/xml_templates/AdminCatalogItemRecord.xml +1 -0
  77. data/lib/cloud/vcloud/xml/xml_templates/AdminCatalogRecord.xml +1 -0
  78. data/lib/cloud/vcloud/xml/xml_templates/AdminGroupRecord.xml +1 -0
  79. data/lib/cloud/vcloud/xml/xml_templates/AdminMediaRecord.xml +1 -0
  80. data/lib/cloud/vcloud/xml/xml_templates/AdminOrg.xml +1 -0
  81. data/lib/cloud/vcloud/xml/xml_templates/AdminOrgNetworkRecord.xml +1 -0
  82. data/lib/cloud/vcloud/xml/xml_templates/AdminShadowVmRecord.xml +1 -0
  83. data/lib/cloud/vcloud/xml/xml_templates/AdminTaskRecord.xml +1 -0
  84. data/lib/cloud/vcloud/xml/xml_templates/AdminUserRecord.xml +1 -0
  85. data/lib/cloud/vcloud/xml/xml_templates/AdminVAppNetworkRecord.xml +1 -0
  86. data/lib/cloud/vcloud/xml/xml_templates/AdminVAppRecord.xml +1 -0
  87. data/lib/cloud/vcloud/xml/xml_templates/AdminVAppReference.xml +1 -0
  88. data/lib/cloud/vcloud/xml/xml_templates/AdminVAppReferences.xml +1 -0
  89. data/lib/cloud/vcloud/xml/xml_templates/AdminVAppTemplateRecord.xml +1 -0
  90. data/lib/cloud/vcloud/xml/xml_templates/AdminVdc.xml +1 -0
  91. data/lib/cloud/vcloud/xml/xml_templates/AdminVdcRecord.xml +1 -0
  92. data/lib/cloud/vcloud/xml/xml_templates/AdminVdcReference.xml +1 -0
  93. data/lib/cloud/vcloud/xml/xml_templates/AdminVdcReferences.xml +1 -0
  94. data/lib/cloud/vcloud/xml/xml_templates/AdminVmRecord.xml +1 -0
  95. data/lib/cloud/vcloud/xml/xml_templates/AllEULAsAccepted.xml +1 -0
  96. data/lib/cloud/vcloud/xml/xml_templates/AllocatedExtIpRecord.xml +1 -0
  97. data/lib/cloud/vcloud/xml/xml_templates/BlockingTaskRecord.xml +1 -0
  98. data/lib/cloud/vcloud/xml/xml_templates/BlockingTaskReference.xml +1 -0
  99. data/lib/cloud/vcloud/xml/xml_templates/BlockingTaskReferences.xml +1 -0
  100. data/lib/cloud/vcloud/xml/xml_templates/CaptureVAppParams.xml +1 -0
  101. data/lib/cloud/vcloud/xml/xml_templates/Catalog.xml +1 -0
  102. data/lib/cloud/vcloud/xml/xml_templates/CatalogItem.xml +1 -0
  103. data/lib/cloud/vcloud/xml/xml_templates/CatalogItemRecord.xml +1 -0
  104. data/lib/cloud/vcloud/xml/xml_templates/CatalogItemReference.xml +1 -0
  105. data/lib/cloud/vcloud/xml/xml_templates/CatalogItemReferences.xml +1 -0
  106. data/lib/cloud/vcloud/xml/xml_templates/CatalogRecord.xml +1 -0
  107. data/lib/cloud/vcloud/xml/xml_templates/CatalogReference.xml +1 -0
  108. data/lib/cloud/vcloud/xml/xml_templates/CatalogReferences.xml +1 -0
  109. data/lib/cloud/vcloud/xml/xml_templates/CellRecord.xml +1 -0
  110. data/lib/cloud/vcloud/xml/xml_templates/CloneMediaParams.xml +1 -0
  111. data/lib/cloud/vcloud/xml/xml_templates/CloneVAppParams.xml +1 -0
  112. data/lib/cloud/vcloud/xml/xml_templates/CloneVAppTemplateParams.xml +1 -0
  113. data/lib/cloud/vcloud/xml/xml_templates/ComposeVAppParams.xml +17 -0
  114. data/lib/cloud/vcloud/xml/xml_templates/ControlAccessParams.xml +1 -0
  115. data/lib/cloud/vcloud/xml/xml_templates/CustomizationSection.xml +1 -0
  116. data/lib/cloud/vcloud/xml/xml_templates/DatastoreProviderVdcRelationRecord.xml +1 -0
  117. data/lib/cloud/vcloud/xml/xml_templates/DatastoreRecord.xml +1 -0
  118. data/lib/cloud/vcloud/xml/xml_templates/DatastoreReference.xml +1 -0
  119. data/lib/cloud/vcloud/xml/xml_templates/DatastoreReferences.xml +1 -0
  120. data/lib/cloud/vcloud/xml/xml_templates/DeployVAppParams.xml +1 -0
  121. data/lib/cloud/vcloud/xml/xml_templates/DhcpService.xml +1 -0
  122. data/lib/cloud/vcloud/xml/xml_templates/DiskAttachOrDetachParams.xml +5 -0
  123. data/lib/cloud/vcloud/xml/xml_templates/DiskCreateParams.xml +9 -0
  124. data/lib/cloud/vcloud/xml/xml_templates/DvSwitchRecord.xml +1 -0
  125. data/lib/cloud/vcloud/xml/xml_templates/Entity.xml +1 -0
  126. data/lib/cloud/vcloud/xml/xml_templates/Error.xml +1 -0
  127. data/lib/cloud/vcloud/xml/xml_templates/EventRecord.xml +1 -0
  128. data/lib/cloud/vcloud/xml/xml_templates/ExternalNetwork.xml +1 -0
  129. data/lib/cloud/vcloud/xml/xml_templates/File.xml +1 -0
  130. data/lib/cloud/vcloud/xml/xml_templates/FirewallService.xml +1 -0
  131. data/lib/cloud/vcloud/xml/xml_templates/GeneralOrgSettings.xml +1 -0
  132. data/lib/cloud/vcloud/xml/xml_templates/Group.xml +1 -0
  133. data/lib/cloud/vcloud/xml/xml_templates/GroupRecord.xml +1 -0
  134. data/lib/cloud/vcloud/xml/xml_templates/GroupReference.xml +1 -0
  135. data/lib/cloud/vcloud/xml/xml_templates/GroupReferences.xml +1 -0
  136. data/lib/cloud/vcloud/xml/xml_templates/GuestCustomizationSection.xml +1 -0
  137. data/lib/cloud/vcloud/xml/xml_templates/HostRecord.xml +1 -0
  138. data/lib/cloud/vcloud/xml/xml_templates/HostReference.xml +1 -0
  139. data/lib/cloud/vcloud/xml/xml_templates/HostReferences.xml +1 -0
  140. data/lib/cloud/vcloud/xml/xml_templates/InstantiateOvfParams.xml +1 -0
  141. data/lib/cloud/vcloud/xml/xml_templates/InstantiateVAppTemplateParams.xml +1 -0
  142. data/lib/cloud/vcloud/xml/xml_templates/IpScope.xml +12 -0
  143. data/lib/cloud/vcloud/xml/xml_templates/IpsecVpnLocalPeer.xml +1 -0
  144. data/lib/cloud/vcloud/xml/xml_templates/IpsecVpnPeer.xml +1 -0
  145. data/lib/cloud/vcloud/xml/xml_templates/IpsecVpnRemotePeer.xml +1 -0
  146. data/lib/cloud/vcloud/xml/xml_templates/IpsecVpnService.xml +1 -0
  147. data/lib/cloud/vcloud/xml/xml_templates/IpsecVpnThirdPartyPeer.xml +1 -0
  148. data/lib/cloud/vcloud/xml/xml_templates/Item.xml +3 -0
  149. data/lib/cloud/vcloud/xml/xml_templates/ItemVcd.xml +5 -0
  150. data/lib/cloud/vcloud/xml/xml_templates/LeaseSettingsSection.xml +1 -0
  151. data/lib/cloud/vcloud/xml/xml_templates/Link.xml +1 -0
  152. data/lib/cloud/vcloud/xml/xml_templates/Media.xml +5 -0
  153. data/lib/cloud/vcloud/xml/xml_templates/MediaInsertOrEjectParams.xml +4 -0
  154. data/lib/cloud/vcloud/xml/xml_templates/MediaRecord.xml +1 -0
  155. data/lib/cloud/vcloud/xml/xml_templates/MediaReference.xml +1 -0
  156. data/lib/cloud/vcloud/xml/xml_templates/MediaReferences.xml +1 -0
  157. data/lib/cloud/vcloud/xml/xml_templates/Metadata.xml +5 -0
  158. data/lib/cloud/vcloud/xml/xml_templates/MetadataEntry.xml +7 -0
  159. data/lib/cloud/vcloud/xml/xml_templates/MetadataValue.xml +8 -0
  160. data/lib/cloud/vcloud/xml/xml_templates/NatService.xml +1 -0
  161. data/lib/cloud/vcloud/xml/xml_templates/Network.xml +4 -0
  162. data/lib/cloud/vcloud/xml/xml_templates/NetworkAssignment.xml +1 -0
  163. data/lib/cloud/vcloud/xml/xml_templates/NetworkConfig.xml +21 -0
  164. data/lib/cloud/vcloud/xml/xml_templates/NetworkConfigSection.xml +1 -0
  165. data/lib/cloud/vcloud/xml/xml_templates/NetworkConnection.xml +11 -0
  166. data/lib/cloud/vcloud/xml/xml_templates/NetworkConnectionSection.xml +1 -0
  167. data/lib/cloud/vcloud/xml/xml_templates/NetworkPoolRecord.xml +1 -0
  168. data/lib/cloud/vcloud/xml/xml_templates/NetworkPoolReference.xml +1 -0
  169. data/lib/cloud/vcloud/xml/xml_templates/NetworkPoolReferences.xml +1 -0
  170. data/lib/cloud/vcloud/xml/xml_templates/NetworkRecord.xml +1 -0
  171. data/lib/cloud/vcloud/xml/xml_templates/NetworkReference.xml +1 -0
  172. data/lib/cloud/vcloud/xml/xml_templates/NetworkReferences.xml +1 -0
  173. data/lib/cloud/vcloud/xml/xml_templates/NetworkService.xml +1 -0
  174. data/lib/cloud/vcloud/xml/xml_templates/Org.xml +1 -0
  175. data/lib/cloud/vcloud/xml/xml_templates/OrgEmailSettings.xml +1 -0
  176. data/lib/cloud/vcloud/xml/xml_templates/OrgList.xml +1 -0
  177. data/lib/cloud/vcloud/xml/xml_templates/OrgNetwork.xml +1 -0
  178. data/lib/cloud/vcloud/xml/xml_templates/OrgNetworkRecord.xml +1 -0
  179. data/lib/cloud/vcloud/xml/xml_templates/OrgNetworkReference.xml +1 -0
  180. data/lib/cloud/vcloud/xml/xml_templates/OrgNetworkReferences.xml +1 -0
  181. data/lib/cloud/vcloud/xml/xml_templates/OrgPasswordPolicySettings.xml +1 -0
  182. data/lib/cloud/vcloud/xml/xml_templates/OrgRecord.xml +1 -0
  183. data/lib/cloud/vcloud/xml/xml_templates/OrgReference.xml +1 -0
  184. data/lib/cloud/vcloud/xml/xml_templates/OrgReferences.xml +1 -0
  185. data/lib/cloud/vcloud/xml/xml_templates/OrgSettings.xml +1 -0
  186. data/lib/cloud/vcloud/xml/xml_templates/OrgVAppTemplateLeaseSettings.xml +1 -0
  187. data/lib/cloud/vcloud/xml/xml_templates/OrgVdcNetwork.xml +1 -0
  188. data/lib/cloud/vcloud/xml/xml_templates/OrgVdcRecord.xml +1 -0
  189. data/lib/cloud/vcloud/xml/xml_templates/OrgVdcReference.xml +1 -0
  190. data/lib/cloud/vcloud/xml/xml_templates/OrgVdcReferences.xml +1 -0
  191. data/lib/cloud/vcloud/xml/xml_templates/OrgVdcResourcePoolRelationRecord.xml +1 -0
  192. data/lib/cloud/vcloud/xml/xml_templates/Owner.xml +1 -0
  193. data/lib/cloud/vcloud/xml/xml_templates/PortgroupRecord.xml +1 -0
  194. data/lib/cloud/vcloud/xml/xml_templates/ProductSectionList.xml +1 -0
  195. data/lib/cloud/vcloud/xml/xml_templates/ProviderVdc.xml +1 -0
  196. data/lib/cloud/vcloud/xml/xml_templates/ProviderVdcResourcePoolRelationRecord.xml +1 -0
  197. data/lib/cloud/vcloud/xml/xml_templates/PublishCatalogParams.xml +1 -0
  198. data/lib/cloud/vcloud/xml/xml_templates/QueryList.xml +1 -0
  199. data/lib/cloud/vcloud/xml/xml_templates/QueryResultRecords.xml +1 -0
  200. data/lib/cloud/vcloud/xml/xml_templates/RasdItemsList.xml +1 -0
  201. data/lib/cloud/vcloud/xml/xml_templates/RecomposeVAppParams.xml +17 -0
  202. data/lib/cloud/vcloud/xml/xml_templates/Record.xml +1 -0
  203. data/lib/cloud/vcloud/xml/xml_templates/Reference.xml +1 -0
  204. data/lib/cloud/vcloud/xml/xml_templates/References.xml +1 -0
  205. data/lib/cloud/vcloud/xml/xml_templates/RelocateParams.xml +1 -0
  206. data/lib/cloud/vcloud/xml/xml_templates/ResourceEntity.xml +1 -0
  207. data/lib/cloud/vcloud/xml/xml_templates/ResourcePoolRecord.xml +1 -0
  208. data/lib/cloud/vcloud/xml/xml_templates/Right.xml +1 -0
  209. data/lib/cloud/vcloud/xml/xml_templates/RightRecord.xml +1 -0
  210. data/lib/cloud/vcloud/xml/xml_templates/RightReference.xml +1 -0
  211. data/lib/cloud/vcloud/xml/xml_templates/RightReferences.xml +1 -0
  212. data/lib/cloud/vcloud/xml/xml_templates/Role.xml +1 -0
  213. data/lib/cloud/vcloud/xml/xml_templates/RoleRecord.xml +1 -0
  214. data/lib/cloud/vcloud/xml/xml_templates/RoleReference.xml +1 -0
  215. data/lib/cloud/vcloud/xml/xml_templates/RoleReferences.xml +1 -0
  216. data/lib/cloud/vcloud/xml/xml_templates/RuntimeInfoSection.xml +1 -0
  217. data/lib/cloud/vcloud/xml/xml_templates/ScreenTicket.xml +1 -0
  218. data/lib/cloud/vcloud/xml/xml_templates/Session.xml +1 -0
  219. data/lib/cloud/vcloud/xml/xml_templates/ShadowVMReferences.xml +1 -0
  220. data/lib/cloud/vcloud/xml/xml_templates/StaticRoutingService.xml +1 -0
  221. data/lib/cloud/vcloud/xml/xml_templates/StrandedUserRecord.xml +1 -0
  222. data/lib/cloud/vcloud/xml/xml_templates/Task.xml +0 -0
  223. data/lib/cloud/vcloud/xml/xml_templates/TaskRecord.xml +1 -0
  224. data/lib/cloud/vcloud/xml/xml_templates/TaskReference.xml +1 -0
  225. data/lib/cloud/vcloud/xml/xml_templates/TaskReferences.xml +1 -0
  226. data/lib/cloud/vcloud/xml/xml_templates/TasksList.xml +1 -0
  227. data/lib/cloud/vcloud/xml/xml_templates/UndeployVAppParams.xml +1 -0
  228. data/lib/cloud/vcloud/xml/xml_templates/UploadVAppTemplateParams.xml +1 -0
  229. data/lib/cloud/vcloud/xml/xml_templates/User.xml +1 -0
  230. data/lib/cloud/vcloud/xml/xml_templates/UserRecord.xml +1 -0
  231. data/lib/cloud/vcloud/xml/xml_templates/UserReference.xml +1 -0
  232. data/lib/cloud/vcloud/xml/xml_templates/UserReferences.xml +1 -0
  233. data/lib/cloud/vcloud/xml/xml_templates/VApp.xml +1 -0
  234. data/lib/cloud/vcloud/xml/xml_templates/VAppLeaseSettings.xml +1 -0
  235. data/lib/cloud/vcloud/xml/xml_templates/VAppNetwork.xml +1 -0
  236. data/lib/cloud/vcloud/xml/xml_templates/VAppNetworkRecord.xml +1 -0
  237. data/lib/cloud/vcloud/xml/xml_templates/VAppNetworkReference.xml +1 -0
  238. data/lib/cloud/vcloud/xml/xml_templates/VAppNetworkReferences.xml +1 -0
  239. data/lib/cloud/vcloud/xml/xml_templates/VAppOrgNetworkRelationRecord.xml +1 -0
  240. data/lib/cloud/vcloud/xml/xml_templates/VAppOrgNetworkRelationReference.xml +1 -0
  241. data/lib/cloud/vcloud/xml/xml_templates/VAppOrgNetworkRelationReferences.xml +1 -0
  242. data/lib/cloud/vcloud/xml/xml_templates/VAppRecord.xml +1 -0
  243. data/lib/cloud/vcloud/xml/xml_templates/VAppReference.xml +1 -0
  244. data/lib/cloud/vcloud/xml/xml_templates/VAppReferences.xml +1 -0
  245. data/lib/cloud/vcloud/xml/xml_templates/VAppTemplate.xml +1 -0
  246. data/lib/cloud/vcloud/xml/xml_templates/VAppTemplateRecord.xml +1 -0
  247. data/lib/cloud/vcloud/xml/xml_templates/VAppTemplateReference.xml +1 -0
  248. data/lib/cloud/vcloud/xml/xml_templates/VAppTemplateReferences.xml +1 -0
  249. data/lib/cloud/vcloud/xml/xml_templates/VCloud.xml +1 -0
  250. data/lib/cloud/vcloud/xml/xml_templates/VMRecord.xml +1 -0
  251. data/lib/cloud/vcloud/xml/xml_templates/VMReference.xml +1 -0
  252. data/lib/cloud/vcloud/xml/xml_templates/VMReferences.xml +1 -0
  253. data/lib/cloud/vcloud/xml/xml_templates/VMWProviderVdcRecord.xml +1 -0
  254. data/lib/cloud/vcloud/xml/xml_templates/VMWProviderVdcReference.xml +1 -0
  255. data/lib/cloud/vcloud/xml/xml_templates/VMWProviderVdcReferences.xml +1 -0
  256. data/lib/cloud/vcloud/xml/xml_templates/Vdc.xml +1 -0
  257. data/lib/cloud/vcloud/xml/xml_templates/VdcReferences.xml +1 -0
  258. data/lib/cloud/vcloud/xml/xml_templates/VdcStorageProfile.xml +1 -0
  259. data/lib/cloud/vcloud/xml/xml_templates/VirtualCenterRecord.xml +1 -0
  260. data/lib/cloud/vcloud/xml/xml_templates/VirtualCenterReference.xml +1 -0
  261. data/lib/cloud/vcloud/xml/xml_templates/VirtualCenterReferences.xml +1 -0
  262. data/lib/cloud/vcloud/xml/xml_templates/Vm.xml +1 -0
  263. data/lib/cloud/vcloud/xml/xml_templates/VmPendingQuestion.xml +1 -0
  264. data/lib/cloud/vcloud/xml/xml_templates/VmQuestionAnswer.xml +1 -0
  265. data/lib/cloud/vcloud/xml/xml_templates/generate_dictionary.rb +8 -0
  266. data/lib/cloud/vcloud.rb +3 -7
  267. metadata +384 -88
  268. data/README +0 -26
  269. data/Rakefile +0 -50
  270. data/lib/cloud/vcloud/const.rb +0 -27
  271. data/lib/cloud/vcloud/util.rb +0 -23
  272. data/spec/assets/test-deployment-manifest.yml +0 -183
  273. data/spec/assets/test-director-config.yml +0 -73
  274. data/spec/assets/valid_stemcell.tgz +0 -0
  275. data/spec/spec_helper.rb +0 -135
  276. data/spec/unit/cloud_spec.rb +0 -506
@@ -1,506 +0,0 @@
1
- require File.dirname(__FILE__) + "/../spec_helper"
2
- require "yaml"
3
-
4
- module VCloudCloud
5
- module UnitTest
6
- AGENT_ENV = %q[{"vm":{"name":"vm-8715dc0d-0270-4679-8429-6b90090bab58","id":
7
- "vm-793"},"agent_id":"1a8ad1aa-4b28-4483-be81-9c45f1d2f071","networks":{
8
- "default":{"ip":"10.147.130.80","netmask":"255.255.255.192","cloud_properties":{
9
- "name":"VC-10.47.24.204-vcd-external"},"default":["dns","gateway"],"dns":[
10
- "10.147.115.1","10.147.115.2"],"gateway":"10.147.130.126","mac":
11
- "00:50:56:9a:44:d8"}},"disks":{"system":0,"persistent":{}},"ntp":[
12
- "ntp01.las01.emcatmos.com"],"blobstore":{"plugin":"simple","properties":{
13
- "endpoint":"http://10.147.130.68:25250","user":"agent","password":"Ag3Nt"}},
14
- "mbus":"nats://bosh:b0$H@10.147.130.68:4222","env":{}}]
15
- AGENT_ENV_WITH_PERSITENT_DISK = %q[{"vm":{"name":
16
- "vm-8715dc0d-0270-4679-8429-6b90090bab58","id":"vm-793"},"agent_id":
17
- "1a8ad1aa-4b28-4483-be81-9c45f1d2f071","networks":{"default":{
18
- "ip":"10.147.130.80","netmask":"255.255.255.192","cloud_properties":{"name":
19
- "VC-10.47.24.204-vcd-external"},"default":["dns","gateway"],"dns":[
20
- "10.147.115.1","10.147.115.2"],"gateway":"10.147.130.126","mac":
21
- "00:50:56:9a:44:d8"}},"disks":{"system":0,"ephemeral":1, "persistent":{
22
- "test_disk":1}},"ntp":["ntp01.las01.emcatmos.com"],"blobstore":{"plugin":
23
- "simple","properties":{"endpoint":"http://10.147.130.68:25250","user":"agent",
24
- "password":"Ag3Nt"}},"mbus":"nats://bosh:b0$H@10.147.130.68:4222","env":{}}]
25
-
26
- class CatalogItem
27
- def urn
28
- "urn:vcloud:catalogitem:0bed5661-6fef-43e8-aaae-973783efc5cb"
29
- end
30
- end
31
-
32
- class VApp
33
- def vms
34
- @vms
35
- end
36
- def name
37
- "myTestVapp"
38
- end
39
- def initialize
40
- @vms = Array[ Vm.new ]
41
- end
42
- def urn
43
- "urn:vcloud:vapp:a1da3521-71aa-480b-97f4-2fdc2ce48569"
44
- end
45
- end
46
-
47
- class Network
48
- def initialize(name)
49
- @name = name
50
- end
51
-
52
- def [](p)
53
- @name
54
- end
55
- end
56
-
57
- class Vdc
58
- attr_accessor :name
59
-
60
- def initialize(name)
61
- @name = name
62
- end
63
-
64
- def available_networks
65
- [Network.new("a"), Network.new("vcd-org-network")]
66
- end
67
-
68
- def storage_profiles
69
- #[Network.new("a"), Network.new("vcd-org-network")]
70
- end
71
- end
72
-
73
- class Vm
74
- class Nic
75
- def network
76
- VCloudCloud::Test::test_deployment_manifest[
77
- "network"]["default"]["cloud_properties"]["name"]
78
- end
79
- def mac_address
80
- "00:50:56:de:ad:ff"
81
- end
82
- end
83
-
84
- class HardDisk
85
- attr_accessor :disk_id
86
-
87
- def initialize(disk_id)
88
- @disk_id = disk_id
89
- end
90
-
91
- def urn
92
- "urn:vcloud:disk:a1da3521-71aa-480b-97f4-2fdc2ce48569"
93
- end
94
-
95
- def size_mb
96
- 1073741824.to_i/1024/1024
97
- end
98
- end
99
-
100
- class HwSec
101
- def nics
102
- Array[ Nic.new ]
103
- end
104
- def hard_disks
105
- @disks
106
- end
107
- def initialize
108
- @disks = [ HardDisk.new(0) ]
109
- end
110
- def add_hard_disk
111
- disk = HardDisk.new(@disks.size)
112
- @disks << disk
113
- end
114
- def del_hard_disk
115
- disk = @disks.pop
116
- end
117
- end
118
-
119
- def hardware_section
120
- @hw
121
- end
122
-
123
- def urn
124
- "urn:vcloud:vm:a1da3521-71aa-480b-97f4-2fdc2ce48569"
125
- end
126
-
127
- def name
128
- "myTestVm"
129
- end
130
-
131
- def name=(value)
132
- "myTestVm"
133
- end
134
-
135
- def description=(value)
136
- "myTestVm"
137
- end
138
-
139
- def initialize
140
- @hw = HwSec.new
141
- end
142
-
143
- def add_hard_disk
144
- @hw.add_hard_disk
145
- end
146
-
147
- def del_hard_disk
148
- @hw.del_hard_disk
149
- end
150
- end
151
-
152
- end
153
- end
154
-
155
- module VCloudCloud
156
- vcd_settings = VCloudCloud::Test::vcd_settings
157
- cloud_properties = VCloudCloud::Test::director_cloud_properties
158
- test_manifest = VCloudCloud::Test::test_deployment_manifest
159
-
160
- describe Cloud, :min, :all do
161
-
162
- it "can upload a valid stemcell" do
163
- mc = mock("client")
164
- mc.should_receive(:upload_vapp_template).with(an_instance_of(String),
165
- an_instance_of(String)).and_return { UnitTest::CatalogItem.new }
166
-
167
- cloud = VCloudCloud::Cloud.new(cloud_properties)
168
- cloud.stub!(:client) { mc }
169
-
170
- cloud.create_stemcell(Test::spec_asset("valid_stemcell.tgz"), {})
171
- end
172
-
173
- it "can delete a stemcell" do
174
- mc = mock("client")
175
- mc.should_receive(:delete_catalog_vapp).with(
176
- an_instance_of(String)).and_return {}
177
-
178
- cloud= VCloudCloud::Cloud.new(cloud_properties)
179
- cloud.stub!(:client) { mc }
180
-
181
- cloud.delete_stemcell("test_stemcell_name")
182
- end
183
-
184
- it "can create a vm" do
185
- vapp = UnitTest::VApp.new
186
- mc = mock("client")
187
- mc.should_receive(:upload_vapp_template).with(an_instance_of(String),
188
- an_instance_of(String)).and_return { UnitTest::CatalogItem.new }
189
- mc.should_receive(:instantiate_vapp_template).with(an_instance_of(String),
190
- an_instance_of(String), an_instance_of(String), anything).and_return {
191
- vapp }
192
- mc.should_receive(:power_on_vapp).with(anything).and_return {}
193
- mc.should_receive(:get_ovdc).at_least(:once).with().and_return {
194
- UnitTest::Vdc.new("myOvdc") }
195
- mc.should_receive(:add_network).with(anything, anything).and_return {}
196
- mc.should_receive(:delete_networks).with(anything, anything).and_return {}
197
- mc.should_receive(:reconfigure_vm).with(anything).and_return {
198
- vapp.vms[0].add_hard_disk }
199
- mc.should_receive(:delete_catalog_media).with(
200
- an_instance_of(String)).and_return { raise VCloudSdk::CatalogMediaNotFoundError,
201
- "ISO by name not found" }
202
- mc.should_receive(:upload_catalog_media).with(
203
- an_instance_of(String), an_instance_of(String), anything).and_return {}
204
- mc.should_receive(:insert_catalog_media).with(anything,
205
- an_instance_of(String)).and_return {}
206
- mc.should_receive(:eject_catalog_media).with(anything,
207
- an_instance_of(String)).and_return {}
208
- mc.should_receive(:get_vapp).at_least(:once).with(anything).and_return {
209
- vapp }
210
- mc.should_receive(:set_metadata).with(anything, an_instance_of(String),
211
- an_instance_of(String)).and_return {}
212
-
213
- cloud = VCloudCloud::Cloud.new(cloud_properties)
214
- cloud.stub!(:client) { mc }
215
-
216
- stemcell = cloud.create_stemcell(Test::spec_asset("valid_stemcell.tgz"),
217
- {})
218
- cloud.create_vm(Test::generate_unique_name, stemcell,
219
- test_manifest["resource_pools"][0]["cloud_properties"],
220
- test_manifest["network"])
221
- end
222
-
223
- it "can create a vm with disk locality" do
224
- vapp = UnitTest::VApp.new
225
- mc = mock("client")
226
- mc.should_receive(:upload_vapp_template).with(an_instance_of(String),
227
- an_instance_of(String)).and_return { UnitTest::CatalogItem.new() }
228
- mc.should_receive(:instantiate_vapp_template).with(an_instance_of(String),
229
- an_instance_of(String), an_instance_of(String), anything).and_return {
230
- vapp }
231
- mc.should_receive(:reconfigure_vm).with(anything).and_return {
232
- vapp.vms[0].add_hard_disk }
233
- mc.should_receive(:power_on_vapp).with(anything).and_return {}
234
- mc.should_receive(:get_ovdc).at_least(:once).with().and_return {
235
- UnitTest::Vdc.new("myOvdc") }
236
- mc.should_receive(:add_network).with(anything, anything).and_return {}
237
- mc.should_receive(:delete_networks).with(anything, anything).and_return {}
238
- mc.should_receive(:delete_catalog_media).with(
239
- an_instance_of(String)).and_return { raise VCloudSdk::CatalogMediaNotFoundError,
240
- "ISO by name not found" }
241
- mc.should_receive(:upload_catalog_media).with(an_instance_of(String),
242
- an_instance_of(String), anything).and_return {}
243
- mc.should_receive(:insert_catalog_media).with(anything,
244
- an_instance_of(String)).and_return {}
245
- mc.should_receive(:eject_catalog_media).with(anything,
246
- an_instance_of(String)).and_return {}
247
- mc.should_receive(:get_vapp).at_least(:once).with(anything).and_return {
248
- vapp }
249
- mc.should_receive(:set_metadata).with(anything, an_instance_of(String),
250
- an_instance_of(String)).and_return {}
251
- mc.should_receive(:get_disk).twice.with(an_instance_of(
252
- String)).and_return { vapp.vms[0].hardware_section.hard_disks.last }
253
-
254
- cloud = VCloudCloud::Cloud.new(cloud_properties)
255
- cloud.stub!(:client) { mc }
256
-
257
- disk_locality = []
258
- disk_locality << "test_disk_id"
259
- disk_locality << "test_disk_id_non_existent"
260
- stemcell = cloud.create_stemcell(Test::spec_asset("valid_stemcell.tgz"),
261
- {})
262
- cloud.create_vm(Test::generate_unique_name, stemcell,
263
- test_manifest["resource_pools"][0]["cloud_properties"],
264
- test_manifest["network"], disk_locality)
265
- end
266
-
267
- it "can delete a vm" do
268
- vapp = UnitTest::VApp.new
269
- mc = mock("client")
270
- mc.should_receive(:get_vapp).with(anything).and_return { vapp }
271
- mc.should_receive(:power_off_vapp).with(vapp).and_return {}
272
- mc.should_receive(:delete_vapp).with(vapp).and_return {} if
273
- vcd_settings["debug"]["delete_vapp"] == true
274
- mc.should_receive(:delete_catalog_media).with(
275
- an_instance_of(String)).and_return {}
276
-
277
- cloud = VCloudCloud::Cloud.new(cloud_properties)
278
- cloud.stub!(:client) { mc }
279
-
280
- cloud.delete_vm(vapp.name)
281
- end
282
-
283
- it "can delete a suspended vm" do
284
- vapp_power_state = "suspended"
285
- vapp = UnitTest::VApp.new
286
- mc = mock("client")
287
- mc.should_receive(:get_vapp).with(anything).and_return { vapp }
288
- mc.should_receive(:discard_suspended_state_vapp).with(
289
- anything).and_return { vapp }
290
- mc.should_receive(:power_off_vapp).at_least(:once).with(vapp).and_return {
291
- if vapp_power_state == "suspended"
292
- vapp_power_state = "off"
293
- raise VCloudSdk::VappSuspendedError
294
- end
295
- }
296
- mc.should_receive(:delete_vapp).with(vapp).and_return {} if
297
- vcd_settings["debug"]["delete_vapp"] == true
298
- mc.should_receive(:delete_catalog_media).with(
299
- an_instance_of(String)).and_return {}
300
-
301
- cloud = VCloudCloud::Cloud.new(cloud_properties)
302
- cloud.stub!(:client) { mc }
303
-
304
- cloud.delete_vm(vapp.name)
305
- end
306
-
307
- it "can reboot a vm" do
308
- vapp = UnitTest::VApp.new
309
- mc = mock("client")
310
- mc.should_receive(:get_vapp).with(anything).and_return { vapp }
311
- mc.should_receive(:reboot_vapp).with(vapp).and_return {}
312
-
313
- cloud = VCloudCloud::Cloud.new(cloud_properties)
314
- cloud.stub!(:client) { mc }
315
-
316
- cloud.reboot_vm(vapp.name)
317
- end
318
-
319
- it "can reboot a powered off vm" do
320
- vapp_power_state = "off"
321
- vapp = UnitTest::VApp.new
322
- mc = mock("client")
323
- mc.should_receive(:get_vapp).with(anything).and_return { vapp }
324
- mc.should_receive(:power_on_vapp).with(vapp).and_return {}
325
- mc.should_receive(:reboot_vapp).at_least(:once).with(vapp).and_return {
326
- if vapp_power_state == "off"
327
- vapp_power_state = "on"
328
- raise VCloudSdk::VappPoweredOffError
329
- end
330
- }
331
-
332
- cloud = VCloudCloud::Cloud.new(cloud_properties)
333
- cloud.stub!(:client) { mc }
334
-
335
- cloud.reboot_vm(vapp.name)
336
- end
337
-
338
- it "can reboot a suspended vm" do
339
- vapp_power_state = "suspended"
340
- vapp = UnitTest::VApp.new
341
- mc = mock("client")
342
- mc.should_receive(:get_vapp).with(anything).and_return { vapp }
343
- mc.should_receive(:discard_suspended_state_vapp).with(
344
- anything).and_return { vapp }
345
- mc.should_receive(:power_on_vapp).with(vapp).and_return {}
346
- mc.should_receive(:reboot_vapp).at_least(:once).with(vapp).and_return {
347
- if vapp_power_state == "suspended"
348
- vapp_power_state = "on"
349
- raise VCloudSdk::VappSuspendedError
350
- end
351
- }
352
-
353
- cloud = VCloudCloud::Cloud.new(cloud_properties)
354
- cloud.stub!(:client) { mc }
355
-
356
- cloud.reboot_vm(vapp.name)
357
- end
358
-
359
- it "can re-configure vm networks" do
360
- vapp = UnitTest::VApp.new
361
- mc = mock("client")
362
- mc.should_receive(:get_vapp).at_least(:once).with(
363
- anything).and_return { vapp }
364
- mc.should_receive(:power_off_vapp).with(vapp).and_return {}
365
- mc.should_receive(:power_on_vapp).with(anything).and_return {}
366
- mc.should_receive(:reconfigure_vm).with(anything).and_return {}
367
- mc.should_receive(:get_ovdc).at_least(:once).with().and_return {
368
- UnitTest::Vdc.new("myOvdc") }
369
- mc.should_receive(:delete_networks).with(anything, anything).and_return {}
370
- mc.should_receive(:add_network).with(anything, anything).and_return {}
371
- mc.should_receive(:delete_catalog_media).with(
372
- an_instance_of(String)).and_return {}
373
- mc.should_receive(:upload_catalog_media).with(an_instance_of(String),
374
- an_instance_of(String), anything).and_return {}
375
- mc.should_receive(:insert_catalog_media).with(anything,
376
- an_instance_of(String)).and_return {}
377
- mc.should_receive(:eject_catalog_media).with(anything,
378
- an_instance_of(String)).and_return {}
379
- mc.should_receive(:set_metadata).with(anything, an_instance_of(String),
380
- an_instance_of(String)).and_return {}
381
- mc.should_receive(:get_metadata).with(anything,
382
- an_instance_of(String)).and_return { UnitTest::AGENT_ENV }
383
-
384
- cloud = VCloudCloud::Cloud.new(cloud_properties)
385
- cloud.stub!(:client) { mc }
386
-
387
- cloud.configure_networks(vapp.name, test_manifest["network"])
388
- end
389
-
390
- it "can create a disk without locality" do
391
- vapp = UnitTest::VApp.new
392
- mc = mock("client")
393
- mc.should_receive(:create_disk).with(
394
- an_instance_of(String), an_instance_of(Fixnum)).and_return {
395
- vapp.vms[0].hardware_section.hard_disks.last }
396
-
397
- cloud = VCloudCloud::Cloud.new(cloud_properties)
398
- cloud.stub!(:client) { mc }
399
-
400
- cloud.create_disk(4096)
401
- end
402
-
403
- it "can create a disk with locality" do
404
- vapp = UnitTest::VApp.new
405
- mc = mock("client")
406
- mc.should_receive(:get_vapp).with(anything).and_return { vapp }
407
- mc.should_receive(:create_disk).with(
408
- an_instance_of(String), an_instance_of(Fixnum), anything).and_return {
409
- vapp.vms[0].hardware_section.hard_disks.last }
410
-
411
- cloud = VCloudCloud::Cloud.new(cloud_properties)
412
- cloud.stub!(:client) { mc }
413
-
414
- cloud.create_disk(4096, vapp.name)
415
- end
416
-
417
- it "can delete a disk" do
418
- vapp = UnitTest::VApp.new
419
- mc = mock("client")
420
- mc.should_receive(:delete_disk).any_number_of_times.with(
421
- anything).and_return {}
422
- mc.should_receive(:get_disk).with(an_instance_of(String)).and_return {
423
- vapp.vms[0].hardware_section.hard_disks.last }
424
-
425
- cloud= VCloudCloud::Cloud.new(cloud_properties)
426
- cloud.stub!(:client) { mc }
427
-
428
- cloud.delete_disk("test_disk_id")
429
- end
430
-
431
- it "can attach a disk to a vm" do
432
- vapp = UnitTest::VApp.new
433
- mc = mock("client")
434
- mc.should_receive(:get_vapp).at_least(:once).with(
435
- anything).and_return { vapp }
436
- mc.should_receive(:delete_catalog_media).with(
437
- an_instance_of(String)).and_return {}
438
- mc.should_receive(:upload_catalog_media).with(an_instance_of(String),
439
- an_instance_of(String), anything).and_return {}
440
- mc.should_receive(:insert_catalog_media).with(anything,
441
- an_instance_of(String)).and_return {}
442
- mc.should_receive(:eject_catalog_media).with(anything,
443
- an_instance_of(String)).and_return {}
444
- mc.should_receive(:set_metadata).with(anything, an_instance_of(String),
445
- an_instance_of(String)).and_return {}
446
- mc.should_receive(:get_metadata).with(anything,
447
- an_instance_of(String)).and_return { UnitTest::AGENT_ENV }
448
- mc.should_receive(:get_ovdc).at_least(:once).with().and_return {
449
- UnitTest::Vdc.new("myOvdc") }
450
- mc.should_receive(:attach_disk).with(
451
- an_instance_of(UnitTest::Vm::HardDisk), anything).and_return {
452
- vapp.vms[0].add_hard_disk }
453
- mc.should_receive(:get_disk).with(an_instance_of(String)).and_return {
454
- vapp.vms[0].hardware_section.hard_disks.last }
455
-
456
- cloud = VCloudCloud::Cloud.new(cloud_properties)
457
- cloud.stub!(:client) { mc }
458
-
459
- cloud.attach_disk(vapp.name, "test_disk_id")
460
- end
461
-
462
- it "can detach a disk from a vm" do
463
- vapp = UnitTest::VApp.new
464
- mc = mock("client")
465
- mc.should_receive(:get_vapp).at_least(:once).with(
466
- anything).and_return { vapp }
467
- mc.should_receive(:delete_catalog_media).with(
468
- an_instance_of(String)).and_return {}
469
- mc.should_receive(:upload_catalog_media).with(an_instance_of(String),
470
- an_instance_of(String), anything).and_return {}
471
- mc.should_receive(:insert_catalog_media).with(anything,
472
- an_instance_of(String)).and_return {}
473
- mc.should_receive(:eject_catalog_media).with(anything,
474
- an_instance_of(String)).and_return {}
475
- mc.should_receive(:set_metadata).with(anything, an_instance_of(String),
476
- an_instance_of(String)).and_return {}
477
- mc.should_receive(:get_metadata).with(anything,
478
- an_instance_of(String)).and_return { UnitTest::AGENT_ENV }
479
- mc.should_receive(:get_ovdc).at_least(:once).with().and_return {
480
- UnitTest::Vdc.new("myOvdc") }
481
- mc.should_receive(:detach_disk).with(
482
- an_instance_of(UnitTest::Vm::HardDisk), anything).and_return {
483
- vapp.vms[0].del_hard_disk }
484
- mc.should_receive(:get_disk).with(an_instance_of(String)).and_return {
485
- vapp.vms[0].hardware_section.hard_disks.last }
486
-
487
- cloud = VCloudCloud::Cloud.new(cloud_properties)
488
- cloud.stub!(:client) { mc }
489
-
490
- cloud.detach_disk(vapp.name, "test_disk_id")
491
- end
492
-
493
- it "can get the size of a disk" do
494
- vapp = UnitTest::VApp.new
495
- mc = mock("client")
496
- mc.should_receive(:get_disk).with(
497
- an_instance_of(String)).and_return {
498
- vapp.vms[0].hardware_section.hard_disks.last }
499
-
500
- cloud = VCloudCloud::Cloud.new(cloud_properties)
501
- cloud.stub!(:client) { mc }
502
-
503
- cloud.get_disk_size_mb("test_disk_id").should equal(1024.to_i)
504
- end
505
- end
506
- end