opennebula 6.2.1 → 6.3.85.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) 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/datacenter.rb +1 -1
  9. data/lib/datastore.rb +2 -2
  10. data/lib/distributed_firewall.rb +1 -1
  11. data/lib/file_helper.rb +2 -2
  12. data/lib/host.rb +4 -3
  13. data/lib/logical_port.rb +1 -1
  14. data/lib/logical_switch.rb +1 -1
  15. data/lib/memoize.rb +1 -1
  16. data/lib/models/role.rb +1 -1
  17. data/lib/models/service.rb +98 -56
  18. data/lib/models.rb +1 -1
  19. data/lib/network.rb +1 -1
  20. data/lib/nsx_client.rb +1 -1
  21. data/lib/nsx_component.rb +1 -1
  22. data/lib/nsx_constants.rb +1 -1
  23. data/lib/nsx_driver.rb +1 -1
  24. data/lib/nsx_error.rb +1 -1
  25. data/lib/nsx_rule.rb +1 -1
  26. data/lib/nsxt_client.rb +1 -1
  27. data/lib/nsxt_dfw.rb +1 -1
  28. data/lib/nsxt_logical_port.rb +1 -1
  29. data/lib/nsxt_rule.rb +1 -1
  30. data/lib/nsxt_tz.rb +1 -1
  31. data/lib/nsxv_client.rb +1 -1
  32. data/lib/nsxv_dfw.rb +1 -1
  33. data/lib/nsxv_logical_port.rb +1 -1
  34. data/lib/nsxv_rule.rb +1 -1
  35. data/lib/nsxv_tz.rb +1 -1
  36. data/lib/opaque_network.rb +1 -1
  37. data/lib/opennebula/acl.rb +1 -1
  38. data/lib/opennebula/acl_pool.rb +1 -1
  39. data/lib/opennebula/client.rb +1 -1
  40. data/lib/opennebula/cluster.rb +1 -1
  41. data/lib/opennebula/cluster_pool.rb +1 -1
  42. data/lib/opennebula/datastore.rb +1 -1
  43. data/lib/opennebula/datastore_pool.rb +1 -1
  44. data/lib/opennebula/document.rb +1 -1
  45. data/lib/opennebula/document_json.rb +1 -1
  46. data/lib/opennebula/document_pool.rb +1 -1
  47. data/lib/opennebula/document_pool_json.rb +1 -1
  48. data/lib/opennebula/error.rb +1 -1
  49. data/lib/opennebula/flow/grammar.rb +1 -1
  50. data/lib/opennebula/flow/service_pool.rb +7 -3
  51. data/lib/opennebula/flow/service_template.rb +7 -1
  52. data/lib/opennebula/flow/service_template_ext.rb +1 -1
  53. data/lib/opennebula/flow/service_template_pool.rb +1 -1
  54. data/lib/opennebula/flow/validator.rb +1 -1
  55. data/lib/opennebula/flow.rb +1 -1
  56. data/lib/opennebula/group.rb +1 -1
  57. data/lib/opennebula/group_pool.rb +1 -1
  58. data/lib/opennebula/hook.rb +1 -1
  59. data/lib/opennebula/hook_log.rb +1 -1
  60. data/lib/opennebula/hook_pool.rb +1 -1
  61. data/lib/opennebula/host.rb +13 -5
  62. data/lib/opennebula/host_pool.rb +1 -1
  63. data/lib/opennebula/image.rb +1 -1
  64. data/lib/opennebula/image_pool.rb +1 -1
  65. data/lib/opennebula/ldap_auth.rb +1 -1
  66. data/lib/opennebula/ldap_auth_spec.rb +1 -1
  67. data/lib/opennebula/lockable_ext.rb +1 -1
  68. data/lib/opennebula/marketplace.rb +1 -1
  69. data/lib/opennebula/marketplace_pool.rb +1 -1
  70. data/lib/opennebula/marketplaceapp.rb +1 -1
  71. data/lib/opennebula/marketplaceapp_ext.rb +158 -33
  72. data/lib/opennebula/marketplaceapp_pool.rb +1 -1
  73. data/lib/opennebula/oneflow_client.rb +53 -26
  74. data/lib/opennebula/pool.rb +1 -1
  75. data/lib/opennebula/pool_element.rb +1 -1
  76. data/lib/opennebula/security_group.rb +1 -1
  77. data/lib/opennebula/security_group_pool.rb +1 -1
  78. data/lib/opennebula/server_cipher_auth.rb +1 -1
  79. data/lib/opennebula/server_x509_auth.rb +1 -1
  80. data/lib/opennebula/ssh_auth.rb +1 -1
  81. data/lib/opennebula/system.rb +1 -1
  82. data/lib/opennebula/template.rb +1 -1
  83. data/lib/opennebula/template_ext.rb +1 -1
  84. data/lib/opennebula/template_pool.rb +1 -1
  85. data/lib/opennebula/user.rb +1 -1
  86. data/lib/opennebula/user_pool.rb +1 -1
  87. data/lib/opennebula/utils.rb +1 -1
  88. data/lib/opennebula/vdc.rb +1 -1
  89. data/lib/opennebula/vdc_pool.rb +1 -1
  90. data/lib/opennebula/virtual_machine.rb +27 -2
  91. data/lib/opennebula/virtual_machine_ext.rb +1 -1
  92. data/lib/opennebula/virtual_machine_pool.rb +1 -1
  93. data/lib/opennebula/virtual_network.rb +39 -2
  94. data/lib/opennebula/virtual_network_pool.rb +1 -1
  95. data/lib/opennebula/virtual_router.rb +1 -1
  96. data/lib/opennebula/virtual_router_pool.rb +1 -1
  97. data/lib/opennebula/vm_group.rb +1 -1
  98. data/lib/opennebula/vm_group_pool.rb +1 -1
  99. data/lib/opennebula/vntemplate.rb +1 -1
  100. data/lib/opennebula/vntemplate_pool.rb +1 -1
  101. data/lib/opennebula/wait_ext.rb +1 -1
  102. data/lib/opennebula/x509_auth.rb +1 -1
  103. data/lib/opennebula/xml_element.rb +1 -1
  104. data/lib/opennebula/xml_pool.rb +1 -1
  105. data/lib/opennebula/xml_utils.rb +1 -1
  106. data/lib/opennebula/zone.rb +1 -1
  107. data/lib/opennebula/zone_pool.rb +1 -1
  108. data/lib/opennebula.rb +2 -2
  109. data/lib/rest_client.rb +1 -1
  110. data/lib/scripts_common.rb +6 -1
  111. data/lib/transport_zone.rb +1 -1
  112. data/lib/vcenter_driver.rb +1 -1
  113. data/lib/vcenter_importer.rb +10 -12
  114. data/lib/vi_client.rb +1 -1
  115. data/lib/vi_helper.rb +18 -3
  116. data/lib/virtual_machine.rb +21 -12
  117. data/lib/virtual_wire.rb +1 -1
  118. data/lib/vm_disk.rb +1 -1
  119. data/lib/vm_folder.rb +1 -1
  120. data/lib/vm_helper.rb +1 -1
  121. data/lib/vm_monitor.rb +5 -1
  122. data/lib/vm_nic.rb +1 -1
  123. data/lib/vm_template.rb +60 -4
  124. data/lib/vmm_importer.rb +10 -7
  125. metadata +4 -4
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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 #
@@ -45,17 +45,21 @@ module Role
45
45
  ]
