opennebula-cli 6.10.0 → 6.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d5d55565c52884d481345ee71a5d40d5bd7c94167b16d2ee531ab2e41ffed4d
4
- data.tar.gz: 25b6cc368e6576a8e5350875ebb970841667528c5d7264e509d38a9b1f542154
3
+ metadata.gz: 6e16b4ae09bc6027eed37b849e4be26e871cdff014d1858850f7aaf00d9382d6
4
+ data.tar.gz: 02a56e0e71ca7939bb166211d8e1fcffc694d0012d03af4e0effc3d418f69039
5
5
  SHA512:
6
- metadata.gz: 0a52a24316357d4b400bbbf157785612c9deac3684fc5d1f5418d9615382b305caeaea2dd934a36eb6f5e06d8f89aa81eae9f05577ac9f71a0cfa1930a83dd2e
7
- data.tar.gz: e7177952a258b2f78b7b17c0ccb88dd3cedd2ef14961087aefe21604e241561b8bf05ea917fcd5a896d8a879ce05187557c052db454ac49d45204e35c113ecdd
6
+ metadata.gz: a4e1ec4685a156226e45cae79603bd104badfc110bba23f912bd9b3fc068931718e439b8b4ebe1b7125946043156081a807f62e3b1b42ed2fc6f53f50ae77b0c
7
+ data.tar.gz: d82f045b25801d6d6b844766bbd7b8593a909e2f4dbe99ba125d062108a7e4e733b87ec9b1d8a7790634ba71c2964f93075be893bebe8e2098ff7ebb59463d82
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/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,7 @@ 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.
651
667
 
652
668
  States: RUNNING
653
669
  EOT
@@ -1282,6 +1298,35 @@ CommandParser::CmdParser.new(ARGV) do
1282
1298
  helper.show_resource(args[0], options)
1283
1299
  end
1284
1300
 
1301
+ disk_snapshot_list_desc = <<-EOT.unindent
1302
+ Lists the snapshots of a disk
1303
+ EOT
1304
+
1305
+ command :"disk-snapshot-list", disk_snapshot_list_desc, :vmid, :diskid do
1306
+ vm = helper.retrieve_resource(args[0])
1307
+ vm.info
1308
+
1309
+ if vm.has_elements?('/VM/SNAPSHOTS')
1310
+ filtered = []
1311
+ vm_hash = vm.to_hash
1312
+ vm_snapshots = [vm_hash['VM']['SNAPSHOTS']].flatten
1313
+
1314
+ vm_snapshots.each do |snap|
1315
+ if snap['DISK_ID'] == args[1]
1316
+ filtered << snap
1317
+ end
1318
+ end
1319
+
1320
+ vm_hash['VM']['SNAPSHOTS'] = filtered
1321
+
1322
+ CLIHelper.print_header('VM DISK SNAPSHOTS'.ljust(80), false)
1323
+ helper.format_snapshots(vm_hash)
1324
+ else
1325
+ puts 'No snapshots available in this disk'
1326
+ end
1327
+ 0
1328
+ end
1329
+
1285
1330
  top_desc = <<-EOT.unindent
1286
1331
  Lists Images continuously
1287
1332
  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.1
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-11-06 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.1
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.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement