opennebula-cli 6.10.0 → 6.10.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d5d55565c52884d481345ee71a5d40d5bd7c94167b16d2ee531ab2e41ffed4d
4
- data.tar.gz: 25b6cc368e6576a8e5350875ebb970841667528c5d7264e509d38a9b1f542154
3
+ metadata.gz: de5f626cbb390d51c51c96f9c866e67aefb21beb83bbf7116b56097cfeb52211
4
+ data.tar.gz: d9101be349af4f0b9b8dff85446867ac5b8f637275a5d37fa9488e33916b8b4c
5
5
  SHA512:
6
- metadata.gz: 0a52a24316357d4b400bbbf157785612c9deac3684fc5d1f5418d9615382b305caeaea2dd934a36eb6f5e06d8f89aa81eae9f05577ac9f71a0cfa1930a83dd2e
7
- data.tar.gz: e7177952a258b2f78b7b17c0ccb88dd3cedd2ef14961087aefe21604e241561b8bf05ea917fcd5a896d8a879ce05187557c052db454ac49d45204e35c113ecdd
6
+ metadata.gz: dddc332c72fa230035158cb48bdcb07244a896ae25d00b382cc08b6384c76488cbaa1ddaec70d5f154a7519470b5a30cf40001226715ce89170a9da50b447574
7
+ data.tar.gz: b298cbe408ad5520c36b35857d34106ac54b01b9f9a469ed8ccc4c344e08af0bb006f3296904cdb198db1bb1a3ff542572aea995a85f66e523c7a3168b6f70d9
data/bin/onebackupjob CHANGED
@@ -120,6 +120,10 @@ CommandParser::CmdParser.new(ARGV) do
120
120
  helper.filterflag_to_i(arg)
121
121
  end
122
122
 
123
+ set :format, :schedid, 'Scheduled Action id' do |arg|
124
+ format_int(arg)
125
+ end
126
+
123
127
  ########################################################################
124
128
  # Commands
125
129
  ########################################################################
data/bin/onehook CHANGED
@@ -103,6 +103,10 @@ CommandParser::CmdParser.new(ARGV) do
103
103
  helper.list_to_id(arg)
104
104
  end
105
105
 
106
+ set :format, :execid, 'Hook execution id' do |arg|
107
+ format_int(arg)
108
+ end
109
+
106
110
  ########################################################################
107
111
  # Hook log Options
108
112
  ########################################################################
data/bin/onehost CHANGED
@@ -355,7 +355,8 @@ CommandParser::CmdParser.new(ARGV) do
355
355
  end
356
356
 
357
357
  importvm_desc = <<-EOT.unindent
358
- Import VM to OpenNebula
358
+ Import wild VM to OpenNebula. This method is deprecated and will be \
359
+ removed in a future release.
359
360
  EOT
360
361
 
361
362
  command :importvm,
data/bin/oneimage CHANGED
@@ -149,7 +149,9 @@ CommandParser::CmdParser.new(ARGV) do
149
149
  end
150
150
 
151
151
  set :format, :imageid, OneImageHelper.to_id_desc do |arg|
152
- helper.to_id(arg)
152
+ tmp = helper.to_id(arg)
153
+ @current_image = tmp[1]
154
+ tmp
153
155
  end
154
156
 
155
157
  set :format, :imageid_list, OneImageHelper.list_to_id_desc do |arg|
@@ -170,6 +172,10 @@ CommandParser::CmdParser.new(ARGV) do
170
172
  end
171
173
  end
172
174
 
175
+ set :format, :snapshot_id, 'Snapshot name or id' do |arg|
176
+ helper.retrieve_snapshot_id(@current_image, arg)
177
+ end
178
+
173
179
  ########################################################################
174
180
  # Commands
175
181
  ########################################################################
data/bin/onevm CHANGED
@@ -320,7 +320,7 @@ CommandParser::CmdParser.new(ARGV) do
320
320
  helper.filterflag_to_i(arg)
