opennebula 5.2.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ActionManager.rb +1 -1
  3. data/lib/CommandManager.rb +1 -1
  4. data/lib/DriverExecHelper.rb +1 -1
  5. data/lib/OpenNebulaDriver.rb +1 -1
  6. data/lib/VirtualMachineDriver.rb +1 -1
  7. data/lib/cloud/CloudClient.rb +3 -3
  8. data/lib/opennebula.rb +2 -2
  9. data/lib/opennebula/acl.rb +1 -1
  10. data/lib/opennebula/acl_pool.rb +1 -1
  11. data/lib/opennebula/client.rb +1 -1
  12. data/lib/opennebula/cluster.rb +1 -1
  13. data/lib/opennebula/cluster_pool.rb +1 -1
  14. data/lib/opennebula/datastore.rb +1 -1
  15. data/lib/opennebula/datastore_pool.rb +1 -1
  16. data/lib/opennebula/document.rb +1 -1
  17. data/lib/opennebula/document_json.rb +1 -1
  18. data/lib/opennebula/document_pool.rb +1 -1
  19. data/lib/opennebula/document_pool_json.rb +1 -1
  20. data/lib/opennebula/error.rb +1 -1
  21. data/lib/opennebula/group.rb +1 -1
  22. data/lib/opennebula/group_pool.rb +1 -1
  23. data/lib/opennebula/host.rb +1 -1
  24. data/lib/opennebula/host_pool.rb +1 -1
  25. data/lib/opennebula/image.rb +1 -1
  26. data/lib/opennebula/image_pool.rb +1 -1
  27. data/lib/opennebula/ldap_auth.rb +1 -1
  28. data/lib/opennebula/ldap_auth_spec.rb +1 -1
  29. data/lib/opennebula/marketplace.rb +1 -1
  30. data/lib/opennebula/marketplace_pool.rb +1 -1
  31. data/lib/opennebula/marketplaceapp.rb +1 -1
  32. data/lib/opennebula/marketplaceapp_pool.rb +1 -1
  33. data/lib/opennebula/oneflow_client.rb +1 -1
  34. data/lib/opennebula/pool.rb +1 -1
  35. data/lib/opennebula/pool_element.rb +1 -1
  36. data/lib/opennebula/security_group.rb +1 -1
  37. data/lib/opennebula/security_group_pool.rb +1 -1
  38. data/lib/opennebula/server_cipher_auth.rb +1 -1
  39. data/lib/opennebula/server_x509_auth.rb +1 -1
  40. data/lib/opennebula/ssh_auth.rb +1 -1
  41. data/lib/opennebula/system.rb +1 -1
  42. data/lib/opennebula/template.rb +1 -1
  43. data/lib/opennebula/template_pool.rb +1 -1
  44. data/lib/opennebula/user.rb +1 -1
  45. data/lib/opennebula/user_pool.rb +1 -1
  46. data/lib/opennebula/vdc.rb +1 -1
  47. data/lib/opennebula/vdc_pool.rb +1 -1
  48. data/lib/opennebula/virtual_machine.rb +1 -1
  49. data/lib/opennebula/virtual_machine_pool.rb +1 -1
  50. data/lib/opennebula/virtual_network.rb +1 -1
  51. data/lib/opennebula/virtual_network_pool.rb +1 -1
  52. data/lib/opennebula/virtual_router.rb +1 -1
  53. data/lib/opennebula/virtual_router_pool.rb +1 -1
  54. data/lib/opennebula/x509_auth.rb +1 -1
  55. data/lib/opennebula/xml_element.rb +1 -1
  56. data/lib/opennebula/xml_pool.rb +1 -1
  57. data/lib/opennebula/xml_utils.rb +1 -1
  58. data/lib/opennebula/zone.rb +1 -1
  59. data/lib/opennebula/zone_pool.rb +1 -1
  60. data/lib/vcenter_driver.rb +280 -96
  61. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40bbc901923acb487fd5b753dda85f8677985cdb
4
- data.tar.gz: dd3421af744f7a1e25f6c940507297e80b595fe6
3
+ metadata.gz: a03807dc5cd00c6e5a42fe341caa95a84a5734b7
4
+ data.tar.gz: 8c4bd35f71422c0f168616d4d32422aee5feef69
5
5
  SHA512:
