ruby_vcloud_sdk 0.4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (319) hide show
  1. data/README +1 -0
  2. data/Rakefile +50 -0
  3. data/lib/ruby_vcloud_sdk.rb +19 -0
  4. data/lib/ruby_vcloud_sdk/client.rb +899 -0
  5. data/lib/ruby_vcloud_sdk/config.rb +17 -0
  6. data/lib/ruby_vcloud_sdk/connection/connection.rb +163 -0
  7. data/lib/ruby_vcloud_sdk/connection/file_uploader.rb +43 -0
  8. data/lib/ruby_vcloud_sdk/errors.rb +21 -0
  9. data/lib/ruby_vcloud_sdk/ovf_directory.rb +45 -0
  10. data/lib/ruby_vcloud_sdk/util.rb +21 -0
  11. data/lib/ruby_vcloud_sdk/version.rb +3 -0
  12. data/lib/ruby_vcloud_sdk/xml/constants.rb +427 -0
  13. data/lib/ruby_vcloud_sdk/xml/wrapper.rb +242 -0
  14. data/lib/ruby_vcloud_sdk/xml/wrapper_classes.rb +3 -0
  15. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/admin_catalog.rb +20 -0
  16. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/admin_org.rb +15 -0
  17. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/catalog_item.rb +27 -0
  18. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk.rb +40 -0
  19. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk_attach_or_detach_params.rb +12 -0
  20. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/disk_create_params.rb +47 -0
  21. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/entity.rb +11 -0
  22. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/file.rb +11 -0
  23. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/hard_disk_item_wrapper.rb +50 -0
  24. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/instantiate_vapp_template_params.rb +71 -0
  25. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/ip_scope.rb +55 -0
  26. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/item.rb +32 -0
  27. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/media.rb +53 -0
  28. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/media_insert_or_eject_params.rb +17 -0
  29. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/metadata_value.rb +15 -0
  30. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/network.rb +15 -0
  31. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/network_config.rb +27 -0
  32. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/network_config_section.rb +25 -0
  33. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/network_connection.rb +71 -0
  34. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/network_connection_section.rb +67 -0
  35. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/nic_item_wrapper.rb +91 -0
  36. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/org_network.rb +19 -0
  37. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/org_vdc_network.rb +11 -0
  38. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/session.rb +17 -0
  39. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/task.rb +32 -0
  40. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/upload_vapp_template_params.rb +11 -0
  41. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vapp.rb +55 -0
  42. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vapp_template.rb +19 -0
  43. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vcloud.rb +15 -0
  44. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc.rb +54 -0
  45. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vdc_storage_profile.rb +15 -0
  46. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/virtual_hardware_section.rb +68 -0
  47. data/lib/ruby_vcloud_sdk/xml/wrapper_classes/vm.rb +179 -0
  48. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminAllocatedExtIpRecord.xml +1 -0
  49. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminCatalog.xml +1 -0
  50. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminCatalogItemRecord.xml +1 -0
  51. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminCatalogRecord.xml +1 -0
  52. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminGroupRecord.xml +1 -0
  53. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminMediaRecord.xml +1 -0
  54. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminOrg.xml +1 -0
  55. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminOrgNetworkRecord.xml +1 -0
  56. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminShadowVmRecord.xml +1 -0
  57. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminTaskRecord.xml +1 -0
  58. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminUserRecord.xml +1 -0
  59. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVAppNetworkRecord.xml +1 -0
  60. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVAppRecord.xml +1 -0
  61. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVAppReference.xml +1 -0
  62. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVAppReferences.xml +1 -0
  63. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVAppTemplateRecord.xml +1 -0
  64. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVdc.xml +1 -0
  65. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVdcRecord.xml +1 -0
  66. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVdcReference.xml +1 -0
  67. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVdcReferences.xml +1 -0
  68. data/lib/ruby_vcloud_sdk/xml/xml_templates/AdminVmRecord.xml +1 -0
  69. data/lib/ruby_vcloud_sdk/xml/xml_templates/AllEULAsAccepted.xml +1 -0
  70. data/lib/ruby_vcloud_sdk/xml/xml_templates/AllocatedExtIpRecord.xml +1 -0
  71. data/lib/ruby_vcloud_sdk/xml/xml_templates/BlockingTaskRecord.xml +1 -0
  72. data/lib/ruby_vcloud_sdk/xml/xml_templates/BlockingTaskReference.xml +1 -0
  73. data/lib/ruby_vcloud_sdk/xml/xml_templates/BlockingTaskReferences.xml +1 -0
  74. data/lib/ruby_vcloud_sdk/xml/xml_templates/CaptureVAppParams.xml +1 -0
  75. data/lib/ruby_vcloud_sdk/xml/xml_templates/Catalog.xml +1 -0
  76. data/lib/ruby_vcloud_sdk/xml/xml_templates/CatalogItem.xml +1 -0
  77. data/lib/ruby_vcloud_sdk/xml/xml_templates/CatalogItemRecord.xml +1 -0
  78. data/lib/ruby_vcloud_sdk/xml/xml_templates/CatalogItemReference.xml +1 -0
  79. data/lib/ruby_vcloud_sdk/xml/xml_templates/CatalogItemReferences.xml +1 -0
  80. data/lib/ruby_vcloud_sdk/xml/xml_templates/CatalogRecord.xml +1 -0
  81. data/lib/ruby_vcloud_sdk/xml/xml_templates/CatalogReference.xml +1 -0
  82. data/lib/ruby_vcloud_sdk/xml/xml_templates/CatalogReferences.xml +1 -0
  83. data/lib/ruby_vcloud_sdk/xml/xml_templates/CellRecord.xml +1 -0
  84. data/lib/ruby_vcloud_sdk/xml/xml_templates/CloneMediaParams.xml +1 -0
  85. data/lib/ruby_vcloud_sdk/xml/xml_templates/CloneVAppParams.xml +1 -0
  86. data/lib/ruby_vcloud_sdk/xml/xml_templates/CloneVAppTemplateParams.xml +1 -0
  87. data/lib/ruby_vcloud_sdk/xml/xml_templates/ComposeVAppParams.xml +1 -0
  88. data/lib/ruby_vcloud_sdk/xml/xml_templates/ControlAccessParams.xml +1 -0
  89. data/lib/ruby_vcloud_sdk/xml/xml_templates/CustomizationSection.xml +1 -0
  90. data/lib/ruby_vcloud_sdk/xml/xml_templates/DatastoreProviderVdcRelationRecord.xml +1 -0
  91. data/lib/ruby_vcloud_sdk/xml/xml_templates/DatastoreRecord.xml +1 -0
  92. data/lib/ruby_vcloud_sdk/xml/xml_templates/DatastoreReference.xml +1 -0
  93. data/lib/ruby_vcloud_sdk/xml/xml_templates/DatastoreReferences.xml +1 -0
  94. data/lib/ruby_vcloud_sdk/xml/xml_templates/DeployVAppParams.xml +1 -0
  95. data/lib/ruby_vcloud_sdk/xml/xml_templates/DhcpService.xml +1 -0
  96. data/lib/ruby_vcloud_sdk/xml/xml_templates/DiskAttachOrDetachParams.xml +5 -0
  97. data/lib/ruby_vcloud_sdk/xml/xml_templates/DiskCreateParams.xml +9 -0
  98. data/lib/ruby_vcloud_sdk/xml/xml_templates/DvSwitchRecord.xml +1 -0
  99. data/lib/ruby_vcloud_sdk/xml/xml_templates/Entity.xml +1 -0
  100. data/lib/ruby_vcloud_sdk/xml/xml_templates/Error.xml +1 -0
  101. data/lib/ruby_vcloud_sdk/xml/xml_templates/EventRecord.xml +1 -0
  102. data/lib/ruby_vcloud_sdk/xml/xml_templates/ExternalNetwork.xml +1 -0
  103. data/lib/ruby_vcloud_sdk/xml/xml_templates/File.xml +1 -0
  104. data/lib/ruby_vcloud_sdk/xml/xml_templates/FirewallService.xml +1 -0
  105. data/lib/ruby_vcloud_sdk/xml/xml_templates/GeneralOrgSettings.xml +1 -0
  106. data/lib/ruby_vcloud_sdk/xml/xml_templates/Group.xml +1 -0
  107. data/lib/ruby_vcloud_sdk/xml/xml_templates/GroupRecord.xml +1 -0
  108. data/lib/ruby_vcloud_sdk/xml/xml_templates/GroupReference.xml +1 -0
  109. data/lib/ruby_vcloud_sdk/xml/xml_templates/GroupReferences.xml +1 -0
  110. data/lib/ruby_vcloud_sdk/xml/xml_templates/GuestCustomizationSection.xml +1 -0
  111. data/lib/ruby_vcloud_sdk/xml/xml_templates/HostRecord.xml +1 -0
  112. data/lib/ruby_vcloud_sdk/xml/xml_templates/HostReference.xml +1 -0
  113. data/lib/ruby_vcloud_sdk/xml/xml_templates/HostReferences.xml +1 -0
  114. data/lib/ruby_vcloud_sdk/xml/xml_templates/InstantiateOvfParams.xml +1 -0
  115. data/lib/ruby_vcloud_sdk/xml/xml_templates/InstantiateVAppTemplateParams.xml +1 -0
  116. data/lib/ruby_vcloud_sdk/xml/xml_templates/IpScope.xml +12 -0
  117. data/lib/ruby_vcloud_sdk/xml/xml_templates/IpsecVpnLocalPeer.xml +1 -0
  118. data/lib/ruby_vcloud_sdk/xml/xml_templates/IpsecVpnPeer.xml +1 -0
  119. data/lib/ruby_vcloud_sdk/xml/xml_templates/IpsecVpnRemotePeer.xml +1 -0
  120. data/lib/ruby_vcloud_sdk/xml/xml_templates/IpsecVpnService.xml +1 -0
  121. data/lib/ruby_vcloud_sdk/xml/xml_templates/IpsecVpnThirdPartyPeer.xml +1 -0
  122. data/lib/ruby_vcloud_sdk/xml/xml_templates/Item.xml +3 -0
  123. data/lib/ruby_vcloud_sdk/xml/xml_templates/ItemVcd.xml +5 -0
  124. data/lib/ruby_vcloud_sdk/xml/xml_templates/LeaseSettingsSection.xml +1 -0
  125. data/lib/ruby_vcloud_sdk/xml/xml_templates/Link.xml +1 -0
  126. data/lib/ruby_vcloud_sdk/xml/xml_templates/Media.xml +6 -0
  127. data/lib/ruby_vcloud_sdk/xml/xml_templates/MediaInsertOrEjectParams.xml +4 -0
  128. data/lib/ruby_vcloud_sdk/xml/xml_templates/MediaRecord.xml +1 -0
  129. data/lib/ruby_vcloud_sdk/xml/xml_templates/MediaReference.xml +1 -0
  130. data/lib/ruby_vcloud_sdk/xml/xml_templates/MediaReferences.xml +1 -0
  131. data/lib/ruby_vcloud_sdk/xml/xml_templates/Metadata.xml +5 -0
  132. data/lib/ruby_vcloud_sdk/xml/xml_templates/MetadataEntry.xml +7 -0
  133. data/lib/ruby_vcloud_sdk/xml/xml_templates/MetadataValue.xml +8 -0
  134. data/lib/ruby_vcloud_sdk/xml/xml_templates/NatService.xml +1 -0
  135. data/lib/ruby_vcloud_sdk/xml/xml_templates/Network.xml +4 -0
  136. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkAssignment.xml +1 -0
  137. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkConfig.xml +21 -0
  138. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkConfigSection.xml +1 -0
  139. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkConnection.xml +11 -0
  140. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkConnectionSection.xml +1 -0
  141. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkPoolRecord.xml +1 -0
  142. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkPoolReference.xml +1 -0
  143. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkPoolReferences.xml +1 -0
  144. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkRecord.xml +1 -0
  145. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkReference.xml +1 -0
  146. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkReferences.xml +1 -0
  147. data/lib/ruby_vcloud_sdk/xml/xml_templates/NetworkService.xml +1 -0
  148. data/lib/ruby_vcloud_sdk/xml/xml_templates/Org.xml +1 -0
  149. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgEmailSettings.xml +1 -0
  150. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgList.xml +1 -0
  151. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgNetwork.xml +1 -0
  152. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgNetworkRecord.xml +1 -0
  153. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgNetworkReference.xml +1 -0
  154. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgNetworkReferences.xml +1 -0
  155. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgPasswordPolicySettings.xml +1 -0
  156. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgRecord.xml +1 -0
  157. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgReference.xml +1 -0
  158. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgReferences.xml +1 -0
  159. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgSettings.xml +1 -0
  160. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgVAppTemplateLeaseSettings.xml +1 -0
  161. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgVdcNetwork.xml +1 -0
  162. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgVdcRecord.xml +1 -0
  163. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgVdcReference.xml +1 -0
  164. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgVdcReferences.xml +1 -0
  165. data/lib/ruby_vcloud_sdk/xml/xml_templates/OrgVdcResourcePoolRelationRecord.xml +1 -0
  166. data/lib/ruby_vcloud_sdk/xml/xml_templates/Owner.xml +1 -0
  167. data/lib/ruby_vcloud_sdk/xml/xml_templates/PortgroupRecord.xml +1 -0
  168. data/lib/ruby_vcloud_sdk/xml/xml_templates/ProductSectionList.xml +1 -0
  169. data/lib/ruby_vcloud_sdk/xml/xml_templates/ProviderVdc.xml +1 -0
  170. data/lib/ruby_vcloud_sdk/xml/xml_templates/ProviderVdcResourcePoolRelationRecord.xml +1 -0
  171. data/lib/ruby_vcloud_sdk/xml/xml_templates/PublishCatalogParams.xml +1 -0
  172. data/lib/ruby_vcloud_sdk/xml/xml_templates/QueryList.xml +1 -0
  173. data/lib/ruby_vcloud_sdk/xml/xml_templates/QueryResultRecords.xml +1 -0
  174. data/lib/ruby_vcloud_sdk/xml/xml_templates/RasdItemsList.xml +1 -0
  175. data/lib/ruby_vcloud_sdk/xml/xml_templates/RecomposeVAppParams.xml +1 -0
  176. data/lib/ruby_vcloud_sdk/xml/xml_templates/Record.xml +1 -0
  177. data/lib/ruby_vcloud_sdk/xml/xml_templates/Reference.xml +1 -0
  178. data/lib/ruby_vcloud_sdk/xml/xml_templates/References.xml +1 -0
  179. data/lib/ruby_vcloud_sdk/xml/xml_templates/RelocateParams.xml +1 -0
  180. data/lib/ruby_vcloud_sdk/xml/xml_templates/ResourceEntity.xml +1 -0
  181. data/lib/ruby_vcloud_sdk/xml/xml_templates/ResourcePoolRecord.xml +1 -0
  182. data/lib/ruby_vcloud_sdk/xml/xml_templates/Right.xml +1 -0
  183. data/lib/ruby_vcloud_sdk/xml/xml_templates/RightRecord.xml +1 -0
  184. data/lib/ruby_vcloud_sdk/xml/xml_templates/RightReference.xml +1 -0
  185. data/lib/ruby_vcloud_sdk/xml/xml_templates/RightReferences.xml +1 -0
  186. data/lib/ruby_vcloud_sdk/xml/xml_templates/Role.xml +1 -0
  187. data/lib/ruby_vcloud_sdk/xml/xml_templates/RoleRecord.xml +1 -0
  188. data/lib/ruby_vcloud_sdk/xml/xml_templates/RoleReference.xml +1 -0
  189. data/lib/ruby_vcloud_sdk/xml/xml_templates/RoleReferences.xml +1 -0
  190. data/lib/ruby_vcloud_sdk/xml/xml_templates/RuntimeInfoSection.xml +1 -0
  191. data/lib/ruby_vcloud_sdk/xml/xml_templates/ScreenTicket.xml +1 -0
  192. data/lib/ruby_vcloud_sdk/xml/xml_templates/Session.xml +1 -0
  193. data/lib/ruby_vcloud_sdk/xml/xml_templates/ShadowVMReferences.xml +1 -0
  194. data/lib/ruby_vcloud_sdk/xml/xml_templates/StaticRoutingService.xml +1 -0
  195. data/lib/ruby_vcloud_sdk/xml/xml_templates/StrandedUserRecord.xml +1 -0
  196. data/lib/ruby_vcloud_sdk/xml/xml_templates/Task.xml +0 -0
  197. data/lib/ruby_vcloud_sdk/xml/xml_templates/TaskRecord.xml +1 -0
  198. data/lib/ruby_vcloud_sdk/xml/xml_templates/TaskReference.xml +1 -0
  199. data/lib/ruby_vcloud_sdk/xml/xml_templates/TaskReferences.xml +1 -0
  200. data/lib/ruby_vcloud_sdk/xml/xml_templates/TasksList.xml +1 -0
  201. data/lib/ruby_vcloud_sdk/xml/xml_templates/UndeployVAppParams.xml +1 -0
  202. data/lib/ruby_vcloud_sdk/xml/xml_templates/UploadVAppTemplateParams.xml +1 -0
  203. data/lib/ruby_vcloud_sdk/xml/xml_templates/User.xml +1 -0
  204. data/lib/ruby_vcloud_sdk/xml/xml_templates/UserRecord.xml +1 -0
  205. data/lib/ruby_vcloud_sdk/xml/xml_templates/UserReference.xml +1 -0
  206. data/lib/ruby_vcloud_sdk/xml/xml_templates/UserReferences.xml +1 -0
  207. data/lib/ruby_vcloud_sdk/xml/xml_templates/VApp.xml +1 -0
  208. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppLeaseSettings.xml +1 -0
  209. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppNetwork.xml +1 -0
  210. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppNetworkRecord.xml +1 -0
  211. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppNetworkReference.xml +1 -0
  212. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppNetworkReferences.xml +1 -0
  213. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppOrgNetworkRelationRecord.xml +1 -0
  214. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppOrgNetworkRelationReference.xml +1 -0
  215. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppOrgNetworkRelationReferences.xml +1 -0
  216. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppRecord.xml +1 -0
  217. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppReference.xml +1 -0
  218. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppReferences.xml +1 -0
  219. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppTemplate.xml +1 -0
  220. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppTemplateRecord.xml +1 -0
  221. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppTemplateReference.xml +1 -0
  222. data/lib/ruby_vcloud_sdk/xml/xml_templates/VAppTemplateReferences.xml +1 -0
  223. data/lib/ruby_vcloud_sdk/xml/xml_templates/VCloud.xml +1 -0
  224. data/lib/ruby_vcloud_sdk/xml/xml_templates/VMRecord.xml +1 -0
  225. data/lib/ruby_vcloud_sdk/xml/xml_templates/VMReference.xml +1 -0
  226. data/lib/ruby_vcloud_sdk/xml/xml_templates/VMReferences.xml +1 -0
  227. data/lib/ruby_vcloud_sdk/xml/xml_templates/VMWProviderVdcRecord.xml +1 -0
  228. data/lib/ruby_vcloud_sdk/xml/xml_templates/VMWProviderVdcReference.xml +1 -0
  229. data/lib/ruby_vcloud_sdk/xml/xml_templates/VMWProviderVdcReferences.xml +1 -0
  230. data/lib/ruby_vcloud_sdk/xml/xml_templates/Vdc.xml +1 -0
  231. data/lib/ruby_vcloud_sdk/xml/xml_templates/VdcReferences.xml +1 -0
  232. data/lib/ruby_vcloud_sdk/xml/xml_templates/VdcStorageProfile.xml +1 -0
  233. data/lib/ruby_vcloud_sdk/xml/xml_templates/VirtualCenterRecord.xml +1 -0
  234. data/lib/ruby_vcloud_sdk/xml/xml_templates/VirtualCenterReference.xml +1 -0
  235. data/lib/ruby_vcloud_sdk/xml/xml_templates/VirtualCenterReferences.xml +1 -0
  236. data/lib/ruby_vcloud_sdk/xml/xml_templates/Vm.xml +1 -0
  237. data/lib/ruby_vcloud_sdk/xml/xml_templates/VmPendingQuestion.xml +1 -0
  238. data/lib/ruby_vcloud_sdk/xml/xml_templates/VmQuestionAnswer.xml +1 -0
  239. data/lib/ruby_vcloud_sdk/xml/xml_templates/generate_dictionary.rb +8 -0
  240. data/spec/assets/admin_org_response.xml +75 -0
  241. data/spec/assets/catalog_add_item_response.xml +8 -0
  242. data/spec/assets/catalog_add_vapp_request.xml +5 -0
  243. data/spec/assets/catalog_item_added_response.xml +19 -0
  244. data/spec/assets/catalog_response.xml +19 -0
  245. data/spec/assets/existing_media_busy_response.xml +19 -0
  246. data/spec/assets/existing_media_catalog_item.xml +8 -0
  247. data/spec/assets/existing_media_delete_task_done.xml +6 -0
  248. data/spec/assets/existing_media_done_response.xml +11 -0
  249. data/spec/assets/existing_vapp_resolver_response.xml +3 -0
  250. data/spec/assets/existing_vapp_template_catalog_resolver_response.xml +3 -0
  251. data/spec/assets/existing_vapp_template_instantiate_response.xml +20 -0
  252. data/spec/assets/existing_vapp_template_instantiate_task_error_response.xml +7 -0
  253. data/spec/assets/existing_vapp_template_instantiate_task_start_response.xml +7 -0
  254. data/spec/assets/existing_vapp_template_instantiate_task_success_response.xml +7 -0
  255. data/spec/assets/existing_vapp_template_item_response.xml +8 -0
  256. data/spec/assets/existing_vapp_template_ready_response.xml +79 -0
  257. data/spec/assets/finalize_upload_task_done_response.xml +7 -0
  258. data/spec/assets/finalize_upload_task_response.xml +7 -0
  259. data/spec/assets/indy_disk_attach_request.xml +3 -0
  260. data/spec/assets/indy_disk_attach_task.xml +6 -0
  261. data/spec/assets/indy_disk_attach_task_error.xml +6 -0
  262. data/spec/assets/indy_disk_create_error.xml +1 -0
  263. data/spec/assets/indy_disk_create_request.xml +4 -0
  264. data/spec/assets/indy_disk_create_response.xml +19 -0
  265. data/spec/assets/indy_disk_delete_task.xml +6 -0
  266. data/spec/assets/indy_disk_detach_request.xml +3 -0
  267. data/spec/assets/indy_disk_detach_task.xml +6 -0
  268. data/spec/assets/indy_disk_response.xml +11 -0
  269. data/spec/assets/instantiated_suspended_vapp_response.xml +209 -0
  270. data/spec/assets/instantiated_vapp_delelete_done_task.xml +5 -0
  271. data/spec/assets/instantiated_vapp_delelete_running_task.xml +6 -0
  272. data/spec/assets/instantiated_vapp_network_config_add_network_request.xml +36 -0
  273. data/spec/assets/instantiated_vapp_network_config_modify_network_task_success.xml +6 -0
  274. data/spec/assets/instantiated_vapp_network_config_remove_network_request.xml +6 -0
  275. data/spec/assets/instantiated_vapp_network_config_section_response.xml +17 -0
  276. data/spec/assets/instantiated_vapp_off_response.xml +206 -0
  277. data/spec/assets/instantiated_vapp_on_response.xml +205 -0
  278. data/spec/assets/instantiated_vapp_power_task_running.xml +6 -0
  279. data/spec/assets/instantiated_vapp_power_task_success.xml +6 -0
  280. data/spec/assets/instantiated_vapp_response.xml +205 -0
  281. data/spec/assets/instantiated_vm_change_task_running.xml +6 -0
  282. data/spec/assets/instantiated_vm_change_task_success.xml +6 -0
  283. data/spec/assets/instantiated_vm_cpu_response.xml +11 -0
  284. data/spec/assets/instantiated_vm_insert_media_task_done.xml +6 -0
  285. data/spec/assets/instantiated_vm_memory_response.xml +11 -0
  286. data/spec/assets/instantiated_vm_modify_task_running.xml +6 -0
  287. data/spec/assets/instantiated_vm_modify_task_success.xml +5 -0
  288. data/spec/assets/instantiated_vm_network_section_response.xml +11 -0
  289. data/spec/assets/instantiated_vm_response.xml +149 -0
  290. data/spec/assets/media_add_to_catalog_request.xml +5 -0
  291. data/spec/assets/media_add_to_catalog_response.xml +8 -0
  292. data/spec/assets/media_delete_task_done.xml +6 -0
  293. data/spec/assets/media_upload_pending_response.xml +13 -0
  294. data/spec/assets/media_upload_request.xml +2 -0
  295. data/spec/assets/metadata_set_request.xml +3 -0
  296. data/spec/assets/metadata_set_task_done.xml +6 -0
  297. data/spec/assets/org_network_response.xml +22 -0
  298. data/spec/assets/reconfigure_vm_request.xml +133 -0
  299. data/spec/assets/reconfigure_vm_task.xml +8 -0
  300. data/spec/assets/session.xml +7 -0
  301. data/spec/assets/test-config.yml +38 -0
  302. data/spec/assets/undeploy_params.xml +1 -0
  303. data/spec/assets/vapp_template_catalog_resolver_response.xml +3 -0
  304. data/spec/assets/vapp_template_delelete_done_task.xml +5 -0
  305. data/spec/assets/vapp_template_delelete_running_task.xml +6 -0
  306. data/spec/assets/vapp_template_instantiate_request.xml +8 -0
  307. data/spec/assets/vapp_template_instantiate_with_locality_request.xml +14 -0
  308. data/spec/assets/vapp_template_no_disk_response.xml +27 -0
  309. data/spec/assets/vapp_template_ready_response.xml +79 -0
  310. data/spec/assets/vapp_template_upload_complete.xml +28 -0
  311. data/spec/assets/vapp_template_upload_failed.xml +28 -0
  312. data/spec/assets/vapp_template_upload_request.xml +4 -0
  313. data/spec/assets/vapp_template_upload_response.xml +25 -0
  314. data/spec/assets/vcloud_response.xml +56 -0
  315. data/spec/assets/vdc_response.xml +57 -0
  316. data/spec/spec_helper.rb +107 -0
  317. data/spec/unit/client_response.rb +700 -0
  318. data/spec/unit/client_spec.rb +1152 -0
  319. metadata +498 -0
