opennebula-cli 6.8.1 → 6.8.3
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 +4 -4
- data/bin/onebackupjob +2 -2
- data/bin/onedatastore +2 -2
- data/bin/oneflow-template +4 -4
- data/bin/onehook +2 -2
- data/bin/oneimage +20 -13
- data/bin/onemarket +2 -2
- data/bin/onemarketapp +8 -6
- data/bin/onesecgroup +2 -2
- data/bin/onetemplate +15 -10
- data/bin/oneuser +1 -1
- data/bin/onevcenter +1 -1
- data/bin/onevm +89 -21
- data/bin/onevmgroup +4 -4
- data/bin/onevnet +5 -5
- data/bin/onevntemplate +4 -4
- data/bin/onevrouter +11 -9
- data/bin/onezone +2 -2
- data/lib/one_helper/onebackupjob_helper.rb +2 -2
- data/lib/one_helper/onehost_helper.rb +2 -0
- data/lib/one_helper/oneimage_helper.rb +13 -2
- data/lib/one_helper/onemarketapp_helper.rb +5 -4
- data/lib/one_helper/onevm_helper.rb +2 -2
- data/lib/one_helper.rb +17 -9
- data/share/schemas/xsd/vm_pool.xsd +24 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b06fb77f587c29ae6ccfdb865f506d009c722e26a51237357785839b3334c6a6
|
4
|
+
data.tar.gz: 5b7b61495a23c275884b89dd7416d1e7308cc95711b1091a20febc008ebb45c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecd05a6bbb986b52da8d323d1083d90d7142f9ac336bef379c183348a9f039ab94cc258b6735f3fd558a6c5eb41e55b5e36079292139b0844f30e4b183f2d88c
|
7
|
+
data.tar.gz: af89f17c3100ea494ea87e5fb9228779195d410c9b9ec3b2d9752a7db4c1b0359636a5aad9769d011ce67e751cdf1cd73d85dd89b7677f0176eb8525cd1ec411
|
data/bin/onebackupjob
CHANGED
@@ -147,8 +147,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
147
147
|
begin
|
148
148
|
if args[0]
|
149
149
|
template = File.read(args[0])
|
150
|
-
elsif
|
151
|
-
template =
|
150
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
151
|
+
template = stdin
|
152
152
|
else
|
153
153
|
template = OneBackupJobHelper.create_backupjob_template(options)
|
154
154
|
end
|
data/bin/onedatastore
CHANGED
@@ -115,8 +115,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
115
115
|
begin
|
116
116
|
if args[0]
|
117
117
|
template = File.read(args[0])
|
118
|
-
elsif
|
119
|
-
template =
|
118
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
119
|
+
template = stdin
|
120
120
|
end
|
121
121
|
datastore.allocate(template, cid)
|
122
122
|
rescue StandardError => e
|
data/bin/oneflow-template
CHANGED
@@ -189,8 +189,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
189
189
|
|
190
190
|
if args[0]
|
191
191
|
template = File.read(args[0])
|
192
|
-
elsif
|
193
|
-
template =
|
192
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
193
|
+
template = stdin
|
194
194
|
end
|
195
195
|
|
196
196
|
if !template
|
@@ -262,8 +262,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
262
262
|
|
263
263
|
if args[1]
|
264
264
|
template = File.read(args[1])
|
265
|
-
elsif
|
266
|
-
template =
|
265
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
266
|
+
template = stdin
|
267
267
|
end
|
268
268
|
params['merge_template'] = JSON.parse(template) if template
|
269
269
|
|
data/bin/onehook
CHANGED
@@ -176,8 +176,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
176
176
|
begin
|
177
177
|
if args[0]
|
178
178
|
template = File.read(args[0])
|
179
|
-
elsif
|
180
|
-
template =
|
179
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
180
|
+
template = stdin
|
181
181
|
else
|
182
182
|
STDERR.puts 'No hook template provided'
|
183
183
|
exit(-1)
|
data/bin/oneimage
CHANGED
@@ -121,6 +121,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
121
121
|
:description => 'Name of the new image'
|
122
122
|
}
|
123
123
|
|
124
|
+
DISK_ID = {
|
125
|
+
:name => 'disk_id',
|
126
|
+
:large => '--disk-id disk_id',
|
127
|
+
:format => Integer,
|
128
|
+
:description => 'Restore only selected disk ID'
|
129
|
+
}
|
130
|
+
|
124
131
|
########################################################################
|
125
132
|
# Global Options
|
126
133
|
########################################################################
|
@@ -210,16 +217,15 @@ CommandParser::CmdParser.new(ARGV) do
|
|
210
217
|
exit(-1)
|
211
218
|
end
|
212
219
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
220
|
+
no_check_capacity = !options[:no_check_capacity].nil?
|
221
|
+
|
222
|
+
conflicting_opts = []
|
223
|
+
if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
224
|
+
OneImageHelper.create_template_options_used?(options, conflicting_opts)
|
218
225
|
|
219
|
-
|
220
|
-
|
226
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
227
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
221
228
|
|
222
|
-
STDERR.puts 'You cannot use both template and template creation options.'
|
223
229
|
next -1
|
224
230
|
end
|
225
231
|
|
@@ -236,8 +242,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
236
242
|
begin
|
237
243
|
if args[0]
|
238
244
|
template = File.read(args[0])
|
239
|
-
elsif
|
240
|
-
template =
|
245
|
+
elsif !stdin.empty?
|
246
|
+
template = stdin
|
241
247
|
else
|
242
248
|
res = OneImageHelper.create_image_template(options)
|
243
249
|
|
@@ -254,7 +260,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
254
260
|
exit 0
|
255
261
|
end
|
256
262
|
|
257
|
-
image.allocate(template, options[:datastore],
|
263
|
+
image.allocate(template, options[:datastore], no_check_capacity)
|
258
264
|
rescue StandardError => e
|
259
265
|
STDERR.puts e.message
|
260
266
|
exit(-1)
|
@@ -454,7 +460,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
454
460
|
command :restore,
|
455
461
|
restore_desc,
|
456
462
|
:imageid,
|
457
|
-
:options => [OneDatastoreHelper::DATASTORE, NO_NIC, NO_IP, NAME, INCREMENT] do
|
463
|
+
:options => [OneDatastoreHelper::DATASTORE, NO_NIC, NO_IP, NAME, INCREMENT, DISK_ID] do
|
458
464
|
helper.perform_action(args[0], options, 'vm backup restored') do |o|
|
459
465
|
if options[:datastore].nil?
|
460
466
|
STDERR.puts 'Datastore to restore the backup is mandatory: '
|
@@ -468,13 +474,14 @@ CommandParser::CmdParser.new(ARGV) do
|
|
468
474
|
restore_opts << "NO_IP=\"YES\"\n" if options[:no_ip]
|
469
475
|
restore_opts << "NAME=\"#{options[:name]}\"\n" if options[:name]
|
470
476
|
restore_opts << "INCREMENT_ID=\"#{options[:increment]}\"\n" if options[:increment]
|
477
|
+
restore_opts << "DISK_ID=\"#{options[:disk_id]}\"\n" if options[:disk_id]
|
471
478
|
|
472
479
|
rc = o.restore(options[:datastore].to_i, restore_opts)
|
473
480
|
|
474
481
|
if !OpenNebula.is_error?(rc)
|
475
482
|
ids = rc.split(' ')
|
476
483
|
|
477
|
-
puts "VM Template: #{ids[0]}" if ids[0]
|
484
|
+
puts "VM Template: #{ids[0]}" if ids[0] && ids[0] != '-1'
|
478
485
|
puts "Images: #{ids[1..-1].join(' ')}" if ids.length > 1
|
479
486
|
else
|
480
487
|
puts rc.message
|
data/bin/onemarket
CHANGED
@@ -107,8 +107,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
107
107
|
begin
|
108
108
|
if args[0]
|
109
109
|
template = File.read(args[0])
|
110
|
-
elsif
|
111
|
-
template =
|
110
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
111
|
+
template = stdin
|
112
112
|
end
|
113
113
|
marketplace.allocate(template)
|
114
114
|
rescue StandardError => e
|
data/bin/onemarketapp
CHANGED
@@ -191,10 +191,12 @@ CommandParser::CmdParser.new(ARGV) do
|
|
191
191
|
exit(-1)
|
192
192
|
end
|
193
193
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
conflicting_opts = []
|
195
|
+
if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
196
|
+
OneMarketPlaceAppHelper.create_template_options_used?(options, conflicting_opts)
|
197
|
+
|
198
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
199
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
198
200
|
next -1
|
199
201
|
end
|
200
202
|
|
@@ -202,8 +204,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
202
204
|
begin
|
203
205
|
if args[0]
|
204
206
|
template = File.read(args[0])
|
205
|
-
elsif
|
206
|
-
template =
|
207
|
+
elsif !stdin.empty?
|
208
|
+
template = stdin
|
207
209
|
else
|
208
210
|
res = OneMarketPlaceAppHelper
|
209
211
|
.create_datastore_template(options)
|
data/bin/onesecgroup
CHANGED
@@ -112,8 +112,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
112
112
|
begin
|
113
113
|
if args[0]
|
114
114
|
template = File.read(args[0])
|
115
|
-
elsif
|
116
|
-
template =
|
115
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
116
|
+
template = stdin
|
117
117
|
else
|
118
118
|
STDERR.puts 'No Security Group description provided'
|
119
119
|
exit(-1)
|
data/bin/onetemplate
CHANGED
@@ -166,10 +166,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
166
166
|
command :create, create_desc, [:file, nil], :options =>
|
167
167
|
[OneTemplateHelper::VM_NAME] + OpenNebulaHelper::TEMPLATE_OPTIONS +
|
168
168
|
[OpenNebulaHelper::DRY] do
|
169
|
-
|
170
|
-
|
169
|
+
conflicting_opts = []
|
170
|
+
if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
171
|
+
OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
|
172
|
+
|
173
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
174
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
171
175
|
|
172
|
-
STDERR.puts 'You can not use both template file and template creation options.'
|
173
176
|
next -1
|
174
177
|
end
|
175
178
|
|
@@ -177,8 +180,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
177
180
|
begin
|
178
181
|
if args[0]
|
179
182
|
template = File.read(args[0])
|
180
|
-
elsif
|
181
|
-
template =
|
183
|
+
elsif !stdin.empty?
|
184
|
+
template = stdin
|
182
185
|
else
|
183
186
|
res = OpenNebulaHelper.create_template(options)
|
184
187
|
|
@@ -255,11 +258,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
255
258
|
command :instantiate, instantiate_desc, :templateid, [:file, nil],
|
256
259
|
:options => instantiate_options + OpenNebulaHelper::TEMPLATE_OPTIONS do
|
257
260
|
exit_code = 0
|
261
|
+
conflicting_opts = []
|
262
|
+
if (args[1] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
263
|
+
OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
|
258
264
|
|
259
|
-
|
260
|
-
|
265
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
266
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
261
267
|
|
262
|
-
STDERR.puts 'You cannot use both template and template creation options.'
|
263
268
|
next -1
|
264
269
|
end
|
265
270
|
|
@@ -305,8 +310,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
305
310
|
|
306
311
|
if args[1]
|
307
312
|
extra_template = File.read(args[1])
|
308
|
-
elsif
|
309
|
-
extra_template =
|
313
|
+
elsif !stdin.empty?
|
314
|
+
extra_template = stdin
|
310
315
|
else
|
311
316
|
res = OpenNebulaHelper.create_template(options, t)
|
312
317
|
|
data/bin/oneuser
CHANGED
@@ -621,7 +621,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
621
621
|
Example, request a valid token for a generic driver (e.g. core auth, LDAP...):
|
622
622
|
oneuser token-create my_user --time 3600
|
623
623
|
|
624
|
-
Example, request a group
|
624
|
+
Example, request a group specific token (new resources will be created in that
|
625
625
|
group and only resources that belong to that group will be listed):
|
626
626
|
oneuser token-create my_user --group <id|group>
|
627
627
|
|
data/bin/onevcenter
CHANGED
data/bin/onevm
CHANGED
@@ -349,19 +349,21 @@ CommandParser::CmdParser.new(ARGV) do
|
|
349
349
|
number = options[:multiple] || 1
|
350
350
|
exit_code = nil
|
351
351
|
|
352
|
-
|
353
|
-
|
352
|
+
conflicting_opts = []
|
353
|
+
if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
354
|
+
OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
|
355
|
+
|
356
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
357
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
354
358
|
|
355
|
-
STDERR.puts 'You can not use both template file and template'\
|
356
|
-
' creation options.'
|
357
359
|
exit(-1)
|
358
360
|
end
|
359
361
|
|
360
362
|
begin
|
361
363
|
if args[0]
|
362
364
|
template = File.read(args[0])
|
363
|
-
elsif
|
364
|
-
template =
|
365
|
+
elsif !stdin.empty?
|
366
|
+
template = stdin
|
365
367
|
else
|
366
368
|
res = OpenNebulaHelper.create_template(options)
|
367
369
|
|
@@ -615,8 +617,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
615
617
|
|
616
618
|
if options[:file]
|
617
619
|
extra_template = File.read(options[:file])
|
618
|
-
elsif
|
619
|
-
extra_template =
|
620
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
621
|
+
extra_template = stdin
|
620
622
|
end
|
621
623
|
|
622
624
|
helper.perform_actions(args[0], options, verbose) do |vm|
|
@@ -689,7 +691,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
689
691
|
end
|
690
692
|
|
691
693
|
resume_desc = <<-EOT.unindent
|
692
|
-
Resumes the execution of
|
694
|
+
Resumes the execution of a saved VM
|
693
695
|
|
694
696
|
States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF, UNKNOWN
|
695
697
|
EOT
|
@@ -718,7 +720,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
718
720
|
States for success/failure recovers: Any ACTIVE state.
|
719
721
|
States for a retry recover: Any *FAILURE state
|
720
722
|
States for delete: Any
|
721
|
-
States for
|
723
|
+
States for recreate: Any but DONE/POWEROFF/SUSPENDED
|
722
724
|
States for delete-db: Any
|
723
725
|
EOT
|
724
726
|
|
@@ -774,8 +776,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
774
776
|
TARGET, CACHE, DISCARD, PREFIX] do
|
775
777
|
if options[:file]
|
776
778
|
template = File.read(options[:file])
|
777
|
-
elsif
|
778
|
-
template =
|
779
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
780
|
+
template = stdin
|
779
781
|
elsif options[:image]
|
780
782
|
image_id = options[:image]
|
781
783
|
target = options[:target]
|
@@ -851,8 +853,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
851
853
|
] do
|
852
854
|
if options[:file]
|
853
855
|
template = File.read(options[:file])
|
854
|
-
elsif
|
855
|
-
template =
|
856
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
857
|
+
template = stdin
|
856
858
|
elsif options[:network]
|
857
859
|
network_id = options[:network]
|
858
860
|
ip = options[:ip]
|
@@ -1238,6 +1240,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1238
1240
|
|
1239
1241
|
if options[:xml]
|
1240
1242
|
puts pool.to_xml
|
1243
|
+
elsif options[:json]
|
1244
|
+
puts JSON.pretty_generate(pool.to_hash)
|
1245
|
+
elsif options[:yaml]
|
1246
|
+
puts pool.to_hash.to_yaml
|
1241
1247
|
else
|
1242
1248
|
table.show(pool.to_hash, options)
|
1243
1249
|
end
|
@@ -1276,8 +1282,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1276
1282
|
:options => OpenNebulaHelper::CAPACITY_OPTIONS_VM + [ENFORCE, OpenNebulaHelper::FILE] do
|
1277
1283
|
if options[:file]
|
1278
1284
|
template = File.read(options[:file])
|
1279
|
-
elsif
|
1280
|
-
template =
|
1285
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
1286
|
+
template = stdin
|
1281
1287
|
else
|
1282
1288
|
template = ''
|
1283
1289
|
|
@@ -1355,15 +1361,15 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1355
1361
|
|
1356
1362
|
The full list of configuration attributes are:
|
1357
1363
|
|
1358
|
-
OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "UUID"]
|
1364
|
+
OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "KERNEL_CMD", "ROOT", "SD_DISK_BUS", "UUID", "FIRMWARE"]
|
1359
1365
|
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT", "VIRTIO_SCSI_QUEUES", "VIRTIO_BLK_QUEUES", "IOTHREADS"]
|
1360
1366
|
INPUT = ["TYPE", "BUS"]
|
1361
|
-
GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
|
1367
|
+
GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP", "COMMAND"]
|
1362
1368
|
VIDEO = ["TYPE", "IOMMU", "ATS", "VRAM", "RESOLUTION"]
|
1363
1369
|
RAW = ["DATA", "DATA_VMX", "TYPE", "VALIDATE"]
|
1364
1370
|
CPU_MODEL = ["MODEL"]
|
1365
1371
|
BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE", "INCREMENT_MODE"]
|
1366
|
-
CONTEXT (any value, **variable substitution will be made**)
|
1372
|
+
CONTEXT (any value, except ETH*, **variable substitution will be made**)
|
1367
1373
|
EOT
|
1368
1374
|
|
1369
1375
|
command :updateconf, updateconf_desc, :vmid, [:file, nil],
|
@@ -1373,8 +1379,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1373
1379
|
begin
|
1374
1380
|
if args[1]
|
1375
1381
|
template = File.read(args[1])
|
1376
|
-
elsif
|
1377
|
-
template =
|
1382
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
1383
|
+
template = stdin
|
1378
1384
|
end
|
1379
1385
|
rescue StandardError => e
|
1380
1386
|
STDERR.puts "Error reading template: #{e.message}."
|
@@ -1608,6 +1614,68 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1608
1614
|
'-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
|
1609
1615
|
EOT
|
1610
1616
|
|
1617
|
+
pci_attach_desc = <<-EOT.unindent
|
1618
|
+
Attaches a PCI to a VM.
|
1619
|
+
|
1620
|
+
You can specify the PCI device with --pci (short_address) or
|
1621
|
+
--pci_device (device ID), --pci_class (class ID) and/or --pci_vendor (vendor ID).
|
1622
|
+
|
1623
|
+
States: POWEROFF
|
1624
|
+
EOT
|
1625
|
+
|
1626
|
+
command :"pci-attach", pci_attach_desc, :vmid,
|
1627
|
+
:options => [
|
1628
|
+
OpenNebulaHelper::FILE,
|
1629
|
+
PCI,
|
1630
|
+
PCI_CLASS,
|
1631
|
+
PCI_VENDOR,
|
1632
|
+
PCI_DEVICE
|
1633
|
+
] do
|
1634
|
+
pci_attrs = [:pci, :pci_device, :pci_vendor, :pci_class].any? do |o|
|
1635
|
+
!options[o].nil?
|
1636
|
+
end
|
1637
|
+
|
1638
|
+
if options[:file]
|
1639
|
+
template = File.read(options[:file])
|
1640
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
1641
|
+
template = stdin
|
1642
|
+
elsif pci_attrs
|
1643
|
+
pcia = options[:pci]
|
1644
|
+
pcid = options[:pci_device]
|
1645
|
+
pcic = options[:pci_class]
|
1646
|
+
pciv = options[:pci_vendor]
|
1647
|
+
|
1648
|
+
pcis = []
|
1649
|
+
pcis << "SHORT_ADDRESS = \"#{pcia}\"" if pcia
|
1650
|
+
pcis << "DEVICE = \"#{pcid}\"" if pcid
|
1651
|
+
pcis << "CLASS = \"#{pcic}\"" if pcic
|
1652
|
+
pcis << "VENDOR = \"#{pciv}\"" if pciv
|
1653
|
+
|
1654
|
+
template = "PCI = [ #{pcis.join(',')} ]"
|
1655
|
+
else
|
1656
|
+
STDERR.puts 'Provide a PCI description file with --file or the relevant pci options:'
|
1657
|
+
exit(-1)
|
1658
|
+
end
|
1659
|
+
|
1660
|
+
helper.perform_action(args[0], options, 'Attaching PCI device') do |vm|
|
1661
|
+
vm.pci_attach(template)
|
1662
|
+
end
|
1663
|
+
end
|
1664
|
+
|
1665
|
+
pci_detach_desc = <<-EOT.unindent
|
1666
|
+
Detaches a PCI device from a VM
|
1667
|
+
|
1668
|
+
States: POWEROFF
|
1669
|
+
EOT
|
1670
|
+
|
1671
|
+
command :"pci-detach", pci_detach_desc, :vmid, :pciid do
|
1672
|
+
pciid = args[1].to_i
|
1673
|
+
|
1674
|
+
helper.perform_action(args[0], options, 'Detaching PCI') do |vm|
|
1675
|
+
vm.pci_detach(pciid)
|
1676
|
+
end
|
1677
|
+
end
|
1678
|
+
|
1611
1679
|
command :ssh,
|
1612
1680
|
ssh_desc,
|
1613
1681
|
:vmid,
|
data/bin/onevmgroup
CHANGED
@@ -138,8 +138,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
138
138
|
begin
|
139
139
|
if args[0]
|
140
140
|
template = File.read(args[0])
|
141
|
-
elsif
|
142
|
-
template =
|
141
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
142
|
+
template = stdin
|
143
143
|
else
|
144
144
|
STDERR.puts 'No VM Group description provided'
|
145
145
|
exit(-1)
|
@@ -292,8 +292,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
292
292
|
begin
|
293
293
|
if args[1]
|
294
294
|
template = File.read(args[1])
|
295
|
-
elsif
|
296
|
-
template =
|
295
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
296
|
+
template = stdin
|
297
297
|
end
|
298
298
|
rescue StandardError => e
|
299
299
|
STDERR.puts "Error reading template: #{e.message}."
|
data/bin/onevnet
CHANGED
@@ -173,8 +173,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
173
173
|
begin
|
174
174
|
if args[0]
|
175
175
|
template = File.read(args[0])
|
176
|
-
elsif
|
177
|
-
template =
|
176
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
177
|
+
template = stdin
|
178
178
|
end
|
179
179
|
vn.allocate(template, cid)
|
180
180
|
rescue StandardError => e
|
@@ -203,8 +203,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
203
203
|
helper.perform_action(args[0], options, 'address range added') do |vn|
|
204
204
|
if args[1]
|
205
205
|
ar = File.read(args[1])
|
206
|
-
elsif
|
207
|
-
ar =
|
206
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
207
|
+
ar = stdin
|
208
208
|
else
|
209
209
|
ar = OpenNebulaHelper.create_ar(options)
|
210
210
|
end
|
@@ -479,7 +479,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
479
479
|
States for delete: Any but READY
|
480
480
|
EOT
|
481
481
|
|
482
|
-
command :recover, recover_desc, [:range, :
|
482
|
+
command :recover, recover_desc, [:range, :vnetid_list],
|
483
483
|
:options => [SUCCESS, FAILURE, DELETE, RETRY] do
|
484
484
|
if !options[:success].nil?
|
485
485
|
result = 1
|
data/bin/onevntemplate
CHANGED
@@ -161,8 +161,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
161
161
|
begin
|
162
162
|
if args[0]
|
163
163
|
template = File.read(args[0])
|
164
|
-
elsif
|
165
|
-
template =
|
164
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
165
|
+
template = stdin
|
166
166
|
end
|
167
167
|
|
168
168
|
if options[:dry]
|
@@ -256,8 +256,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
256
256
|
|
257
257
|
if args[1]
|
258
258
|
extra_template = File.read(args[1])
|
259
|
-
elsif
|
260
|
-
extra_template =
|
259
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
260
|
+
extra_template = stdin
|
261
261
|
else
|
262
262
|
res = OpenNebulaHelper.create_template(options, t)
|
263
263
|
|
data/bin/onevrouter
CHANGED
@@ -142,8 +142,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
142
142
|
begin
|
143
143
|
if args[0]
|
144
144
|
template = File.read(args[0])
|
145
|
-
elsif
|
146
|
-
template =
|
145
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
146
|
+
template = stdin
|
147
147
|
end
|
148
148
|
obj.allocate(template)
|
149
149
|
rescue StandardError => e
|
@@ -174,10 +174,12 @@ CommandParser::CmdParser.new(ARGV) do
|
|
174
174
|
:vrouterid, :templateid, [:file, nil],
|
175
175
|
:options => instantiate_options +
|
176
176
|
OpenNebulaHelper::TEMPLATE_OPTIONS do
|
177
|
-
|
178
|
-
|
177
|
+
conflicting_opts = []
|
178
|
+
if (args[2] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
179
|
+
OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
|
179
180
|
|
180
|
-
STDERR.puts 'You cannot
|
181
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
182
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
181
183
|
exit(-1)
|
182
184
|
end
|
183
185
|
|
@@ -201,8 +203,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
201
203
|
|
202
204
|
if args[2]
|
203
205
|
extra_template = File.read(args[2])
|
204
|
-
elsif
|
205
|
-
extra_template =
|
206
|
+
elsif !stdin.empty?
|
207
|
+
extra_template = stdin
|
206
208
|
else
|
207
209
|
res = OpenNebulaHelper.create_template(options, t)
|
208
210
|
|
@@ -307,8 +309,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
307
309
|
OneVirtualRouterHelper::FLOAT] do
|
308
310
|
if options[:file]
|
309
311
|
template = File.read(options[:file])
|
310
|
-
elsif
|
311
|
-
template =
|
312
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
313
|
+
template = stdin
|
312
314
|
elsif options[:network]
|
313
315
|
network_id = options[:network]
|
314
316
|
ip = options[:ip]
|
data/bin/onezone
CHANGED
@@ -111,8 +111,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
111
111
|
begin
|
112
112
|
if args[0]
|
113
113
|
template = File.read(args[0])
|
114
|
-
elsif
|
115
|
-
template =
|
114
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
115
|
+
template = stdin
|
116
116
|
else
|
117
117
|
STDERR.puts 'No zone template provided'
|
118
118
|
exit(-1)
|
@@ -155,8 +155,8 @@ class OneBackupJobHelper < OpenNebulaHelper::OneHelper
|
|
155
155
|
# Get user information
|
156
156
|
if file
|
157
157
|
str = File.read(file)
|
158
|
-
elsif
|
159
|
-
str =
|
158
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
159
|
+
str = stdin
|
160
160
|
else
|
161
161
|
str = OpenNebulaHelper.update_template(id, bj, nil, xpath)
|
162
162
|
end
|
@@ -794,6 +794,8 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
|
794
794
|
numa_nodes.each do |node|
|
795
795
|
mon_node = monitoring.find {|x| x['NODE_ID'] == node['NODE_ID'] }
|
796
796
|
|
797
|
+
next if mon_node.nil?
|
798
|
+
|
797
799
|
node['MEMORY']['FREE'] = mon_node['MEMORY']['FREE']
|
798
800
|
node['MEMORY']['USED'] = mon_node['MEMORY']['USED']
|
799
801
|
|
@@ -169,8 +169,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
|
169
169
|
:name => 'no_check_capacity',
|
170
170
|
:large => '--no_check_capacity',
|
171
171
|
:description =>
|
172
|
-
'
|
173
|
-
:format => String
|
172
|
+
'Do not check Datastore capacity, only for admins.'
|
174
173
|
}
|
175
174
|
|
176
175
|
FILTERS = [
|
@@ -518,6 +517,18 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
|
518
517
|
[0, template]
|
519
518
|
end
|
520
519
|
|
520
|
+
def create_template_options_used?(options, conflicting_opts)
|
521
|
+
# Get the template options names as symbols, options hash uses symbols
|
522
|
+
template_options=TEMPLATE_OPTIONS.map do |o|
|
523
|
+
o[:name].to_sym
|
524
|
+
end
|
525
|
+
|
526
|
+
# Check if one at least one of the template options is in options hash
|
527
|
+
conflicting_opts.replace(options.keys & template_options)
|
528
|
+
|
529
|
+
!conflicting_opts.empty?
|
530
|
+
end
|
531
|
+
|
521
532
|
end
|
522
533
|
|
523
534
|
end
|
@@ -129,16 +129,17 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
def self.create_template_options_used?(options)
|
132
|
+
def self.create_template_options_used?(options, conflicting_opts)
|
133
133
|
# Get the template options names as symbols. options hash
|
134
134
|
# uses symbols
|
135
135
|
template_options=self::TEMPLATE_OPTIONS.map do |o|
|
136
136
|
o[:name].to_sym
|
137
137
|
end
|
138
138
|
|
139
|
-
# Check if
|
140
|
-
|
141
|
-
|
139
|
+
# Check if at least one of the template options is in options hash
|
140
|
+
conflicting_opts.replace(options.keys & template_options)
|
141
|
+
|
142
|
+
!conflicting_opts.empty?
|
142
143
|
end
|
143
144
|
|
144
145
|
# Import object into marketplace
|
@@ -397,8 +397,8 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
397
397
|
# Get user information
|
398
398
|
if file
|
399
399
|
str = File.read(file)
|
400
|
-
elsif
|
401
|
-
str =
|
400
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
401
|
+
str = stdin
|
402
402
|
else
|
403
403
|
str = OpenNebulaHelper.update_template(vm_id, vm, nil, xpath)
|
404
404
|
end
|
data/lib/one_helper.rb
CHANGED
@@ -379,7 +379,7 @@ Bash symbols must be escaped on STDIN passing'
|
|
379
379
|
:name => 'context',
|
380
380
|
:large => '--context line1,line2,line3',
|
381
381
|
:format => Array,
|
382
|
-
:description => '
|
382
|
+
:description => 'Replaces the context section with the specified lines'
|
383
383
|
},
|
384
384
|
{
|
385
385
|
:name => 'boot',
|
@@ -1078,12 +1078,12 @@ Bash symbols must be escaped on STDIN passing'
|
|
1078
1078
|
elsif options[:xml]
|
1079
1079
|
return list_pool_xml(pool, options, filter_flag)
|
1080
1080
|
elsif options[:json]
|
1081
|
-
list_pool_format(pool, options, filter_flag) do |pool|
|
1081
|
+
return list_pool_format(pool, options, filter_flag) do |pool|
|
1082
1082
|
hash = check_resource_xsd(pool, pname)
|
1083
1083
|
puts ::JSON.pretty_generate(hash)
|
1084
1084
|
end
|
1085
1085
|
elsif options[:yaml]
|
1086
|
-
list_pool_format(pool, options, filter_flag) do |pool|
|
1086
|
+
return list_pool_format(pool, options, filter_flag) do |pool|
|
1087
1087
|
hash = check_resource_xsd(pool, pname)
|
1088
1088
|
puts hash.to_yaml(:indent => 4)
|
1089
1089
|
end
|
@@ -1712,8 +1712,8 @@ Bash symbols must be escaped on STDIN passing'
|
|
1712
1712
|
def self.update_template_helper(append, _id, resource, path, xpath, update = true)
|
1713
1713
|
if path
|
1714
1714
|
File.read(path)
|
1715
|
-
elsif
|
1716
|
-
|
1715
|
+
elsif !(stdin = self.read_stdin).empty?
|
1716
|
+
stdin
|
1717
1717
|
elsif append
|
1718
1718
|
editor_input
|
1719
1719
|
else
|
@@ -2095,16 +2095,17 @@ Bash symbols must be escaped on STDIN passing'
|
|
2095
2095
|
ar << ']'
|
2096
2096
|
end
|
2097
2097
|
|
2098
|
-
def self.create_template_options_used?(options)
|
2098
|
+
def self.create_template_options_used?(options, conflicting_opts)
|
2099
2099
|
# Get the template options names as symbols. options hash
|
2100
2100
|
# uses symbols
|
2101
2101
|
template_options=OpenNebulaHelper::TEMPLATE_OPTIONS.map do |o|
|
2102
2102
|
o[:name].to_sym
|
2103
2103
|
end
|
2104
2104
|
|
2105
|
-
# Check if
|
2106
|
-
|
2107
|
-
|
2105
|
+
# Check if at least one of the template options is in options hash
|
2106
|
+
conflicting_opts.replace(options.keys & template_options)
|
2107
|
+
|
2108
|
+
!conflicting_opts.empty?
|
2108
2109
|
end
|
2109
2110
|
|
2110
2111
|
def self.sunstone_url
|
@@ -2660,4 +2661,11 @@ Bash symbols must be escaped on STDIN passing'
|
|
2660
2661
|
end
|
2661
2662
|
end
|
2662
2663
|
|
2664
|
+
def self.read_stdin
|
2665
|
+
if STDIN.wait_readable(0)
|
2666
|
+
STDIN.read()
|
2667
|
+
else
|
2668
|
+
''
|
2669
|
+
end
|
2670
|
+
end
|
2663
2671
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
|
3
|
-
|
2
|
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opennebula.org/XMLSchema"
|
3
|
+
xmlns="http://opennebula.org/XMLSchema">
|
4
4
|
<xs:element name="VM_POOL">
|
5
5
|
<xs:complexType>
|
6
6
|
<xs:sequence>
|
@@ -60,6 +60,28 @@
|
|
60
60
|
<xs:element name="USER_TEMPLATE">
|
61
61
|
<xs:complexType>
|
62
62
|
<xs:sequence>
|
63
|
+
<xs:element name="LABELS" type="xs:string" minOccurs="0"/>
|
64
|
+
<xs:element name="ERROR" type="xs:string" minOccurs="0"/>
|
65
|
+
<xs:element name="SCHED_MESSAGE" type="xs:string" minOccurs="0"/>
|
66
|
+
<xs:element name="SCHED_RANK" type="xs:string" minOccurs="0"/>
|
67
|
+
<xs:element name="SCHED_DS_RANK" type="xs:string" minOccurs="0"/>
|
68
|
+
<xs:element name="SCHED_REQUIREMENTS" type="xs:string" minOccurs="0"/>
|
69
|
+
<xs:element name="SCHED_DS_REQUIREMENTS" type="xs:string" minOccurs="0"/>
|
70
|
+
<xs:element name="USER_PRIORITY" type="xs:string" minOccurs="0"/>
|
71
|
+
<xs:element name="PUBLIC_CLOUD" minOccurs="0" maxOccurs="unbounded">
|
72
|
+
<xs:complexType>
|
73
|
+
<xs:sequence>
|
74
|
+
<xs:any processContents="skip"/>
|
75
|
+
</xs:sequence>
|
76
|
+
</xs:complexType>
|
77
|
+
</xs:element>
|
78
|
+
<xs:element name="SCHED_ACTION" minOccurs="0" maxOccurs="unbounded">
|
79
|
+
<xs:complexType>
|
80
|
+
<xs:sequence>
|
81
|
+
<xs:any processContents="skip"/>
|
82
|
+
</xs:sequence>
|
83
|
+
</xs:complexType>
|
84
|
+
</xs:element>
|
63
85
|
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="skip"/>
|
64
86
|
</xs:sequence>
|
65
87
|
</xs:complexType>
|
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.8.
|
4
|
+
version: 6.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-21 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.8.
|
19
|
+
version: 6.8.3
|
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.8.
|
26
|
+
version: 6.8.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|