6
- metadata.gz: 2db7146a955358e97698af1f8207623da99d1c4a9b8204380d3483bd9ffacc962b6d4c0d5d5d55dc5a0a49b2602ee2a1a05e021203a02285653aef50c1eaef51
7
- data.tar.gz: b0818115d8aebc25f332cdf4585d2bbbd1d9e50f742122442d5aef6d4a61ff9d5211943600a53479e0bbc75e836db1147fd7a4b964286a297658b8ea38e4a077
6
+ metadata.gz: 40a1c600b081b6190144d8ec8110b1dbf6a829e83cad138d08119621dfa958632a5918e12bdc0565e877b1d11b03faf2cbaddce40bc9fa1a5a613bd800f3c816
7
+ data.tar.gz: 928962cd78fcd5353ffcacb009e6b2ac7326345abe1cd4e6a4f2f844f350ab9d9b5defc203066b6e144374874e0dfbc62a93e20bceca2879279d1a311a0edeee
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- */
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"); you may */
4
4
  # not use this file except in compliance with the License. You may obtain */
5
5
  # a copy of the License at */
@@ -1,5 +1,5 @@
1
1
  # --------------------------------------------------------------------------
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may
5
5
  # not use this file except in compliance with the License. You may obtain
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -50,7 +50,7 @@ end
50
50
  module CloudClient
51
51
 
52
52
  # OpenNebula version
53
- VERSION = '5.2.0'
53
+ VERSION = '5.2.1'
54
54
 
55
55
  # #########################################################################
56
56
  # Default location for the authentication file
@@ -207,7 +207,7 @@ module CloudCLI
207
207
  def version_text
208
208
  version=<<EOT
209
209
  OpenNebula #{CloudClient::VERSION}
210
- Copyright 2002-2016, OpenNebula Project, OpenNebula Systems
210
+ Copyright 2002-2017, OpenNebula Project, OpenNebula Systems
211
211
 
212
212
  Licensed under the Apache License, Version 2.0 (the "License"); you may
213
213
  not use this file except in compliance with the License. You may obtain
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -66,5 +66,5 @@ require 'opennebula/marketplaceapp_pool'
66
66
  module OpenNebula
67
67
 
68
68
  # OpenNebula version
69
- VERSION = '5.2.0'
69
+ VERSION = '5.2.1'
70
70
  end
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # ---------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # ---------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # ---------------------------------------------------------------------------- #
2
- # Copyright 2002-2016, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -383,6 +383,9 @@ class VIClient
383
383
 
384
384
  storage_pods = VIClient.get_entities(@dc.datastoreFolder, 'StoragePod')