@@ -0,0 +1,91 @@
1
+ require "item"
2
+
3
+ module VCloudSdk
4
+ module Xml
5
+
6
+ class NicItemWrapper < Item
7
+ def initialize(item)
8
+ super(item.node, item.namespace, item.namespace_definitions)
9
+
10
+ # Ensure the underlying XML has all the necessary RASD elements.
11
+ # This is useful for NIC creation.
12
+ # Should have no effect when receiving XML from VCD.
13
+ [:ADDRESS_ON_PARENT, :CONNECTION, :INSTANCE_ID].each { |t|
14
+ rt = RASD_TYPES[t]
15
+ add_rasd(rt) unless get_rasd(rt) }
16
+
17
+ rt = RASD_TYPES[:RESOURCE_SUB_TYPE]
18
+ unless get_rasd(rt)
19
+ add_rasd(rt)
20
+ set_rasd(rt, RESOURCE_SUB_TYPE[:VMXNET3])
21
+ end
22
+
23
+ rt = RASD_TYPES[:RESOURCE_TYPE]
24
+ unless get_rasd(rt)
25
+ add_rasd(rt)
26
+ set_rasd(rt, HARDWARE_TYPE[:NIC])
27
+ end
28
+ end
29
+
30
+ def is_primary
31
+ connection["primaryNetworkConnection"]
32
+ end
33
+
34
+ def is_primary=(value)
35
+ primary_attr = create_qualified_name("primaryNetworkConnection",
36
+ VCLOUD_NAMESPACE)
37
+ connection[primary_attr] = value.to_s
38
+ end
39
+
40
+ def nic_index
41
+ get_rasd_content(RASD_TYPES[:ADDRESS_ON_PARENT])
42
+ end
43
+
44
+ def nic_index=(value)
45
+ set_rasd(RASD_TYPES[:ADDRESS_ON_PARENT], value)
46
+ end
47
+
48
+ def ip_addressing_mode
49
+ attr = create_qualified_name("ipAddressingMode", VCLOUD_NAMESPACE)
50
+ connection[attr]
51
+ end
52
+
53
+ def set_ip_addressing_mode(mode, ip = nil)
54
+ unless IP_ADDRESSING_MODE.values.include?(mode)
55
+ raise ArgumentError, "Invalid choice for IP addressing mode."
56
+ end
57
+
58
+ if ip && !ip_addressing_mode == IP_ADDRESSING_MODE[:MANUAL]
59
+ raise ArgumentError,
60
+ "Cannot set IP address unless IP addressing mode is MANUAL"
61
+ end
62
+
63
+ mode_attr = create_qualified_name("ipAddressingMode",
64
+ VCLOUD_NAMESPACE)
65
+ connection[mode_attr] = mode
66
+
67
+ ip_attr = create_qualified_name("ipAddress", VCLOUD_NAMESPACE)
68
+ connection[ip_attr] = !ip.nil? ? ip : ""
69
+ end
70
+
71
+ def mac_address
72
+ get_rasd_content(RASD_TYPES[:ADDRESS])
73
+ end
74
+
75
+ def network
76
+ connection.content
77
+ end
78
+
79
+ def network=(value)
80
+ connection.content = value
81
+ end
82
+
83
+ private
84
+
85
+ def connection
86
+ get_rasd(RASD_TYPES[:CONNECTION])
87
+ end
88
+ end
89
+
90
+ end
91
+ end
@@ -0,0 +1,19 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class OrgNetwork < Wrapper
5
+ def ip_scope
6
+ get_nodes("IpScope").first
7
+ end
8
+
9
+ def fence_mode
10
+ get_nodes("FenceMode").first.content
11
+ end
12
+
13
+ def fence_mode=(value)
14
+ get_nodes("FenceMode").first.content = value
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class OrgVdcNetwork < Wrapper
5
+ def ip_scope
6
+ get_nodes("IpScope").first
7
+ end
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class Session < Wrapper
5
+ def admin_root
6
+ get_nodes("Link", {"type" =>
7
+ VCloudSdk::Xml::ADMIN_MEDIA_TYPE[:VCLOUD]}).first
8
+ end
9
+
10
+ def entity_resolver
11
+ get_nodes("Link", {"type" =>
12
+ VCloudSdk::Xml::MEDIA_TYPE[:ENTITY]}).first
13
+ end
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,32 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class Task < Wrapper
5
+ def cancel_link
6
+ get_nodes("Link", {"rel" => "task:cancel"}).first
7
+ end
8
+
9
+ def status
10
+ self["status"]
11
+ end
12
+
13
+ # Friendly description of the task
14
+ def operation
15
+ self["operation"]
16
+ end
17
+
18
+ # Short form name of the operation
19
+ def operation_name
20
+ self["operationName"]
21
+ end
22
+
23
+ # Not all tasks will have progress
24
+ def progress
25
+ task_progress = get_nodes("Progress").first
26
+ return task_progress.content unless task_progress.nil?
27
+ nil
28
+ end
29
+ end
30
+
31
+ end
32
+ end
@@ -0,0 +1,11 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class UploadVAppTemplateParams < Wrapper
5
+ def name=(name)
6
+ @root["name"] = name
7
+ end
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,55 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class VApp < Wrapper
5
+ def description
6
+ get_nodes("Description").first.content
7
+ end
8
+
9
+ def network_config_section
10
+ get_nodes("NetworkConfigSection").first
11
+ end
12
+
13
+ def power_on_link
14
+ get_nodes("Link", {"rel" => "power:powerOn"}, true).first
15
+ end
16
+
17
+ def power_off_link
18
+ get_nodes("Link", {"rel" => "power:powerOff"}, true).first
19
+ end
20
+
21
+ def reboot_link
22
+ get_nodes("Link", {"rel" => "power:reboot"}, true).first
23
+ end
24
+
25
+ def remove_link
26
+ get_nodes("Link", {"rel" => "remove"}, true).first
27
+ end
28
+
29
+ def running_tasks
30
+ get_nodes("Task", {"status" => "running"})
31
+ end
32
+
33
+ def tasks
34
+ get_nodes("Task")
35
+ end
36
+
37
+ def undeploy_link
38
+ get_nodes("Link", {"rel" => "undeploy"}, true).first
39
+ end
40
+
41
+ def discard_state
42
+ get_nodes("Link", {"rel" => "discardState"}, true).first
43
+ end
44
+
45
+ def vms
46
+ get_nodes("Vm")
47
+ end
48
+
49
+ def vm(name)
50
+ get_nodes("Vm", {"name" => name}).first
51
+ end
52
+ end
53
+
54
+ end
55
+ end
@@ -0,0 +1,19 @@
1
+ require "vapp"
2
+
3
+ module VCloudSdk
4
+ module Xml
5
+
6
+ class VAppTemplate < VApp
7
+ def files
8
+ get_nodes("File")
9
+ end
10
+
11
+ # Files that have not finished transferring
12
+ def incomplete_files
13
+ files.find_all {|f| f["size"].to_i < 0 ||
14
+ (f["size"].to_i > f["bytesTransferred"].to_i)}
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,15 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class VCloud < Wrapper
5
+ def organizations
6
+ get_nodes("OrganizationReference")
7
+ end
8
+
9
+ def organization(name)
10
+ get_nodes("OrganizationReference", {"name" => name}).first
11
+ end
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,54 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class Vdc < Wrapper
5
+ def add_disk_link
6
+ get_nodes("Link", {"type"=>MEDIA_TYPE[:DISK_CREATE_PARAMS]}).first
7
+ end
8
+
9
+ def disks(name = nil)
10
+ if name.nil?
11
+ get_nodes("ResourceEntity", {"type"=>MEDIA_TYPE[:DISK]})
12
+ else
13
+ get_nodes("ResourceEntity",
14
+ {"type"=>MEDIA_TYPE[:DISK], "name"=>name})
15
+ end
16
+ end
17
+
18
+ def instantiate_vapp_template_link
19
+ get_nodes("Link",
20
+ {"type"=>MEDIA_TYPE[:INSTANTIATE_VAPP_TEMPLATE_PARAMS]}).first
21
+ end
22
+
23
+ def upload_link
24
+ get_nodes("Link",
25
+ {"type"=>MEDIA_TYPE[:UPLOAD_VAPP_TEMPLATE_PARAMS]}).first
26
+ end
27
+
28
+ def upload_media_link
29
+ get_nodes("Link", {"type"=>MEDIA_TYPE[:MEDIA]}).first
30
+ end
31
+
32
+ # vApp Template names are not unique so multiple ones can be returned.
33
+ def get_vapp_templates(name)
34
+ get_nodes("ResourceEntity",
35
+ {"type"=>MEDIA_TYPE[:VAPP_TEMPLATE], "name"=>name})
36
+ end
37
+
38
+ def available_networks
39
+ get_nodes("Network", {"type"=>MEDIA_TYPE[:NETWORK]})
40
+ end
41
+
42
+ def available_network(name)
43
+ get_nodes("Network",
44
+ {"type"=>MEDIA_TYPE[:NETWORK], "name"=>name}).first
45
+ end
46
+
47
+ def storage_profiles
48
+ get_nodes("VdcStorageProfile",
49
+ {"type"=>MEDIA_TYPE[:VDC_STORAGE_PROFILE]})
50
+ end
51
+ end
52
+
53
+ end
54
+ end
@@ -0,0 +1,15 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class VdcStorageProfile < Wrapper
5
+ def name
6
+ @root["name"]
7
+ end
8
+
9
+ def name=(value)
10
+ @root["name"] = value
11
+ end
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,68 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class VirtualHardwareSection < Wrapper
5
+ def add_item(item)
6
+ system_node = get_nodes("System", nil, true, OVF).first
7
+ system_node.node.after(item.node)
8
+ end
9
+
10
+ def edit_link
11
+ get_nodes("Link", {"rel" => "edit",
12
+ "type" => MEDIA_TYPE[:VIRTUAL_HARDWARE_SECTION]}, true).first
13
+ end
14
+
15
+ def cpu
16
+ hardware.find { |h| h.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) ==
17
+ HARDWARE_TYPE[:CPU] }
18
+ end
19
+
20
+ def memory
21
+ hardware.find { |h| h.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) ==
22
+ HARDWARE_TYPE[:MEMORY] }
23
+ end
24
+
25
+ def scsi_controller
26
+ hardware.find { |h| h.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) ==
27
+ HARDWARE_TYPE[:SCSI_CONTROLLER] }
28
+ end
29
+
30
+ def highest_instance_id
31
+ hardware.map{|h| h.instance_id}.max
32
+ end
33
+
34
+ def nics
35
+ items = hardware.find_all {|h| h.get_rasd_content(
36
+ RASD_TYPES[:RESOURCE_TYPE]) == HARDWARE_TYPE[:NIC] }
37
+ items.map { |i| NicItemWrapper.new(i) }
38
+ end
39
+
40
+ def remove_nic(index)
41
+ remove_hw(HARDWARE_TYPE[:NIC], index)
42
+ end
43
+
44
+ def remove_hw(hw_type, index)
45
+ item = hardware.find { |h|
46
+ h.get_rasd_content(RASD_TYPES[:RESOURCE_TYPE]) == hw_type &&
47
+ h.get_rasd_content(RASD_TYPES[:ADDRESS_ON_PARENT]) == index }
48
+ if item
49
+ item.node.remove
50
+ else
51
+ raise ObjectNotFoundError,
52
+ "Cannot remove hw item #{hw_type}:#{index}, does not exist."
53
+ end
54
+ end
55
+
56
+ def hard_disks
57
+ items = hardware.find_all { |h| h.get_rasd_content(
58
+ RASD_TYPES[:RESOURCE_TYPE]) == HARDWARE_TYPE[:HARD_DISK] }
59
+ items.map { |i| HardDiskItemWrapper.new(i) }
60
+ end
61
+
62
+ def hardware
63
+ get_nodes("Item", nil, false, OVF)
64
+ end
65
+ end
66
+
67
+ end
68
+ end
@@ -0,0 +1,179 @@
1
+ module VCloudSdk
2
+ module Xml
3
+
4
+ class Vm < Wrapper
5
+ def initialize(xml, ns = nil, ns_definitions = nil)
6
+ super(xml, ns, ns_definitions)
7
+ @logger = Config.logger
8
+ end
9
+
10
+ def attach_disk_link
11
+ get_nodes("Link", {"rel" => "disk:attach",
12
+ "type" => MEDIA_TYPE[:DISK_ATTACH_DETACH_PARAMS]}, true).first
13
+ end
14
+
15
+ def description
16
+ nodes = get_nodes("Description")
17
+ return nodes unless nodes
18
+ node = nodes.first
19
+ return node unless node
20
+ node.content
21
+ end
22
+
23
+ def description=(value)
24
+ nodes = get_nodes("Description")
25
+ return unless nodes
26
+ node = nodes.first
27
+ return unless node
28
+ node.content = value
29
+ end
30
+
31
+ def detach_disk_link
32
+ get_nodes("Link", {"rel" => "disk:detach",
33
+ "type" => MEDIA_TYPE[:DISK_ATTACH_DETACH_PARAMS]}, true).first
34
+ end
35
+
36
+ def edit_link
37
+ get_nodes("Link", {"rel" => "edit"}, true).first
38
+ end
39
+
40
+ def reconfigure_link
41
+ get_nodes("Link", {"rel" => "reconfigureVm"}, true).first
42
+ end
43
+
44
+ def insert_media_link
45
+ get_nodes("Link", {"rel" => "media:insertMedia"}, true).first
46
+ end
47
+
48
+ def eject_media_link
49
+ get_nodes("Link", {"rel" => "media:ejectMedia"}, true).first
50
+ end
51
+
52
+ def metadata_link
53
+ get_nodes("Link", {"type" => MEDIA_TYPE[:METADATA]}, true).first
54
+ end
55
+
56
+ def name
57
+ @root["name"]
58
+ end
59
+
60
+ def name=(value)
61
+ @root["name"]= value
62
+ end
63
+
64
+ def hardware_section
65
+ get_nodes("VirtualHardwareSection", nil, false,
66
+ "http://schemas.dmtf.org/ovf/envelope/1").first
67
+ end
68
+
69
+ def network_connection_section
70
+ get_nodes("NetworkConnectionSection",
71
+ {"type" => MEDIA_TYPE[:NETWORK_CONNECTION_SECTION]}).first
72
+ end
73
+
74
+ # hardware modification methods
75
+
76
+ def add_hard_disk(size_mb)
77
+ section = hardware_section
78
+ scsi_controller = section.scsi_controller
79
+ unless scsi_controller
80
+ raise ObjectNotFoundError, "No SCSI controller found for VM #{name}"
81
+ end
82
+ # Create a RASD item
83
+ new_disk = WrapperFactory.create_instance("Item", nil,
84
+ hardware_section.doc_namespaces)
85
+ section.add_item(new_disk)
86
+ # The order matters!
87
+ new_disk.add_rasd(RASD_TYPES[:HOST_RESOURCE])
88
+ new_disk.add_rasd(RASD_TYPES[:INSTANCE_ID])
89
+ rt = RASD_TYPES[:RESOURCE_TYPE]
90
+ new_disk.add_rasd(rt)
91
+ new_disk.set_rasd(rt, HARDWARE_TYPE[:HARD_DISK])
92
+ host_resource = new_disk.get_rasd(RASD_TYPES[:HOST_RESOURCE])
93
+ host_resource[new_disk.create_qualified_name(
94
+ "capacity", VCLOUD_NAMESPACE)] = size_mb.to_s
95
+ host_resource[new_disk.create_qualified_name(
96
+ "busSubType", VCLOUD_NAMESPACE)] = scsi_controller.get_rasd_content(
97
+ RASD_TYPES[:RESOURCE_SUB_TYPE])
98
+ host_resource[new_disk.create_qualified_name(
99
+ "busType", VCLOUD_NAMESPACE)] = HARDWARE_TYPE[:SCSI_CONTROLLER]
100
+ end
101
+
102
+ def change_cpu_count(quantity)
103
+ @logger.debug("Updating CPU count on vm #{name} to #{quantity} ")
104
+ item = hardware_section.cpu
105
+ item.set_rasd("VirtualQuantity", quantity)
106
+ end
107
+
108
+ def change_memory(mb)
109
+ @logger.debug("Updating memory on vm #{name} to #{mb} MB")
110
+ item = hardware_section.memory
111
+ item.set_rasd("VirtualQuantity", mb)
112
+ end
113
+
114
+ def add_nic(nic_index, network_name, addressing_mode, ip = nil)
115
+ section = hardware_section
116
+ is_primary = hardware_section.nics.length == 0
117
+ new_nic = Xml::NicItemWrapper.new(Xml::WrapperFactory.create_instance(
118
+ "Item", nil, hardware_section.doc_namespaces))
119
+ section.add_item(new_nic)
120
+ new_nic.nic_index = nic_index
121
+ new_nic.network = network_name
122
+ new_nic.set_ip_addressing_mode(addressing_mode, ip)
123
+ new_nic.is_primary = is_primary
124
+ @logger.info("Adding NIC #{nic_index} to VM #{name} with the " +
125
+ "following parameters: Network name: #{network_name}, " +
126
+ "Addressing mode #{addressing_mode}, " +
127
+ "IP address: #{ip.nil? ? "blank" : ip}")
128
+ end
129
+
130
+ # NIC modification methods
131
+
132
+ def connect_nic(nic_index, network_name, addressing_mode,
133
+ ip_address = nil)
134
+ section = network_connection_section
135
+ new_connection = WrapperFactory.create_instance("NetworkConnection",
136
+ nil, network_connection_section.doc_namespaces)
137
+ section.add_item(new_connection)
138
+ new_connection.network_connection_index = nic_index
139
+ new_connection.network = network_name
140
+ new_connection.ip_address_allocation_mode = addressing_mode
141
+ new_connection.ip_address = ip_address if ip_address
142
+ new_connection.is_connected = true
143
+ end
144
+
145
+ # Deletes NIC from VM. Accepts variable number of arguments for NICs.
146
+ # To delete all NICs from VM use the splat operator
147
+ # ex: delete_nic(vm, *vm.hardware_section.nics)
148
+ def delete_nic(*nics)
149
+ # Trying to remove a NIC without removing the network connection
150
+ # first will cause an error. Removing the network connection of a NIC
151
+ # in the NetworkConnectionSection will automatically delete the NIC.
152
+ net_conn_section = network_connection_section
153
+ vhw_section = hardware_section
154
+ nics.each do |nic|
155
+ nic_index = nic.nic_index
156
+ @logger.info("Removing NIC #{nic_index} from VM #{name}")
157
+ net_conn_section.remove_network_connection(nic_index)
158
+ vhw_section.remove_nic(nic_index)
159
+ end
160
+ end
161
+
162
+ def set_nic_is_connected(nic_index, is_connected)
163
+ net_conn_section = network_connection_section
164
+ connection = net_conn_section.network_connection(nic_index)
165
+ unless connection
166
+ raise ObjectNotFoundError,
167
+ "NIC #{nic_index} cannot be found on VM #{name}."
168
+ end
169
+ connection.is_connected = is_connected
170
+ end
171
+
172
+ def set_primary_nic(nic_index)
173
+ net_conn_section = network_connection_section
174
+ net_conn_section.primary_network_connection_index = nic_index
175
+ end
176
+ end
177
+
178
+ end
179
+ end