46
46
 
47
47
  STATE = {
48
- 'PENDING' => 0,
49
- 'DEPLOYING' => 1,
50
- 'RUNNING' => 2,
51
- 'UNDEPLOYING' => 3,
52
- 'WARNING' => 4,
53
- 'DONE' => 5,
54
- 'FAILED_UNDEPLOYING' => 6,
55
- 'FAILED_DEPLOYING' => 7,
56
- 'SCALING' => 8,
57
- 'FAILED_SCALING' => 9,
58
- 'COOLDOWN' => 10
48
+ 'PENDING' => 0,
49
+ 'DEPLOYING' => 1,
50
+ 'RUNNING' => 2,
51
+ 'UNDEPLOYING' => 3,
52
+ 'WARNING' => 4,
53
+ 'DONE' => 5,
54
+ 'FAILED_UNDEPLOYING' => 6,
55
+ 'FAILED_DEPLOYING' => 7,
56
+ 'SCALING' => 8,
57
+ 'FAILED_SCALING' => 9,
58
+ 'COOLDOWN' => 10,
59
+ 'DEPLOYING_NETS' => 11,
60
+ 'UNDEPLOYING_NETS' => 12,
61
+ 'FAILED_DEPLOYING_NETS' => 13,
62
+ 'FAILED_UNDEPLOYING_NETS' => 14
59
63
  }
60
64
 
61
65
  STATE_STR = [
@@ -69,7 +73,11 @@ module Role
69
73
  'FAILED_DEPLOYING',
70
74
  'SCALING',
71
75
  'FAILED_SCALING',
72
- 'COOLDOWN'
76
+ 'COOLDOWN',
77
+ 'DEPLOYING_NETS',
78
+ 'UNDEPLOYING_NETS',
79
+ 'FAILED_DEPLOYING_NETS',
80
+ 'FAILED_UNDEPLOYING_NETS'
73
81
  ]
74
82
 
75
83
  # Returns the string representation of the role state
@@ -83,17 +91,21 @@ end
83
91
  module Service
84
92
 