385
385
  storage_pods.each { |sp|
386
+ datastores << sp #Add StoragePod
387
+
388
+ # Add individual datastores under StoragePod
386
389
  storage_pod_datastores = VIClient.get_entities(sp, 'Datastore')
387
390
  if not storage_pod_datastores.empty?
388
391
  datastores.concat(storage_pod_datastores)
@@ -514,21 +517,24 @@ class VIClient
514
517
  next if !n[:host][0]
515
518
 
516
519
  # Networks can be in several cluster, create one per cluster
517
- Array(n[:host][0]).each{ |host_system|
520
+ net_names = []
521
+ Array(n[:host]).each{ |host_system|
518
522
  net_name = "#{n.name} - #{host_system.parent.name}"
519
-
520
- if !vnpool["VNET[BRIDGE=\"#{n[:name]}\"]/\
521
- TEMPLATE[VCENTER_TYPE=\"Port Group\"]"]
522
- one_nets << {
523
- :name => net_name,
524
- :bridge => n.name,
525
- :cluster => host_system.parent.name,
526
- :type => "Port Group",
527
- :one => "NAME = \"#{net_name}\"\n" \
528
- "BRIDGE = \"#{n[:name]}\"\n" \
529
- "VN_MAD = \"dummy\"\n" \
530
- "VCENTER_TYPE = \"Port Group\""
531
- }
523
+ if !net_names.include?(net_name)
524
+ if !vnpool["VNET[BRIDGE=\"#{n[:name]}\"]/\
525
+ TEMPLATE[VCENTER_TYPE=\"Port Group\"]"]
526
+ one_nets << {
527
+ :name => net_name,
528
+ :bridge => n.name,
529
+ :cluster => host_system.parent.name,
530
+ :type => "Port Group",
531
+ :one => "NAME = \"#{net_name}\"\n" \
532
+ "BRIDGE = \"#{n[:name]}\"\n" \
533
+ "VN_MAD = \"dummy\"\n" \
534
+ "VCENTER_TYPE = \"Port Group\""
535
+ }
536
+ net_names << net_name
537
+ end
532
538
  end
533
539
  }
534
540
  }
@@ -632,6 +638,7 @@ class VIClient
632
638
 
633
639
  storage_pods = VIClient.get_entities(dc.datastoreFolder, 'StoragePod')
634
640
  storage_pods.each { |sp|
641
+ datastores << sp # Add StoragePod
635
642
  storage_pod_datastores = VIClient.get_entities(sp, 'Datastore')
636
643
  if not storage_pod_datastores.empty?
637
644
  datastores.concat(storage_pod_datastores)
@@ -639,24 +646,50 @@ class VIClient
639
646
  }
640
647
 
641
648
  datastores.each { |ds|
642
- next if !ds.is_a? RbVmomi::VIM::Datastore
649
+ next if !ds.is_a? RbVmomi::VIM::Datastore and !ds.is_a? RbVmomi::VIM::StoragePod
643
650
  # Find the Cluster from which to access this ds
644
- next if !ds.host[0]
645
- cluster_name = ds.host[0].key.parent.name
651
+
652
+ cluster_name = ""
653
+ if ds.is_a? RbVmomi::VIM::StoragePod
654
+ storage_pod_datastores = VIClient.get_entities(ds, 'Datastore')
655
+ storage_pod_datastores.each { |sp|
656
+ next if !sp.is_a? RbVmomi::VIM::Datastore
657
+ # Find the Cluster from which to access this ds
658
+ next if !sp.host[0]
659
+ cluster_name = sp.host[0].key.parent.name
660
+ break
661
+ }
662
+ else
663
+ next if !ds.host[0]
664
+ cluster_name = ds.host[0].key.parent.name
665
+ end
646
666
 
647
667
  if !dspool["DATASTORE[NAME=\"#{ds.name}\"]"] and
648
668
  hpool["HOST[NAME=\"#{cluster_name}\"]"]
649
- one_tmp << {
650
- :name => "#{ds.name}",
651
- :total_mb => ((ds.summary.capacity.to_i / 1024) / 1024),
652
- :free_mb => ((ds.summary.freeSpace.to_i / 1024) / 1024),
653
- :cluster => cluster_name,
654
- :one => "NAME=#{ds.name}\n"\
655
- "DS_MAD=vcenter\n"\
656
- "TM_MAD=vcenter\n"\
657
- "VCENTER_CLUSTER=#{cluster_name}\n"
658
- }
659
- end
669
+ if ds.is_a? RbVmomi::VIM::StoragePod
670
+ one_tmp << {
671
+ :name => "#{ds.name}",
672
+ :total_mb => ((ds.summary.capacity.to_i / 1024) / 1024),
673
+ :free_mb => ((ds.summary.freeSpace.to_i / 1024) / 1024),
674
+ :cluster => cluster_name,
675
+ :one => "NAME=#{ds.name}\n"\
676
+ "TM_MAD=vcenter\n"\
677
+ "VCENTER_CLUSTER=#{cluster_name}\n"\
678
+ "TYPE=SYSTEM_DS\n" # StoragePods must be set as SYSTEM_DS
679
+ }
680
+ else
681
+ one_tmp << {
682
+ :name => "#{ds.name}",
683
+ :total_mb => ((ds.summary.capacity.to_i / 1024) / 1024),
684
+ :free_mb => ((ds.summary.freeSpace.to_i / 1024) / 1024),
685
+ :cluster => cluster_name,
686
+ :one => "NAME=#{ds.name}\n"\
687
+ "DS_MAD=vcenter\n"\
688
+ "TM_MAD=vcenter\n"\
689
+ "VCENTER_CLUSTER=#{cluster_name}\n"
690
+ }
691
+ end
692
+ end
660
693
  }
661
694
  ds_templates[dc.name] = one_tmp
662
695
  }
@@ -713,6 +746,12 @@ class VIClient
713
746
  ds = datastores.select{|ds| ds.name == ds_name}[0]
714
747
  next if !ds
715
748
 
749
+ # Cannot import from StoragePod directly
750
+ if ds.is_a? RbVmomi::VIM::StoragePod
751
+ raise "OpenNebula cannot import images from a StoragePod. Please import"\
752
+ " it from the datastore which is a member of the StorageDRS cluster"
753
+ end
754
+
716
755
  # Create Search Spec
717
756
  spec = RbVmomi::VIM::HostDatastoreBrowserSearchSpec.new
718
757
  spec.query = [RbVmomi::VIM::VmDiskFileQuery.new,
@@ -889,7 +928,10 @@ class VIClient
889
928
  total_mb = (ds.summary.capacity.to_i / 1024) / 1024
890
929
  free_mb = (ds.summary.freeSpace.to_i / 1024) / 1024
891
930
  used_mb = total_mb - free_mb
892
- ds_type = ds.summary.type
931
+
932
+ if ds.is_a? RbVmomi::VIM::Datastore
933
+ ds_type = ds.summary.type
934
+ end
893
935
 
894
936
  "USED_MB=#{used_mb}\nFREE_MB=#{free_mb} \nTOTAL_MB=#{total_mb}"
895
937
  end
@@ -1045,6 +1087,7 @@ class VCenterCachedHost
1045
1087
  storage_pods = VIClient.get_entities(datacenter.datastoreFolder,
1046
1088
  'StoragePod')
1047
1089
  storage_pods.each { |sp|
1090
+ datastores << sp # Add Storage Pod
1048
1091
  storage_pod_datastores = VIClient.get_entities(sp, 'Datastore')
1049
1092
  if not storage_pod_datastores.empty?
1050
1093
  datastores.concat(storage_pod_datastores)
@@ -1416,6 +1459,7 @@ class VCenterHost < ::OpenNebula::Host
1416
1459
  'StoragePod')
1417
1460
 
1418
1461
  storage_pods.each { |sp|
1462
+ datastores << sp
1419
1463
  storage_pod_datastores = VIClient.get_entities(sp, 'Datastore')
1420
1464
  if not storage_pod_datastores.empty?
1421
1465
  datastores.concat(storage_pod_datastores)
@@ -1787,10 +1831,30 @@ class VCenterVm
1787
1831
 
1788
1832
  vm = connection.find_vm_template(deploy_id)
1789
1833
 
1790
- spec_hash = calculate_addnic_spec(vm, mac, bridge, model)
1834
+ spec_nics = calculate_addnic_spec(vm, mac, bridge, model)
1835
+
1836
+ spec_hash = {:deviceChange => [spec_nics]}
1791
1837
 
1792
- spec = RbVmomi::VIM.VirtualMachineConfigSpec({:deviceChange =>
1793
- [spec_hash]})
1838
+ #B4897 track hot plugged nics
1839
+ hotplugged_nics = vm.config.extraConfig.select do |val|
1840
+ val[:key] == "opennebula.hotplugged_nics"
1841
+ end
1842
+
1843
+ if hotplugged_nics && !hotplugged_nics.empty?
1844
+ hotplugged_nics = hotplugged_nics[0][:value].to_s.split(";")
1845
+ hotplugged_nics << mac.to_s if !hotplugged_nics.include?(mac)
1846
+ else
1847
+ hotplugged_nics = []
1848
+ hotplugged_nics << mac.to_s
1849
+ end
1850
+
1851
+ config_array = [{:key=>"opennebula.hotplugged_nics",
1852
+ :value=>hotplugged_nics.join(";")}]
1853
+ extra_config_spec = {:extraConfig =>config_array}
1854
+
1855
+ spec_hash.merge!(extra_config_spec)
1856
+
1857
+ spec = RbVmomi::VIM.VirtualMachineConfigSpec(spec_hash)
1794
1858
 
1795
1859
  vm.ReconfigVM_Task(:spec => spec).wait_for_completion
1796
1860
  end
@@ -1810,11 +1874,25 @@ class VCenterVm
1810
1874
 
1811
1875
  raise "Could not find NIC with mac address #{mac}" if nic.nil?
1812
1876
 
1877
+ #B4897 track hot plugged nics
1878
+ hotplugged_nics = vm.config.extraConfig.select do |val|
1879
+ val[:key] == "opennebula.hotplugged_nics"
1880
+ end
1881
+
1882
+ config_array = []
1883
+ if hotplugged_nics && !hotplugged_nics.empty?
1884
+ hotplugged_nics = hotplugged_nics[0][:value].to_s.split(";")
1885
+ hotplugged_nics.delete(mac) # remove hotplugged nic
1886
+ config_array = [{:key=>"opennebula.hotplugged_nics",
1887
+ :value=>hotplugged_nics.join(";")}]
1888
+ end
1889
+
1813
1890
  spec = {
1814
1891
  :deviceChange => [
1815
1892
  :operation => :remove,
1816
1893
  :device => nic
1817
- ]
1894
+ ],
1895
+ :extraConfig => config_array
1818
1896
  }
1819
1897
 
1820
1898
  vm.ReconfigVM_Task(:spec => spec).wait_for_completion
@@ -1898,6 +1976,7 @@ class VCenterVm
1898
1976
 
1899
1977
  provider = pm.provider_summary [@vm].first
1900
1978
  refresh_rate = provider.refreshRate
1979
+ max_samples = 0
1901
1980
 
1902
1981
  vmid = -1
1903
1982
  extraconfig_vmid = @vm.config.extraConfig.select{|val|
@@ -1909,54 +1988,56 @@ class VCenterVm
1909
1988
  if vmid < 0
1910
1989
  @nettx = 0
1911
1990
  @netrx = 0
1912
- id_not_found = "Could not retrieve VM ID from extra configuration for "\
1913
- "vCenter's VM UUID #{@vm.config.uuid}"
1914
1991
  else
1915
1992
  one_vm = OpenNebula::VirtualMachine.new_with_id(vmid, OpenNebula::Client.new)
1916
1993
  one_vm.info
1917
1994
  stats = []
1995
+ previous_nettx = 0
1996
+ previous_netrx = 0
1997
+ if one_vm["MONITORING/NETTX"]
1998
+ previous_nettx = one_vm["MONITORING/NETTX"].to_i
1999
+ end
2000
+ if one_vm["MONITORING/NETRX"]
2001
+ previous_netrx = one_vm["MONITORING/NETRX"].to_i
2002
+ end
1918
2003
 
1919
- if(one_vm["LAST_POLL"] && one_vm["LAST_POLL"].to_i != 0 )
2004
+ if(one_vm["MONITORING/LAST_MON"] && one_vm["MONITORING/LAST_MON"].to_i != 0 )
1920
2005
  #Real time data stores max 1 hour. 1 minute has 3 samples
1921
- interval = (Time.now.to_i - one_vm["LAST_POLL"].to_i)
1922
-
2006
+ interval = (Time.now.to_i - one_vm["MONITORING/LAST_MON"].to_i)
2007
+ interval = 3601 if interval < 0 #Safety check
1923
2008
  #If last poll was more than hour ago get 3 minutes,
1924
2009
  #else calculate how many samples since last poll
1925
- samples = interval > 3600 ? 9 : interval / refresh_rate
1926
- max_samples = samples > 0 ? samples : 1
2010
+ max_samples = interval > 3600 ? 9 : (interval / refresh_rate) + 1
2011
+ else
2012
+ # First poll, get at least latest 3 minutes = 9 samples
2013
+ max_samples = 9
2014
+ end
1927
2015
 
1928
- stats = pm.retrieve_stats(
2016
+ stats = pm.retrieve_stats(
1929
2017
  [@vm],
1930
2018
  ['net.transmitted','net.bytesRx','net.bytesTx','net.received'],
1931
2019
  {interval:refresh_rate, max_samples: max_samples}
1932
- )
1933
- else
1934
- # First poll, get at least latest 3 minutes = 9 samples
1935
- stats = pm.retrieve_stats(
1936
- [@vm],
1937
- ['net.transmitted','net.bytesRx'],
1938
- {interval:refresh_rate, max_samples: 9}
1939
- )
1940
- end
2020
+ )
1941
2021
 
1942
2022
  if stats.empty? || stats.first[1][:metrics].empty?
1943
- @nettx = 0
1944
- @netrx = 0
2023
+ @nettx = 0 + previous_nettx
2024
+ @netrx = 0 + previous_netrx
1945
2025
  else
1946
2026
  metrics = stats.first[1][:metrics]
1947
-
1948
2027
  nettx_kbpersec = 0
1949
- metrics['net.transmitted'].each { |sample|
1950
- nettx_kbpersec += sample
1951
- }
1952
-
1953
2028
  netrx_kbpersec = 0
1954
- metrics['net.bytesRx'].each { |sample|
1955
- netrx_kbpersec += sample
2029
+ (0..max_samples-1).each { |index|
2030
+ tx = [0]
2031
+ rx = [0]
2032
+ tx << metrics['net.transmitted'][index] if metrics['net.transmitted']
2033
+ tx << metrics['net.bytesTx'][index] if metrics['net.bytesTx']
2034
+ rx << metrics['net.received'][index] if metrics['net.received']
2035
+ rx << metrics['net.bytesRx'][index] if metrics['net.bytesRx']
2036
+ nettx_kbpersec += tx.max
2037
+ netrx_kbpersec += rx.max
1956
2038
  }
1957
-
1958
- @nettx = (nettx_kbpersec * 1024 * refresh_rate).to_i
1959
- @netrx = (netrx_kbpersec * 1024 * refresh_rate).to_i
2039
+ @nettx = (nettx_kbpersec * 1000 * refresh_rate).to_i + previous_nettx
2040
+ @netrx = (netrx_kbpersec * 1000 * refresh_rate).to_i + previous_netrx
1960
2041
  end
1961
2042
  end
1962
2043
  end
@@ -1974,6 +2055,7 @@ class VCenterVm
1974
2055
  str_info << "GUEST_IP_ADDRESSES=\\\"" <<
1975
2056
  @guest_ip_addresses.to_s << "\\\" "
1976
2057
  end
2058
+ str_info << "LAST_MON=" << Time.now.to_i.to_s << " "
1977
2059
  str_info << "#{POLL_ATTRIBUTE[:state]}=" << @state << " "
1978
2060
  str_info << "#{POLL_ATTRIBUTE[:cpu]}=" << @used_cpu.to_s << " "
1979
2061
  str_info << "#{POLL_ATTRIBUTE[:memory]}=" << @used_memory.to_s << " "
@@ -2366,6 +2448,9 @@ private
2366
2448
 
2367
2449
  storage_pods = VIClient.get_entities(connection.dc.datastoreFolder,
2368
2450
  'StoragePod')
2451
+
2452
+ storpod = storage_pods.select{|sp| sp.name == datastore}
2453
+
2369
2454
  storage_pods.each { |sp|
2370
2455
  storage_pod_datastores = VIClient.get_entities(sp, 'Datastore')
2371
2456
  if not storage_pod_datastores.empty?
@@ -2373,17 +2458,20 @@ private
2373
2458
  end
2374
2459
  }
2375
2460
 
2376
- ds = datastores.select{|ds| ds.name == datastore}[0]
2377
- raise "Cannot find datastore #{datastore}" if !ds
2461
+ ds = datastores.select{|ds| ds.name == datastore}[0]
2462
+
2463
+ raise "Cannot find datastore #{datastore}" if !ds && !storpod
2464
+
2378
2465
  end
2379
2466
 
2380
2467
  relocate_spec_params = {
2381
- :diskMoveType => :moveChildMostDiskBacking,
2382
2468
  :pool => rp
2383
2469
  }
2384
2470
 
2385
2471
  relocate_spec_params[:datastore] = ds if datastore
2386
2472
 
2473
+ relocate_spec_params[:diskMoveType] = :moveChildMostDiskBacking if ds
2474
+
2387
2475
  relocate_spec = RbVmomi::VIM.VirtualMachineRelocateSpec(
2388
2476
  relocate_spec_params)
2389
2477
 
@@ -2406,45 +2494,82 @@ private
2406
2494
  vim = connection.vim
2407
2495
 
2408
2496
  if !customization.nil?
2409
- begin
2410
- custom_spec = vim.serviceContent.customizationSpecManager.
2411
- GetCustomizationSpec(:name => customization.text)
2497
+ begin
2498
+ custom_spec = vim.serviceContent.customizationSpecManager.
2499
+ GetCustomizationSpec(:name => customization.text)
2412
2500
 
2413
- if custom_spec && spec=custom_spec.spec
2414
- clone_parameters[:customization] = spec
2415
- else
2416
- raise "Error getting customization spec"
2417
- end
2501
+ if custom_spec && spec=custom_spec.spec
2502
+ clone_parameters[:customization] = spec
2503
+ else
2504
+ raise "Error getting customization spec"
2505
+ end
2418
2506
 
2419
- rescue
2420
- raise "Customization spec '#{customization.text}' not found"
2421
- end
2507
+ rescue
2508
+ raise "Customization spec '#{customization.text}' not found"
2509
+ end
2422
2510
  end
2423
2511
 
2424
2512
  clone_spec = RbVmomi::VIM.VirtualMachineCloneSpec(clone_parameters)
2425
2513
 
2426
- begin
2514
+ if storpod && !storpod.empty? && storpod[0].is_a?(RbVmomi::VIM::StoragePod)
2515
+
2516
+ storage_manager = vim.serviceContent.storageResourceManager
2517
+
2518
+ pod_spec = RbVmomi::VIM.StorageDrsPodSelectionSpec(storagePod: storpod[0])
2519
+
2520
+ storage_spec = RbVmomi::VIM.StoragePlacementSpec(
2521
+ type: 'clone',
2522
+ cloneName: vcenter_name,
2523
+ folder: vc_template.parent,
2524
+ podSelectionSpec: pod_spec,
2525
+ vm: vc_template,
2526
+ cloneSpec: clone_spec
2527
+ )
2528
+
2529
+ result = storage_manager.RecommendDatastores(storageSpec: storage_spec)
2530
+
2531
+ recommendation = result.recommendations[0]
2532
+
2533
+ key = recommendation.key ||= ''
2534
+
2535
+ if key == ''
2536
+ raise "Missing Datastore recommendation for StoragePod (Storage DRS)"
2537
+ end
2538
+
2539
+ begin
2540
+ apply_sr = storage_manager.ApplyStorageDrsRecommendation_Task(key: [key]).wait_for_completion
2541
+ vm = apply_sr.vm
2542
+ rescue Exception => e
2543
+ raise "Cannot clone VM Template to StoragePod: #{e.message}"
2544
+ end
2545
+ else
2546
+
2547
+ begin
2427
2548
  vm = vc_template.CloneVM_Task(
2428
2549
  :folder => vc_template.parent,
2429
2550
  :name => vcenter_name,
2430
2551
  :spec => clone_spec).wait_for_completion
2431
- rescue Exception => e
2552
+ rescue Exception => e
2432
2553
 
2433
- if !e.message.start_with?('DuplicateName')
2434
- raise "Cannot clone VM Template: #{e.message}"
2435
- end
2554
+ if !e.message.start_with?('DuplicateName')
2555
+ raise "Cannot clone VM Template: #{e.message}"
2556
+ end
2436
2557
 
2437
- vm = connection.find_vm(vcenter_name)
2558
+ vm = connection.find_vm(vcenter_name)
2438
2559
 
2439
- raise "Cannot clone VM Template" if vm.nil?
2560
+ raise "Cannot clone VM Template" if vm.nil?
2561
+
2562
+ vm.Destroy_Task.wait_for_completion
2563
+ vm = vc_template.CloneVM_Task(
2564
+ :folder => vc_template.parent,
2565
+ :name => vcenter_name,
2566
+ :spec => clone_spec).wait_for_completion
2567
+ end
2440
2568
 
2441
- vm.Destroy_Task.wait_for_completion
2442
- vm = vc_template.CloneVM_Task(
2443
- :folder => vc_template.parent,
2444
- :name => vcenter_name,
2445
- :spec => clone_spec).wait_for_completion
2446
2569
  end
2447
2570
 
2571
+
2572
+
2448
2573
  reconfigure_vm(vm, xml, true, hostname)
2449
2574
 
2450
2575
  # Power on the VM
@@ -2573,29 +2698,84 @@ private
2573
2698
  :value=>context_text}]
2574
2699
  end
2575
2700
 
2576
- if config_array != []
2577
- context_vnc_spec = {:extraConfig =>config_array}
2578
- end
2579
-
2580
2701
  device_change = []
2581
2702
 
2582
2703
  # NIC section, build the reconfig hash
2583
2704
 
2584
2705
  nics = xml.root.get_elements("/VM/TEMPLATE/NIC")
2585
- nic_spec = {}
2586
2706
 
2587
2707
  # If the VM is not new, avoid readding NiCs
2588
2708
  if !newvm
2709
+
2710
+ nic_array = []
2711
+
2712
+ # B4897 - Get mac of NICs that were hot-plugged from vCenter extraConfig
2713
+ hotplugged_nics = []
2714
+ extraconfig_nics = vm.config.extraConfig.select do |val|
2715
+ val[:key] == "opennebula.hotplugged_nics"
2716
+ end
2717
+
2718
+ if extraconfig_nics && !extraconfig_nics.empty?
2719
+ hotplugged_nics = extraconfig_nics[0][:value].to_s.split(";")
2720
+ end
2721
+
2722
+ # Get MACs from NICs inside VM template
2723
+ one_mac_addresses = Array.new
2724
+ nics.each{|nic|
2725
+ mac = nic.elements["MAC"].text
2726
+ one_mac_addresses << mac
2727
+ # B4897 - Add NICs that were attached in POWEROFF
2728
+ if !hotplugged_nics.include?(mac)
2729
+ hotplugged_nics << mac.to_s
2730
+ end
2731
+ }
2732
+
2589
2733
  vm.config.hardware.device.each{ |dv|
2590
2734
  if is_nic?(dv)
2591
2735
  nics.each{|nic|
2592
- if nic.elements["MAC"].text == dv.macAddress and
2593
- nic.elements["BRIDGE"].text == dv.deviceInfo.summary
2736
+ if nic.elements["MAC"].text == dv.macAddress
2594
2737
  nics.delete(nic)
2595
2738
  end
2596
2739
  }
2740
+ # B4897 - Remove detached NICs from vCenter that were unplugged in POWEROFF
2741
+ if !one_mac_addresses.include?(dv.macAddress) && hotplugged_nics.include?(dv.macAddress)
2742
+ nic_array << { :operation => :remove, :device => dv}
2743
+ hotplugged_nics.delete(dv.macAddress)
2744
+ end
2597
2745
  end
2598
2746
  }
2747
+
2748
+ # B4897 - Save what NICs have been attached by OpenNebula in vCenter VM extraconfig
2749
+ if !hotplugged_nics.empty?
2750
+ config_array << {
2751
+ :key => 'opennebula.hotplugged_nics',
2752
+ :value => hotplugged_nics.join(";")
2753
+ }
2754
+ else
2755
+ config_array << {
2756
+ :key => 'opennebula.hotplugged_nics',
2757
+ :value => ""
2758
+ }
2759
+ end
2760
+
2761
+ device_change += nic_array
2762
+ else
2763
+ # B4897 - Add NICs that have been added to the VM template
2764
+ # to the hotplugged_nics extraconfig so we can track what must be removed
2765
+
2766
+ # Get MACs from NICs inside VM template to track NICs added by OpenNebula
2767
+ one_mac_addresses = []
2768
+ nics.each{|nic|
2769
+ one_mac_addresses << nic.elements["MAC"].text
2770
+ }
2771
+
2772
+ if !one_mac_addresses.empty?
2773
+ config_array << {
2774
+ :key => 'opennebula.hotplugged_nics',
2775
+ :value => one_mac_addresses.join(";")
2776
+ }
2777
+ end
2778
+
2599
2779
  end
2600
2780
 
2601
2781
  if !nics.nil?
@@ -2669,6 +2849,10 @@ private
2669
2849
  :memoryMB => memory }
2670
2850
 
2671
2851
  # Perform the VM reconfiguration
2852
+ if config_array != []
2853
+ context_vnc_spec = {:extraConfig =>config_array}
2854
+ end
2855
+
2672
2856
  spec_hash = context_vnc_spec.merge(capacity_spec)
2673
2857
  if device_change.length > 0
2674
2858
  spec_hash.merge!({ :deviceChange => device_change })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-18 00:00:00.000000000 Z
11
+ date: 2017-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  version: '0'
140
140
  requirements: []
141
141
  rubyforge_project:
142
- rubygems_version: 2.5.1
142
+ rubygems_version: 2.5.2
143
143
  signing_key:
144
144
  specification_version: 4
145
145
  summary: OpenNebula Client API