321
321
  end
322
322
 
323
- set :format, :diskid, 'Integer' do |arg|
323
+ set :format, :diskid, 'Disk id' do |arg|
324
324
  format_int(arg)
325
325
  end
326
326
 
@@ -328,14 +328,30 @@ CommandParser::CmdParser.new(ARGV) do
328
328
  OpenNebulaHelper.size_in_mb(arg)
329
329
  end
330
330
 
331
- format :snapshot_id, 'Snapshot identifier' do |arg|
331
+ set :format, :snapshot_id, 'Snapshot name or id' do |arg|
332
332
  helper.retrieve_snapshot_id(@current_vm, arg)
333
333
  end
334
334
 
335
- format :disk_snapshot_id, 'Disk_snapshot identifier' do |arg|
335
+ set :format, :disk_snapshot_id, 'Disk_snapshot name or id' do |arg|
336
336
  helper.retrieve_disk_snapshot_id(@current_vm, arg)
337
337
  end
338
338
 
339
+ set :format, :nicid, 'NIC name or id' do |arg|
340
+ helper.retrieve_nic_id(@current_vm, arg)
341
+ end
342
+
343
+ set :format, :pciid, 'PCI id' do |arg|
344
+ format_int(arg)
345
+ end
346
+
347
+ set :format, :sched_id, 'Scheduled Action id' do |arg|
348
+ format_int(arg)
349
+ end
350
+
351
+ set :format, :sgid, 'Security Group id' do |arg|
352
+ format_int(arg)
353
+ end
354
+
339
355
  ########################################################################
340
356
  # Commands
341
357
  ########################################################################
@@ -647,7 +663,8 @@ CommandParser::CmdParser.new(ARGV) do
647
663
 
648
664
  migrate_desc = <<-EOT.unindent
649
665
  Migrates the given running VM to another Host. If used with --live
650
- parameter the miration is done without downtime.
666
+ parameter the migration is done without downtime. Datastore migration is
667
+ not supported for --live flag.
651
668
 
652
669
  States: RUNNING
653
670
  EOT
@@ -1282,6 +1299,35 @@ CommandParser::CmdParser.new(ARGV) do
1282
1299
  helper.show_resource(args[0], options)
1283
1300
  end
1284
1301
 
1302
+ disk_snapshot_list_desc = <<-EOT.unindent
1303
+ Lists the snapshots of a disk
1304
+ EOT
1305
+
1306
+ command :"disk-snapshot-list", disk_snapshot_list_desc, :vmid, :diskid do
1307
+ vm = helper.retrieve_resource(args[0])
1308
+ vm.info
1309
+
1310
+ if vm.has_elements?('/VM/SNAPSHOTS')
1311
+ filtered = []
1312
+ vm_hash = vm.to_hash
1313
+ vm_snapshots = [vm_hash['VM']['SNAPSHOTS']].flatten
1314
+
1315
+ vm_snapshots.each do |snap|
1316
+ if snap['DISK_ID'] == args[1]
1317
+ filtered << snap
1318
+ end
1319
+ end
1320
+
1321
+ vm_hash['VM']['SNAPSHOTS'] = filtered
1322
+
1323
+ CLIHelper.print_header('VM DISK SNAPSHOTS'.ljust(80), false)
1324
+ helper.format_snapshots(vm_hash)
1325
+ else
1326
+ puts 'No snapshots available in this disk'
1327
+ end
1328
+ 0
1329
+ end
1330
+
1285
1331
  top_desc = <<-EOT.unindent
1286
1332
  Lists Images continuously
1287
1333
  EOT
data/bin/onevmgroup CHANGED
@@ -121,7 +121,7 @@ CommandParser::CmdParser.new(ARGV) do
121
121
  helper.filterflag_to_i(arg)
122
122
  end
123
123
 