85
93
  STATE = {
86
- 'PENDING' => 0,
87
- 'DEPLOYING' => 1,
88
- 'RUNNING' => 2,
89
- 'UNDEPLOYING' => 3,
90
- 'WARNING' => 4,
91
- 'DONE' => 5,
92
- 'FAILED_UNDEPLOYING' => 6,
93
- 'FAILED_DEPLOYING' => 7,
94
- 'SCALING' => 8,
95
- 'FAILED_SCALING' => 9,
96
- 'COOLDOWN' => 10
94
+ 'PENDING' => 0,
95
+ 'DEPLOYING' => 1,
96
+ 'RUNNING' => 2,
97
+ 'UNDEPLOYING' => 3,
98
+ 'WARNING' => 4,
99
+ 'DONE' => 5,
100
+ 'FAILED_UNDEPLOYING' => 6,
101
+ 'FAILED_DEPLOYING' => 7,
102
+ 'SCALING' => 8,
103
+ 'FAILED_SCALING' => 9,
104
+ 'COOLDOWN' => 10,
105
+ 'DEPLOYING_NETS' => 11,
106
+ 'UNDEPLOYING_NETS' => 12,
107
+ 'FAILED_DEPLOYING_NETS' => 13,
108
+ 'FAILED_UNDEPLOYING_NETS' => 14
97
109
  }
98
110
 
99
111
  STATE_STR = [
@@ -107,7 +119,11 @@ module Service
107
119
  'FAILED_DEPLOYING',
108
120
  'SCALING',
109
121
  'FAILED_SCALING',
110
- 'COOLDOWN'
122
+ 'COOLDOWN',
123
+ 'DEPLOYING_NETS',
124
+ 'UNDEPLOYING_NETS',
125
+ 'FAILED_DEPLOYING_NETS',
126
+ 'FAILED_UNDEPLOYING_NETS'
111
127
  ]
112
128
 
113
129
  # Returns the string representation of the service state
@@ -319,10 +335,21 @@ module Service
319
335
 
320
336
  class Client
321
337
  def initialize(opts={})
338
+ endpoint = '/.one/oneflow_endpoint'
322
339
  @username = opts[:username] || ENV['ONEFLOW_USER']
323
340
  @password = opts[:password] || ENV['ONEFLOW_PASSWORD']
324
341
 
325
- url = opts[:url] || ENV['ONEFLOW_URL'] || 'http://localhost:2474'
342
+ if opts[:url]
343
+ url = opts[:url]
344
+ elsif ENV['ONEFLOW_URL']
345
+ url = ENV['ONEFLOW_URL']
346
+ elsif ENV['HOME'] && File.exists?(ENV['HOME'] + endpoint)
347
+ url = File.read(ENV['HOME'] + endpoint).strip
348
+ elsif File.exists?('/var/lib/one/.one/oneflow_endpoint')
349
+ url = File.read('/var/lib/one/.one/oneflow_endpoint').strip
350
+ else
351
+ url = 'http://localhost:2474'
352
+ end
326
353
 
327
354
  if @username.nil? && @password.nil?
328
355
  if ENV["ONE_AUTH"] and !ENV["ONE_AUTH"].empty? and File.file?(ENV["ONE_AUTH"])
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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 #
@@ -54,7 +54,9 @@ module OpenNebula
54
54
  :unlock => "vm.unlock",
55
55
  :schedadd => "vm.schedadd",
56
56
  :scheddelete => "vm.scheddelete",
57
- :schedupdate => "vm.schedupdate"
57
+ :schedupdate => "vm.schedupdate",
58
+ :attachsg => "vm.attachsg",
59
+ :detachsg => "vm.detachsg"
58
60
  }
59
61
 
60
62
  VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
@@ -460,6 +462,25 @@ module OpenNebula
460
462
  return call(VM_METHODS[:detachnic], @pe_id, nic_id)
461
463
  end
462
464
 
465
+ # Attaches a Security Groupt to a running VM
466
+ #
467
+ # @param nic_id [Integer] Id of the NIC, where to attach SG
468
+ # @param sg_id [Integer] Id of the SG to be attached
469
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
470
+ # otherwise
471
+ def sg_attach(nic_id, sg_id)
472
+ return call(VM_METHODS[:attachsg], @pe_id, nic_id, sg_id)
473
+ end
474
+
475
+ # Detaches a Security Group from a running VM
476
+ #
477
+ # @param sg_id [Integer] Id of the SG to be detached
478
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
479
+ # otherwise
480
+ def sg_detach(nic_id, sg_id)
481
+ return call(VM_METHODS[:detachsg], @pe_id, nic_id, sg_id)
482
+ end
483
+
463
484
  # Sets the re-scheduling flag for the VM
464
485
  def resched
465
486
  action('resched')
@@ -804,6 +825,10 @@ module OpenNebula
804
825
  self['DEPLOY_ID']
805
826
  end
