opennebula 6.4.3 → 6.5.80.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ActionManager.rb +1 -1
  3. data/lib/CommandManager.rb +10 -7
  4. data/lib/DriverExecHelper.rb +1 -1
  5. data/lib/OpenNebulaDriver.rb +1 -1
  6. data/lib/VirtualMachineDriver.rb +28 -14
  7. data/lib/cloud/CloudClient.rb +3 -3
  8. data/lib/datacenter.rb +25 -21
  9. data/lib/datastore.rb +1 -1
  10. data/lib/distributed_firewall.rb +1 -1
  11. data/lib/file_helper.rb +1 -1
  12. data/lib/host.rb +2 -2
  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 +48 -2
  17. data/lib/models/service.rb +1 -1
  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 +4 -3
  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 +1 -1
  51. data/lib/opennebula/flow/service_template.rb +1 -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 +1 -1
  62. data/lib/opennebula/host_pool.rb +1 -1
  63. data/lib/opennebula/image.rb +33 -23
  64. data/lib/opennebula/image_pool.rb +1 -1
  65. data/lib/opennebula/ldap_auth.rb +2 -2
  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 +1 -1
  72. data/lib/opennebula/marketplaceapp_pool.rb +1 -1
  73. data/lib/opennebula/oneflow_client.rb +1 -1
  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 +31 -3
  91. data/lib/opennebula/virtual_machine_ext.rb +1 -207
  92. data/lib/opennebula/virtual_machine_pool.rb +1 -1
  93. data/lib/opennebula/virtual_network.rb +33 -4
  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 +18 -14
  110. data/lib/scripts_common.rb +1 -1
  111. data/lib/transport_zone.rb +1 -1
  112. data/lib/vcenter_driver.rb +1 -1
  113. data/lib/vcenter_importer.rb +1 -1
  114. data/lib/vi_client.rb +73 -65
  115. data/lib/vi_helper.rb +1 -1
  116. data/lib/virtual_machine.rb +1 -1
  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 +1 -1
  122. data/lib/vm_nic.rb +1 -1
  123. data/lib/vm_template.rb +1 -1
  124. metadata +4 -4
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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 #
@@ -2,7 +2,7 @@
2
2
  # Autogenerated from a Treetop grammar. Edits may be lost.
3
3
 
4
4
 
5
- # Copyright 2002-2023, OpenNebula Project, OpenNebula Systems #
5
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
6
6
  # #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
8
8
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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 #
@@ -26,20 +26,21 @@ module OpenNebula
26
26
  #######################################################################
27
27
 
28
28
  IMAGE_METHODS = {
29
- :info => "image.info",
30
- :allocate => "image.allocate",
31
- :update => "image.update",
32
- :enable => "image.enable",
33
- :persistent => "image.persistent",
34
- :delete => "image.delete",
35
- :chown => "image.chown",
36
- :chmod => "image.chmod",
37
- :chtype => "image.chtype",
38
- :clone => "image.clone",
39
- :rename => "image.rename",
40
- :snapshotdelete => "image.snapshotdelete",
41
- :snapshotrevert => "image.snapshotrevert",
42
- :snapshotflatten=> "image.snapshotflatten",
29
+ :info => "image.info",
30
+ :allocate => "image.allocate",
31
+ :update => "image.update",
32
+ :enable => "image.enable",
33
+ :persistent => "image.persistent",
34
+ :delete => "image.delete",
35
+ :chown => "image.chown",
36
+ :chmod => "image.chmod",
37
+ :chtype => "image.chtype",
38
+ :clone => "image.clone",
39
+ :rename => "image.rename",
40
+ :snapshotdelete => "image.snapshotdelete",
41
+ :snapshotrevert => "image.snapshotrevert",
42
+ :snapshotflatten => "image.snapshotflatten",
43
+ :restore => "image.restore",
43
44
  :lock => "image.lock",
44
45
  :unlock => "image.unlock"
45
46
  }
@@ -61,7 +62,7 @@ module OpenNebula
61
62
  "LOCKED_USED_PERS" => "lock"
62
63
  }
63
64
 
64
- IMAGE_TYPES=%w{OS CDROM DATABLOCK KERNEL RAMDISK CONTEXT}
65
+ IMAGE_TYPES=%w{OS CDROM DATABLOCK KERNEL RAMDISK CONTEXT BACKUP}
65
66
 
66
67
  SHORT_IMAGE_TYPES={
67
68
  "OS" => "OS",
@@ -69,7 +70,8 @@ module OpenNebula
69
70
  "DATABLOCK" => "DB",
70
71
  "KERNEL" => "KL",
71
72
  "RAMDISK" => "RD",
72
- "CONTEXT" => "CX"
73
+ "CONTEXT" => "CX",
74
+ "BACKUP" => "BK"
73
75
  }
74
76
 
75
77
  DISK_TYPES=%w{FILE CD_ROM BLOCK RBD}
@@ -163,8 +165,8 @@ module OpenNebula
163
165
  end
164
166
 
165
167
  # Deletes the Image
166
- def delete()
167
- super(IMAGE_METHODS[:delete])
168
+ def delete(force=false)
169
+ call(IMAGE_METHODS[:delete], @pe_id, force)
168
170
  end
169
171
 
170
172
  # Changes the owner/group
@@ -229,7 +231,7 @@ module OpenNebula
229
231
  # @return [nil, OpenNebula::Error] nil in case of success, Error
230
232
  # otherwise
231
233
  def rename(name)
232
- return call(IMAGE_METHODS[:rename], @pe_id, name)
234
+ call(IMAGE_METHODS[:rename], @pe_id, name)
233
235
  end
234
236
 
235
237
  # Deletes Image from snapshot
@@ -238,7 +240,7 @@ module OpenNebula
238
240
  #
239
241
  # @return [nil, OpenNebula::Error] nil in case of success or Error
240
242
  def snapshot_delete(snap_id)
241
- return call(IMAGE_METHODS[:snapshotdelete], @pe_id, snap_id)
243
+ call(IMAGE_METHODS[:snapshotdelete], @pe_id, snap_id)
242
244
  end
243
245
 
244
246
  # Reverts Image state to a previous snapshot
@@ -247,7 +249,7 @@ module OpenNebula
247
249
  #
248
250
  # @return [nil, OpenNebula::Error] nil in case of success or Error
249
251
  def snapshot_revert(snap_id)
250
- return call(IMAGE_METHODS[:snapshotrevert], @pe_id, snap_id)
252
+ call(IMAGE_METHODS[:snapshotrevert], @pe_id, snap_id)
251
253
  end
252
254
 
253
255
  # Flattens an image snapshot
@@ -256,7 +258,15 @@ module OpenNebula
256
258
  #
257
259
  # @return [nil, OpenNebula::Error] nil in case of success or Error
258
260
  def snapshot_flatten(snap_id)
259
- return call(IMAGE_METHODS[:snapshotflatten], @pe_id, snap_id)
261
+ call(IMAGE_METHODS[:snapshotflatten], @pe_id, snap_id)
262
+ end
263
+
264
+ # Restore the VM backup stored by the image
265
+ #
266
+ # @param dst_id [Integer] Datastore destination ID
267
+ # @param restore_opts [String] Template with additional restore options
268
+ def restore(dst_id, restore_opts)
269
+ @client.call(IMAGE_METHODS[:restore], @pe_id, dst_id, restore_opts)
260
270
  end
261
271
 
262
272
  #######################################################################
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, 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-2023, 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 #
@@ -213,7 +213,7 @@ class OpenNebula::LdapAuth
213
213
  groups = []
214
214
  ldap_groups.each do |group|
215
215
  if (g = in_hash_ignore_case?(@mapping, group))