124
- format :roleid, 'Role identifier' do |arg|
124
+ set :format, :roleid, 'Role identifier' do |arg|
125
125
  helper.retrieve_role_id(@current_vmg, arg)
126
126
  end
127
127
 
data/bin/onevnet CHANGED
@@ -152,7 +152,7 @@ CommandParser::CmdParser.new(ARGV) do
152
152
  helper.filterflag_to_i(arg)
153
153
  end
154
154
 
155
- set :format, :ar_id, 'Integer' do |arg|
155
+ set :format, :ar_id, 'Address Range id' do |arg|
156
156
  format_int(arg)
157
157
  end
158
158
 
data/bin/onevrouter CHANGED
@@ -128,6 +128,10 @@ CommandParser::CmdParser.new(ARGV) do
128
128
  OpenNebulaHelper.rname_to_id(arg, 'VMTEMPLATE')
129
129
  end
130
130
 
131
+ set :format, :nicid, 'NIC id' do |arg|
132
+ format_int(arg)
133
+ end
134
+
131
135
  ########################################################################
132
136
  # Commands
133
137
  ########################################################################
data/bin/onezone CHANGED
@@ -91,13 +91,19 @@ CommandParser::CmdParser.new(ARGV) do
91
91
  # Formatters for arguments
92
92
  ########################################################################
93
93
  set :format, :zoneid, OneZoneHelper.to_id_desc do |arg|
94
- helper.to_id(arg)
94
+ tmp = helper.to_id(arg)
95
+ @current_zone = tmp[1]
96
+ tmp
95
97
  end
96
98
 
97
99
  set :format, :zoneid_list, OneZoneHelper.list_to_id_desc do |arg|
98
100
  helper.list_to_id(arg)
99
101
  end
100
102
 
103
+ set :format, :serverid, 'Server name or id' do |arg|
104
+ helper.retrieve_server_id(@current_zone, arg)
105
+ end
106
+
101
107
  ########################################################################
102
108
  # Commands
103
109
  ########################################################################
@@ -828,7 +828,7 @@ module CommandParser
828
828
  end
829
829
 
830
830
  def format_int(arg)
831
- arg.match(/^\d+$/) ? [0,arg] : [-1]
831
+ arg.match(/^\d+$/) ? [0,arg] : [-1, "Argument '#{arg}' is not a valid ID"]
832
832
  end
833
833
 
834
834
  def format_file(arg)
@@ -201,6 +201,22 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
201
201
  Image::SHORT_IMAGE_TYPES[type_str]
202
202
  end
203
203
 
204
+ def retrieve_snapshot_id(image_id, id)
205
+ return [0, id.to_i] if id =~ /\A\d+\z/
206
+
207
+ image = retrieve_resource(image_id)
208
+ image.info
209
+
210
+ ids = image.retrieve_elements(
211
+ "/IMAGE/SNAPSHOTS/SNAPSHOT[NAME='#{id}']/ID"
212
+ )
213
+
214
+ return [-1, "#{id} not found or duplicated"] \
215
+ if ids.nil? || ids.size > 1
216
+
217
+ [0, ids[0].to_i]
218
+ end
219
+
204
220
  def format_pool(options)
205
221
  config_file = self.class.table_conf
206
222
 
@@ -252,6 +252,19 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
252
252
  [0, ids[0].to_i]
253
253
  end
254
254
 
255
+ def retrieve_nic_id(vm_id, id)
256
+ return [0, id.to_i] if id =~ /\A\d+\z/
257
+
258
+ vm = retrieve_resource(vm_id)
259
+ vm.info
260
+ ids = vm.retrieve_elements("/VM/TEMPLATE/NIC[NAME='#{id}']/NIC_ID")
261
+
262
+ return [-1, "NIC #{id} not found or duplicated"] \
263
+ if ids.nil? || ids.size > 1
264
+
265
+ [0, ids[0].to_i]
266
+ end
267
+
255
268
  def format_pool(options)
256
269
  config_file = self.class.table_conf
257
270
 
@@ -1398,6 +1411,8 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1398
1411
  table.show(history)
1399
1412
  end
1400
1413
 
1414
+ public
1415
+
1401
1416
  def format_snapshots(vm)
1402
1417
  table = CLIHelper::ShowTable.new(nil, self) do
1403
1418
  column :AC, 'Is active', :left, :size => 2 do |d|
@@ -506,6 +506,22 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
506
506
  Zone::SHORT_ZONE_STATES[state_str]
507
507
  end
508
508
 
509
+ def retrieve_server_id(zone_id, id)
510
+ return [0, id.to_i] if id =~ /\A\d+\z/
511
+
512
+ zone = retrieve_resource(zone_id)
513
+ zone.info
514
+
515
+ ids = zone.retrieve_elements(
516
+ "/ZONE/SERVER_POOL/SERVER[NAME='#{id}']/ID"
517
+ )
518
+
519
+ return [-1, "#{id} not found or duplicated"] \
520
+ if ids.nil? || ids.size > 1
521
+
522
+ [0, ids[0].to_i]
523
+ end
524
+
509
525
  def format_pool(options)
510
526
  config_file = self.class.table_conf
511
527
 
@@ -13,7 +13,7 @@
13
13
  <xs:complexType>
14
14
  <xs:sequence>
15
15
  <xs:element name="POSITION" type="xs:integer"/>
16
- <xs:element name="TYPE" type="xs:string">
16
+ <xs:element name="TYPE">
17
17
  <xs:simpleType>
18
18
  <xs:restriction base="xs:string">
19
19
  <xs:enumeration value="IN"/>
@@ -21,7 +21,7 @@
21
21
  </xs:restriction>
22
22
  </xs:simpleType>
23
23
  </xs:element>
24
- <xs:element name="VALUE" type="xs:string"/>
24
+ <xs:element name="VALUE" type="xs:anyType"/>
25
25
  </xs:sequence>
26
26
  </xs:complexType>
27
27
  </xs:element>
@@ -1,6 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!-- This schema is followd by the EVENT API message sent by the Hook Manager -->
3
3
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://opennebula.org/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opennebula.org/XMLSchema">
4
+ <xs:include schemaLocation="api_info.xsd"/>
4
5
  <xs:element name="HOOK_MESSAGE">
5
6
  <xs:complexType>
6
7
  <xs:sequence>
@@ -1,5 +1,5 @@
1
- <!-- This schema is followd by the EVENT API message sent by the Hook Manager -->
2
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- This schema is followed by the EVENT API message sent by the Hook Manager -->
3
3
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://opennebula.org/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opennebula.org/XMLSchema">
4
4
  <xs:element name="HOOK_MESSAGE">
5
5
  <xs:complexType>
@@ -1,11 +1,15 @@
1
- <!-- This schema is followd by the EVENT API message sent by the Hook Manager -->
2
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- This schema is followed by the EVENT API message sent by the Hook Manager -->
3
3
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://opennebula.org/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opennebula.org/XMLSchema">
4
+ <xs:include schemaLocation="host.xsd"/>
5
+ <xs:include schemaLocation="vm.xsd"/>
6
+ <xs:include schemaLocation="image.xsd"/>
7
+ <xs:include schemaLocation="vnet.xsd"/>
4
8
  <xs:element name="HOOK_MESSAGE">
5
9
  <xs:complexType>
6
10
  <xs:sequence>
7
11
  <xs:element name="HOOK_TYPE" type="xs:string" fixed="STATE"/>
8
- <xs:element name="HOOK_OBJECT" type="xs:string">
12
+ <xs:element name="HOOK_OBJECT">
9
13
  <xs:simpleType>
10
14
  <xs:restriction base="xs:string">
11
15
  <xs:enumeration value="VM"/>