806
827
 
828
+ def get_history_record(seq)
829
+ retrieve_xmlelements('//HISTORY')[seq].to_xml
830
+ end
831
+
807
832
  def wait_state(state, timeout=120)
808
833
  require 'opennebula/wait_ext'
809
834
 
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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 #
@@ -40,7 +40,19 @@ module OpenNebula
40
40
  :reserve => "vn.reserve",
41
41
  :free_ar => "vn.free_ar",
42
42
  :lock => "vn.lock",
43
- :unlock => "vn.unlock"
43
+ :unlock => "vn.unlock",
44
+ :recover => "vn.recover"
45
+ }
46
+
47
+ VN_STATES=%w{INIT READY LOCK_CREATE LOCK_DELETE DONE ERROR}
48
+
49
+ SHORT_VN_STATES={
50
+ "INIT" => "init",
51
+ "READY" => "rdy",
52
+ "LOCK_CREATE" => "lock",
53
+ "LOCK_DELETE" => "lock",
54
+ "DONE" => "done",
55
+ "ERROR" => "err"
44
56
  }
45
57
 
46
58
  # Creates a VirtualNetwork description with just its identifier
@@ -311,6 +323,16 @@ module OpenNebula
311
323
  return call(VN_METHODS[:rename], @pe_id, name)
312
324
  end
313
325
 
326
+ # Recovers an stuck Virtual Network
327
+ #
328
+ # @param result [Integer] Recover with failure (0), success (1),
329
+ # delete (2)
330
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
331
+ # otherwise
332
+ def recover(result)
333
+ return call(VN_METHODS[:recover], @pe_id, result)
334
+ end
335
+
314
336
  #######################################################################
315
337
  # Helpers to get VirtualNetwork information
316
338
  #######################################################################
@@ -340,6 +362,21 @@ module OpenNebula
340
362
  return array
341
363
  end
342
364
 
365
+ # Returns the state of the Virtual Network (numeric value)
366
+ def state
367
+ self['STATE'].to_i
368
+ end
369
+
370
+ # Returns the state of the Virtual Network (string value)
371
+ def state_str
372
+ VN_STATES[state]
373
+ end
374
+
375
+ # Returns the state of the Virtual Network (string value)
376
+ def short_state_str
377
+ SHORT_VN_STATES[state_str]
378
+ end
379
+
343
380
  private
344
381
  def set_publish(published)
345
382
  group_u = published ? 1 : 0
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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 #
data/lib/opennebula.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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 #
@@ -77,5 +77,5 @@ require 'opennebula/flow'
77
77
  module OpenNebula
78
78
 
79
79
  # OpenNebula version
80
- VERSION = '6.2.1'
80
+ VERSION = '6.3.85'
81
81
  end
data/lib/rest_client.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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 #
@@ -28,6 +28,11 @@ module OpenNebula
28
28
  log_function("INFO", message)
29
29
  end
30
30
 
31
+ # Logs an info message
32
+ def self.log_warning(message)
33
+ log_function('WARNING', message)
34
+ end
35
+
31
36
  # Logs an error message
32
37
  def self.log_error(message)
33
38
  log_function("ERROR", message)
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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 #
@@ -279,6 +279,15 @@ module VCenterDriver
279
279
  rs = dc_folder.get_unimported_hosts(hpool,
280
280
  vcenter_instance_name)
281
281
 
282
+ # Select just cluster with this reference
283
+ if options[:cluster_ref]
284
+ rs.each do |_, clusters|
285
+ clusters.select! do |c|
286
+ c[:cluster_ref] == options[:cluster_ref]
287
+ end
288
+ end
289
+ end
290
+
282
291
  STDOUT.print "done!\n\n"
283
292
 
284
293
  rs.each do |dc, clusters|
@@ -371,7 +380,6 @@ module VCenterDriver
371
380
  # rubocop:enable Layout/LineLength
372
381
  end
373
382
  end
374
- VCenterDriver::VcImporter.register_hooks
375
383
  rescue Interrupt
376
384
  puts "\n"
377
385
  exit 0 # Ctrl+C
@@ -387,16 +395,6 @@ module VCenterDriver
387
395
  end
388
396
  end
389
397
 
390
- def self.register_hooks
391
- hooks_path = HOOK_LOCATION + '/vcenter/templates'
392
- client = OpenNebula::Client.new
393
- hook = OpenNebula::Hook.new(OpenNebula::Hook.build_xml, client)
394
- hook_files = Dir["#{hooks_path}/*.tmpl"]
395
- hook_files.each do |hook_file|
396
- hook.allocate(File.open(hook_file).read)
397
- end
398
- end
399
-
400
398
  def self.sanitize(text)
401
399
  bad_chars = ['|']
402
400
  bad_chars.each do |bad_char|
data/lib/vi_client.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, 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 #