216
- if !@options[:group_admin_group_dn].nil? and ldap_groups.any? {
216
+ if ldap_groups.any? {
217
217
  |s| s.casecmp(@options[:group_admin_group_dn])==0
218
218
  }
219
219
  groups << "*#{@mapping[g]}"
@@ -1,5 +1,5 @@
1
1
  # ---------------------------------------------------------------------------- #
2
- # Copyright 2002-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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-2023, 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 #
@@ -56,7 +56,9 @@ module OpenNebula
56
56
  :scheddelete => "vm.scheddelete",
57
57
  :schedupdate => "vm.schedupdate",
58
58
  :attachsg => "vm.attachsg",
59
- :detachsg => "vm.detachsg"
59
+ :detachsg => "vm.detachsg",
60
+ :backup => "vm.backup",
61
+ :updatenic => "vm.updatenic"
60
62
  }
61
63
 
62
64
  VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
@@ -132,6 +134,8 @@ module OpenNebula
132
134
  HOTPLUG_RESIZE
133
135
  HOTPLUG_SAVEAS_UNDEPLOYED
134
136
  HOTPLUG_SAVEAS_STOPPED
137
+ BACKUP
138
+ BACKUP_POWEROFF
135
139
  }
136
140
 
137
141
  SHORT_VM_STATES={
@@ -216,7 +220,9 @@ module OpenNebula
216
220
  "HOTPLUG_NIC_POWEROFF" => "hotp",
217
221
  "HOTPLUG_RESIZE" => "hotp",
218
222
  "HOTPLUG_SAVEAS_UNDEPLOYED" => "hotp",
219
- "HOTPLUG_SAVEAS_STOPPED" => "hotp"
223
+ "HOTPLUG_SAVEAS_STOPPED" => "hotp",
224
+ "BACKUP" => "back",
225
+ "BACKUP_POWEROFF" => "back",
220
226
  }
221
227
 
222
228
  HISTORY_ACTION=%w{none migrate live-migrate shutdown shutdown-hard
@@ -228,6 +234,7 @@ module OpenNebula
228
234
  snapshot-resize snapshot-delete snapshot-revert disk-saveas
229
235
  disk-snapshot-revert recover retry monitor disk-snapshot-rename
230
236
  alias-attach alias-detach poweroff-migrate poweroff-hard-migrate
237
+ backup nic-update
231
238
  }
232
239
 
233
240
  EXTERNAL_IP_ATTRS = [
@@ -462,6 +469,18 @@ module OpenNebula
462
469
  return call(VM_METHODS[:detachnic], @pe_id, nic_id)
463
470
  end
464
471
 
472
+ # Updates a NIC for a running VM
473
+ #
474
+ # @param nic_id [Integer] Id of the NIC to be updated
475
+ # @param nic_template [String] Template with updated attributes
476
+ # @param append [true|false] True to append new attributes instead of
477
+ # replace the whole template
478
+ # @return [nil, OpenNebula::Error] nil in case of success, Error
479
+ # otherwise
480
+ def nic_update(nic_id, nic_template, append = false)
481
+ return call(VM_METHODS[:updatenic], @pe_id, nic_id, nic_template, append ? 1 : 0)
482
+ end
483
+
465
484
  # Attaches a Security Groupt to a running VM
466
485
  #
467
486
  # @param nic_id [Integer] Id of the NIC, where to attach SG
@@ -779,6 +798,15 @@ module OpenNebula
779
798
  sched_template)
780
799
  end
781
800
 
801
+ # Generate a backup for the VM (backup config must be set)
802
+ #
803
+ # @param ds_id [Integer] Id of the datastore to save the backup
804
+ # @return [Integer, OpenNebula::Error] ID of the resulting BACKUP image
805
+ # in case of success, Error otherwise.
806
+ def backup(ds_id, reset = false)
807
+ return @client.call(VM_METHODS[:backup], @pe_id, ds_id, reset)
808
+ end
809
+
782
810
  ########################################################################
783
811
  # Helpers to get VirtualMachine information
784
812
  ########################################################################