@@ -17,6 +21,7 @@
17
21
  </xs:element>
18
22
  <xs:element name="STATE" type="xs:string"/>
19
23
  <xs:element name="LCM_STATE" type="xs:string" maxOccurs="1" minOccurs="0"/>
24
+ <xs:element name="RESOURCE_ID" type="xs:integer"/>
20
25
  <xs:element name="REMOTE_HOST" type="xs:string" maxOccurs="1" minOccurs="0"/>
21
26
  <!-- The template of the resource (VM, Host, Image or VNet) is included here -->
22
27
  <xs:element ref="HOST" maxOccurs="1" minOccurs="0"/>
@@ -2,36 +2,40 @@
2
2
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
3
3
  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
4
4
  <xs:element name="ZONE_POOL">
5
- <xs:element name="ZONE" minOccurs="1" maxOccurs="unbounded">
6
- <xs:complexType>
7
- <xs:sequence>
8
- <xs:element name="ID" type="xs:integer"/>
9
- <xs:element name="NAME" type="xs:string"/>
10
- <xs:element name="STATE" type="xs:integer"/>
11
- <xs:element name="TEMPLATE">
12
- <xs:complexType>
13
- <xs:sequence>
14
- <xs:element name="ENDPOINT" type="xs:string"/>
15
- </xs:sequence>
16
- </xs:complexType>
17
- </xs:element>
18
- <xs:element name="SERVER_POOL">
19
- <xs:complexType>
20
- <xs:sequence>
21
- <xs:element name="SERVER" minOccurs="0" maxOccurs="unbounded">
22
- <xs:complexType>
23
- <xs:sequence>
24
- <xs:element name="ENDPOINT" type="xs:string"/>
25
- <xs:element name="ID" type="xs:integer"/>
26
- <xs:element name="NAME" type="xs:string"/>
27
- </xs:sequence>
28
- </xs:complexType>
29
- </xs:element>
30
- </xs:sequence>
31
- </xs:complexType>
32
- </xs:element>
33
- </xs:sequence>
34
- </xs:complexType>
35
- </xs:element>
5
+ <xs:complexType>
6
+ <xs:sequence>
7
+ <xs:element name="ZONE" minOccurs="1" maxOccurs="unbounded">
8
+ <xs:complexType>
9
+ <xs:sequence>
10
+ <xs:element name="ID" type="xs:integer"/>
11
+ <xs:element name="NAME" type="xs:string"/>
12
+ <xs:element name="STATE" type="xs:integer"/>
13
+ <xs:element name="TEMPLATE">
14
+ <xs:complexType>
15
+ <xs:sequence>
16
+ <xs:element name="ENDPOINT" type="xs:string"/>
17
+ </xs:sequence>
18
+ </xs:complexType>
19
+ </xs:element>
20
+ <xs:element name="SERVER_POOL">
21
+ <xs:complexType>
22
+ <xs:sequence>
23
+ <xs:element name="SERVER" minOccurs="0" maxOccurs="unbounded">
24
+ <xs:complexType>
25
+ <xs:sequence>
26
+ <xs:element name="ENDPOINT" type="xs:string"/>
27
+ <xs:element name="ID" type="xs:integer"/>
28
+ <xs:element name="NAME" type="xs:string"/>
29
+ </xs:sequence>
30
+ </xs:complexType>
31
+ </xs:element>
32
+ </xs:sequence>
33
+ </xs:complexType>
34
+ </xs:element>
35
+ </xs:sequence>
36
+ </xs:complexType>
37
+ </xs:element>
38
+ </xs:sequence>
39
+ </xs:complexType>
36
40
  </xs:element>
37
41
  </xs:schema>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.10.0
4
+ version: 6.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-28 00:00:00.000000000 Z
11
+ date: 2024-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.10.0
19
+ version: 6.10.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.10.0
26
+ version: 6.10.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement