opennebula-cli 5.12.12 → 5.13.80.pre
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 +5 -5
- data/bin/oneacct +4 -13
- data/bin/oneacl +3 -14
- data/bin/onecluster +5 -16
- data/bin/onedatastore +5 -16
- data/bin/oneflow +80 -22
- data/bin/oneflow-template +40 -17
- data/bin/onegroup +5 -16
- data/bin/onehook +5 -16
- data/bin/onehost +3 -14
- data/bin/oneimage +94 -17
- data/bin/onemarket +5 -16
- data/bin/onemarketapp +112 -19
- data/bin/onesecgroup +8 -16
- data/bin/oneshowback +13 -19
- data/bin/onetemplate +7 -17
- data/bin/oneuser +25 -16
- data/bin/onevcenter +5 -27
- data/bin/onevdc +5 -16
- data/bin/onevm +141 -20
- data/bin/onevmgroup +8 -16
- data/bin/onevnet +3 -14
- data/bin/onevntemplate +6 -16
- data/bin/onevrouter +5 -16
- data/bin/onezone +5 -16
- data/lib/cli_helper.rb +6 -9
- data/lib/one_helper/oneacct_helper.rb +8 -21
- data/lib/one_helper/onedatastore_helper.rb +10 -0
- data/lib/one_helper/oneflow_helper.rb +19 -4
- data/lib/one_helper/oneflowtemplate_helper.rb +27 -1
- data/lib/one_helper/onehost_helper.rb +0 -4
- data/lib/one_helper/oneimage_helper.rb +6 -6
- data/lib/one_helper/onemarketapp_helper.rb +493 -95
- data/lib/one_helper/onetemplate_helper.rb +11 -0
- data/lib/one_helper/oneuser_helper.rb +10 -2
- data/lib/one_helper/onevcenter_helper.rb +175 -145
- data/lib/one_helper/onevm_helper.rb +8 -8
- data/lib/one_helper/onevrouter_helper.rb +0 -19
- data/lib/one_helper/onezone_helper.rb +11 -0
- data/lib/one_helper.rb +396 -35
- data/share/schemas/xsd/acct.xsd +179 -0
- data/share/schemas/xsd/acl_pool.xsd +22 -0
- data/share/schemas/xsd/api_info.xsd +43 -0
- data/share/schemas/xsd/cluster.xsd +34 -0
- data/share/schemas/xsd/cluster_pool.xsd +12 -0
- data/share/schemas/xsd/datastore.xsd +67 -0
- data/share/schemas/xsd/datastore_pool.xsd +12 -0
- data/share/schemas/xsd/document.xsd +42 -0
- data/share/schemas/xsd/document_pool.xsd +12 -0
- data/share/schemas/xsd/group.xsd +179 -0
- data/share/schemas/xsd/group_pool.xsd +194 -0
- data/share/schemas/xsd/hook.xsd +59 -0
- data/share/schemas/xsd/hook_message_api.xsd +14 -0
- data/share/schemas/xsd/hook_message_retry.xsd +12 -0
- data/share/schemas/xsd/hook_message_state.xsd +25 -0
- data/share/schemas/xsd/hook_pool.xsd +12 -0
- data/share/schemas/xsd/host.xsd +164 -0
- data/share/schemas/xsd/host_pool.xsd +12 -0
- data/share/schemas/xsd/image.xsd +123 -0
- data/share/schemas/xsd/image_pool.xsd +12 -0
- data/share/schemas/xsd/index.xsd +49 -0
- data/share/schemas/xsd/marketplace.xsd +44 -0
- data/share/schemas/xsd/marketplace_pool.xsd +12 -0
- data/share/schemas/xsd/marketplaceapp.xsd +56 -0
- data/share/schemas/xsd/marketplaceapp_pool.xsd +12 -0
- data/share/schemas/xsd/opennebula_configuration.xsd +412 -0
- data/share/schemas/xsd/raftstatus.xsd +18 -0
- data/share/schemas/xsd/security_group.xsd +74 -0
- data/share/schemas/xsd/security_group_pool.xsd +12 -0
- data/share/schemas/xsd/showback.xsd +29 -0
- data/share/schemas/xsd/user.xsd +186 -0
- data/share/schemas/xsd/user_pool.xsd +201 -0
- data/share/schemas/xsd/vdc.xsd +76 -0
- data/share/schemas/xsd/vdc_pool.xsd +12 -0
- data/share/schemas/xsd/vm.xsd +251 -0
- data/share/schemas/xsd/vm_group.xsd +59 -0
- data/share/schemas/xsd/vm_group_pool.xsd +12 -0
- data/share/schemas/xsd/vm_pool.xsd +114 -0
- data/share/schemas/xsd/vmtemplate.xsd +52 -0
- data/share/schemas/xsd/vmtemplate_pool.xsd +12 -0
- data/share/schemas/xsd/vnet.xsd +137 -0
- data/share/schemas/xsd/vnet_pool.xsd +85 -0
- data/share/schemas/xsd/vntemplate.xsd +50 -0
- data/share/schemas/xsd/vntemplate_pool.xsd +12 -0
- data/share/schemas/xsd/vrouter.xsd +49 -0
- data/share/schemas/xsd/vrouter_pool.xsd +12 -0
- data/share/schemas/xsd/zone.xsd +40 -0
- data/share/schemas/xsd/zone_pool.xsd +36 -0
- metadata +92 -30
- data/lib/one_helper/oneprovision_helper.rb +0 -362
data/bin/onevcenter
CHANGED
|
@@ -28,25 +28,14 @@ else
|
|
|
28
28
|
REMOTES_LOCATION = ONE_LOCATION + '/var/remotes/'
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
|
32
31
|
if File.directory?(GEMS_LOCATION)
|
|
33
32
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
|
34
33
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
|
35
34
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
# https://github.com/OpenNebula/one/issues/5379
|
|
39
|
-
begin
|
|
40
|
-
verb = $VERBOSE
|
|
41
|
-
$VERBOSE = nil
|
|
42
|
-
require 'rubygems'
|
|
43
|
-
Gem.use_paths(real_gems_path)
|
|
44
|
-
ensure
|
|
45
|
-
$VERBOSE = verb
|
|
46
|
-
end
|
|
35
|
+
require 'rubygems'
|
|
36
|
+
Gem.use_paths(real_gems_path)
|
|
47
37
|
end
|
|
48
38
|
end
|
|
49
|
-
# %%RUBYGEMS_SETUP_END%%
|
|
50
39
|
|
|
51
40
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
|
52
41
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
|
@@ -271,21 +260,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
271
260
|
importer = VCenterDriver::VcImporter.new_child(helper.client,
|
|
272
261
|
vi_client,
|
|
273
262
|
options[:object])
|
|
263
|
+
importer.retrieve_resources(helper.parse_opts(options))
|
|
264
|
+
indexes = importer.get_indexes(args.first)
|
|
274
265
|
|
|
275
|
-
|
|
276
|
-
indexes = args.first
|
|
277
|
-
else
|
|
278
|
-
importer.retrieve_resources(helper.parse_opts(options))
|
|
279
|
-
indexes = importer.get_indexes(args.first)
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
if indexes.nil?
|
|
283
|
-
raise "Could not get any unimported #{options[:object]}"\
|
|
284
|
-
" resources info in host: #{options[:host]} with"\
|
|
285
|
-
" this input: #{args.first}"
|
|
286
|
-
end
|
|
287
|
-
|
|
288
|
-
importer.process_import(indexes, options)
|
|
266
|
+
importer.process_import(indexes)
|
|
289
267
|
|
|
290
268
|
importer.stdout
|
|
291
269
|
rescue StandardError => e
|
data/bin/onevdc
CHANGED
|
@@ -26,25 +26,14 @@ else
|
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
|
37
|
-
begin
|
|
38
|
-
verb = $VERBOSE
|
|
39
|
-
$VERBOSE = nil
|
|
40
|
-
require 'rubygems'
|
|
41
|
-
Gem.use_paths(real_gems_path)
|
|
42
|
-
ensure
|
|
43
|
-
$VERBOSE = verb
|
|
44
|
-
end
|
|
33
|
+
require 'rubygems'
|
|
34
|
+
Gem.use_paths(real_gems_path)
|
|
45
35
|
end
|
|
46
36
|
end
|
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
|
48
37
|
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
|
@@ -67,8 +56,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
67
56
|
########################################################################
|
|
68
57
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
|
69
58
|
|
|
70
|
-
list_options
|
|
71
|
-
list_options
|
|
59
|
+
list_options = CLIHelper::OPTIONS
|
|
60
|
+
list_options += OpenNebulaHelper::FORMAT
|
|
72
61
|
list_options << OpenNebulaHelper::NUMERIC
|
|
73
62
|
list_options << OpenNebulaHelper::DESCRIBE
|
|
74
63
|
|
|
@@ -311,7 +300,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
311
300
|
Shows information for the given VDC
|
|
312
301
|
EOT
|
|
313
302
|
|
|
314
|
-
command :show, show_desc, :vdcid, :options => OpenNebulaHelper::
|
|
303
|
+
command :show, show_desc, :vdcid, :options => OpenNebulaHelper::FORMAT do
|
|
315
304
|
helper.show_resource(args[0], options)
|
|
316
305
|
end
|
|
317
306
|
end
|
data/bin/onevm
CHANGED
|
@@ -26,31 +26,22 @@ else
|
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
|
37
|
-
begin
|
|
38
|
-
verb = $VERBOSE
|
|
39
|
-
$VERBOSE = nil
|
|
40
|
-
require 'rubygems'
|
|
41
|
-
Gem.use_paths(real_gems_path)
|
|
42
|
-
ensure
|
|
43
|
-
$VERBOSE = verb
|
|
44
|
-
end
|
|
33
|
+
require 'rubygems'
|
|
34
|
+
Gem.use_paths(real_gems_path)
|
|
45
35
|
end
|
|
46
36
|
end
|
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
|
48
37
|
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
|
51
40
|
|
|
52
41
|
require 'command_parser'
|
|
53
42
|
require 'one_helper/onevm_helper'
|
|
43
|
+
require 'one_helper/onedatastore_helper'
|
|
44
|
+
require 'opennebula/virtual_machine_ext'
|
|
54
45
|
|
|
55
46
|
CommandParser::CmdParser.new(ARGV) do
|
|
56
47
|
usage '`onevm` <command> [<args>] [<options>]'
|
|
@@ -190,6 +181,32 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
190
181
|
:description => 'lock all actions'
|
|
191
182
|
}
|
|
192
183
|
|
|
184
|
+
LOGGER = {
|
|
185
|
+
:name => 'logger',
|
|
186
|
+
:large => '--logger logger',
|
|
187
|
+
:format => String,
|
|
188
|
+
:description => 'Set logger to STDOUT or FILE'
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
KEEP = {
|
|
192
|
+
:name => 'keep',
|
|
193
|
+
:large => '--keep-backup',
|
|
194
|
+
:description => 'Keep previous backup when creating a new one'
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
ONESHOT = {
|
|
198
|
+
:name => 'oneshot',
|
|
199
|
+
:large => '--oneshot',
|
|
200
|
+
:description => 'Take an snapshot of the VM without saving backup info'
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
MARKET = {
|
|
204
|
+
:name => 'market',
|
|
205
|
+
:large => '--market market_id',
|
|
206
|
+
:format => Integer,
|
|
207
|
+
:description => 'Market to save oneshot'
|
|
208
|
+
}
|
|
209
|
+
|
|
193
210
|
########################################################################
|
|
194
211
|
# Global Options
|
|
195
212
|
########################################################################
|
|
@@ -1166,7 +1183,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
1166
1183
|
EOT
|
|
1167
1184
|
|
|
1168
1185
|
command :show, show_desc, :vmid,
|
|
1169
|
-
:options => [OpenNebulaHelper::
|
|
1186
|
+
:options => [OpenNebulaHelper::FORMAT,
|
|
1170
1187
|
OpenNebulaHelper::DECRYPT,
|
|
1171
1188
|
OneVMHelper::ALL_TEMPLATE] do
|
|
1172
1189
|
helper.show_resource(args[0], options)
|
|
@@ -1224,7 +1241,11 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
1224
1241
|
|
|
1225
1242
|
command :save, save_desc, :vmid, :name, :options => [PERSISTENT] do
|
|
1226
1243
|
helper.perform_action(args[0], options, 'Saving VM') do |vm|
|
|
1227
|
-
|
|
1244
|
+
vm.extend(VirtualMachineExt)
|
|
1245
|
+
|
|
1246
|
+
res = vm.save_as_template(args[1],
|
|
1247
|
+
'',
|
|
1248
|
+
:persistent => options[:persistent])
|
|
1228
1249
|
|
|
1229
1250
|
if !OpenNebula.is_error?(res)
|
|
1230
1251
|
puts "Template ID: #{res}"
|
|
@@ -1235,15 +1256,16 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
1235
1256
|
end
|
|
1236
1257
|
|
|
1237
1258
|
updateconf_desc = <<-EOT.unindent
|
|
1238
|
-
Updates the configuration of a VM.
|
|
1239
|
-
|
|
1240
|
-
|
|
1259
|
+
Updates the configuration of a VM. Valid states are: running, pending,
|
|
1260
|
+
failure, poweroff, undeploy, hold or cloning.
|
|
1261
|
+
In running state only changes in CONTEXT take effect immediately,
|
|
1262
|
+
other values may need a VM restart.
|
|
1241
1263
|
|
|
1242
1264
|
This command accepts a template file or opens an editor, the full list of
|
|
1243
1265
|
configuration attributes are:
|
|
1244
1266
|
|
|
1245
|
-
OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT"]
|
|
1246
|
-
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT"]
|
|
1267
|
+
OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "UUID"]
|
|
1268
|
+
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT", "IOTHREADS"]
|
|
1247
1269
|
INPUT = ["TYPE", "BUS"]
|
|
1248
1270
|
GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
|
|
1249
1271
|
RAW = ["DATA", "DATA_VMX", "TYPE"]
|
|
@@ -1397,6 +1419,105 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
1397
1419
|
0
|
|
1398
1420
|
end
|
|
1399
1421
|
|
|
1422
|
+
backup_vm_desc = <<-EOT.unindent
|
|
1423
|
+
Creates a VM backup and stores it in the marketplace
|
|
1424
|
+
EOT
|
|
1425
|
+
|
|
1426
|
+
command :backup,
|
|
1427
|
+
backup_vm_desc,
|
|
1428
|
+
:vmid,
|
|
1429
|
+
:options => [LOGGER, KEEP, ONESHOT, MARKET] do
|
|
1430
|
+
require 'logger'
|
|
1431
|
+
|
|
1432
|
+
if options.key?(:oneshot) && !options.key?(:market)
|
|
1433
|
+
STDERR.puts 'ERROR: no market given'
|
|
1434
|
+
exit(-1)
|
|
1435
|
+
end
|
|
1436
|
+
|
|
1437
|
+
helper.perform_action(args[0], options, 'Backup') do |vm|
|
|
1438
|
+
vm.extend(OpenNebula::VirtualMachineExt)
|
|
1439
|
+
|
|
1440
|
+
# If logger is specified use it, if not use STDOUT
|
|
1441
|
+
options[:logger].nil? ? log_to = STDOUT : log_to = options[:logger]
|
|
1442
|
+
|
|
1443
|
+
# Read user options
|
|
1444
|
+
keep = options.key?(:keep)
|
|
1445
|
+
logger = Logger.new(log_to)
|
|
1446
|
+
format = '%Y-%m-%d %H:%M:%S'
|
|
1447
|
+
|
|
1448
|
+
logger.formatter = proc do |severity, datetime, _p, msg|
|
|
1449
|
+
"#{datetime.strftime(format)} #{severity.ljust(5)} : #{msg}\n"
|
|
1450
|
+
end
|
|
1451
|
+
|
|
1452
|
+
if options.key?(:oneshot)
|
|
1453
|
+
binfo = {}
|
|
1454
|
+
binfo[:name] = "VM #{vm.id} BACKUP - " \
|
|
1455
|
+
"#{Time.now.strftime('%Y%m%d_%k%M')}"
|
|
1456
|
+
binfo[:freq] = 1
|
|
1457
|
+
binfo[:last] = Time.now.to_i - 100
|
|
1458
|
+
binfo[:market] = options[:market]
|
|
1459
|
+
end
|
|
1460
|
+
|
|
1461
|
+
begin
|
|
1462
|
+
rc = vm.backup(keep, logger, binfo)
|
|
1463
|
+
|
|
1464
|
+
if OpenNebula.is_error?(rc)
|
|
1465
|
+
STDERR.puts rc.message
|
|
1466
|
+
exit(-1)
|
|
1467
|
+
else
|
|
1468
|
+
0
|
|
1469
|
+
end
|
|
1470
|
+
rescue StandardError => e
|
|
1471
|
+
STDERR.puts e
|
|
1472
|
+
exit(-1)
|
|
1473
|
+
end
|
|
1474
|
+
end
|
|
1475
|
+
end
|
|
1476
|
+
|
|
1477
|
+
restore_vm_desc = <<-EOT.unindent
|
|
1478
|
+
Restores a VM from a previous backup
|
|
1479
|
+
EOT
|
|
1480
|
+
|
|
1481
|
+
command :restore,
|
|
1482
|
+
restore_vm_desc,
|
|
1483
|
+
:vmid,
|
|
1484
|
+
:options => [OneDatastoreHelper::DATASTORE, LOGGER] do
|
|
1485
|
+
require 'logger'
|
|
1486
|
+
|
|
1487
|
+
unless options[:datastore]
|
|
1488
|
+
STDERR.puts 'ERROR: no datastore given'
|
|
1489
|
+
exit(-1)
|
|
1490
|
+
end
|
|
1491
|
+
|
|
1492
|
+
helper.perform_action(args[0], options, 'Restore') do |vm|
|
|
1493
|
+
vm.extend(OpenNebula::VirtualMachineExt)
|
|
1494
|
+
|
|
1495
|
+
# If logger is specified use it, if not use STDOUT
|
|
1496
|
+
options[:logger].nil? ? log_to = STDOUT : log_to = options[:logger]
|
|
1497
|
+
logger = Logger.new(log_to)
|
|
1498
|
+
format = '%Y-%m-%d %H:%M:%S'
|
|
1499
|
+
|
|
1500
|
+
logger.formatter = proc do |severity, datetime, _p, msg|
|
|
1501
|
+
"#{datetime.strftime(format)} #{severity.ljust(5)} : #{msg}\n"
|
|
1502
|
+
end
|
|
1503
|
+
|
|
1504
|
+
begin
|
|
1505
|
+
rc = vm.restore(options[:datastore], logger)
|
|
1506
|
+
|
|
1507
|
+
if OpenNebula.is_error?(rc)
|
|
1508
|
+
STDERR.puts rc.message
|
|
1509
|
+
exit(-1)
|
|
1510
|
+
else
|
|
1511
|
+
puts "ID: #{rc}"
|
|
1512
|
+
0
|
|
1513
|
+
end
|
|
1514
|
+
rescue StandardError => e
|
|
1515
|
+
STDERR.puts e
|
|
1516
|
+
exit(-1)
|
|
1517
|
+
end
|
|
1518
|
+
end
|
|
1519
|
+
end
|
|
1520
|
+
|
|
1400
1521
|
# Deprecated commands
|
|
1401
1522
|
|
|
1402
1523
|
deprecated_command(:shutdown, 'terminate')
|
data/bin/onevmgroup
CHANGED
|
@@ -26,25 +26,14 @@ else
|
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
|
37
|
-
begin
|
|
38
|
-
verb = $VERBOSE
|
|
39
|
-
$VERBOSE = nil
|
|
40
|
-
require 'rubygems'
|
|
41
|
-
Gem.use_paths(real_gems_path)
|
|
42
|
-
ensure
|
|
43
|
-
$VERBOSE = verb
|
|
44
|
-
end
|
|
33
|
+
require 'rubygems'
|
|
34
|
+
Gem.use_paths(real_gems_path)
|
|
45
35
|
end
|
|
46
36
|
end
|
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
|
48
37
|
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
|
@@ -91,8 +80,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
91
80
|
########################################################################
|
|
92
81
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
|
93
82
|
|
|
94
|
-
list_options
|
|
95
|
-
list_options
|
|
83
|
+
list_options = CLIHelper::OPTIONS
|
|
84
|
+
list_options += OpenNebulaHelper::FORMAT
|
|
96
85
|
list_options << OpenNebulaHelper::NUMERIC
|
|
97
86
|
list_options << OpenNebulaHelper::DESCRIBE
|
|
98
87
|
|
|
@@ -162,7 +151,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
162
151
|
Shows information for the given VM Group
|
|
163
152
|
EOT
|
|
164
153
|
|
|
165
|
-
command :show,
|
|
154
|
+
command :show,
|
|
155
|
+
show_desc,
|
|
156
|
+
:vmgroupid,
|
|
157
|
+
:options => OpenNebulaHelper::FORMAT do
|
|
166
158
|
helper.show_resource(args[0], options)
|
|
167
159
|
end
|
|
168
160
|
|
data/bin/onevnet
CHANGED
|
@@ -26,25 +26,14 @@ else
|
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
|
37
|
-
begin
|
|
38
|
-
verb = $VERBOSE
|
|
39
|
-
$VERBOSE = nil
|
|
40
|
-
require 'rubygems'
|
|
41
|
-
Gem.use_paths(real_gems_path)
|
|
42
|
-
ensure
|
|
43
|
-
$VERBOSE = verb
|
|
44
|
-
end
|
|
33
|
+
require 'rubygems'
|
|
34
|
+
Gem.use_paths(real_gems_path)
|
|
45
35
|
end
|
|
46
36
|
end
|
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
|
48
37
|
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
|
@@ -334,7 +323,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
334
323
|
EOT
|
|
335
324
|
|
|
336
325
|
command :show, show_desc, :vnetid,
|
|
337
|
-
:options => [OpenNebulaHelper::
|
|
326
|
+
:options => [OpenNebulaHelper::FORMAT,
|
|
338
327
|
OpenNebulaHelper::DECRYPT,
|
|
339
328
|
OneVNetHelper::SHOW_AR] do
|
|
340
329
|
helper.show_resource(args[0], options)
|
data/bin/onevntemplate
CHANGED
|
@@ -26,25 +26,14 @@ else
|
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
|
37
|
-
begin
|
|
38
|
-
verb = $VERBOSE
|
|
39
|
-
$VERBOSE = nil
|
|
40
|
-
require 'rubygems'
|
|
41
|
-
Gem.use_paths(real_gems_path)
|
|
42
|
-
ensure
|
|
43
|
-
$VERBOSE = verb
|
|
44
|
-
end
|
|
33
|
+
require 'rubygems'
|
|
34
|
+
Gem.use_paths(real_gems_path)
|
|
45
35
|
end
|
|
46
36
|
end
|
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
|
48
37
|
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
|
@@ -92,8 +81,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
92
81
|
########################################################################
|
|
93
82
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
|
94
83
|
|
|
95
|
-
list_options
|
|
96
|
-
list_options
|
|
84
|
+
list_options = CLIHelper::OPTIONS
|
|
85
|
+
list_options += OpenNebulaHelper::FORMAT
|
|
97
86
|
list_options << OpenNebulaHelper::NUMERIC
|
|
98
87
|
list_options << OpenNebulaHelper::DESCRIBE
|
|
99
88
|
|
|
@@ -327,7 +316,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
327
316
|
EOT
|
|
328
317
|
|
|
329
318
|
command :show, show_desc, :templateid,
|
|
330
|
-
:options => [OpenNebulaHelper::
|
|
319
|
+
:options => [OpenNebulaHelper::FORMAT,
|
|
320
|
+
OneTemplateHelper::EXTENDED] do
|
|
331
321
|
helper.show_resource(args[0], options)
|
|
332
322
|
end
|
|
333
323
|
|
data/bin/onevrouter
CHANGED
|
@@ -26,25 +26,14 @@ else
|
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
|
37
|
-
begin
|
|
38
|
-
verb = $VERBOSE
|
|
39
|
-
$VERBOSE = nil
|
|
40
|
-
require 'rubygems'
|
|
41
|
-
Gem.use_paths(real_gems_path)
|
|
42
|
-
ensure
|
|
43
|
-
$VERBOSE = verb
|
|
44
|
-
end
|
|
33
|
+
require 'rubygems'
|
|
34
|
+
Gem.use_paths(real_gems_path)
|
|
45
35
|
end
|
|
46
36
|
end
|
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
|
48
37
|
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
|
@@ -93,8 +82,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
93
82
|
########################################################################
|
|
94
83
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
|
95
84
|
|
|
96
|
-
list_options
|
|
97
|
-
list_options
|
|
85
|
+
list_options = CLIHelper::OPTIONS
|
|
86
|
+
list_options += OpenNebulaHelper::FORMAT
|
|
98
87
|
list_options << OpenNebulaHelper::NUMERIC
|
|
99
88
|
list_options << OpenNebulaHelper::DESCRIBE
|
|
100
89
|
|
|
@@ -353,7 +342,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
353
342
|
EOT
|
|
354
343
|
|
|
355
344
|
command :show, show_desc, :vrouterid,
|
|
356
|
-
:options => [OpenNebulaHelper::
|
|
345
|
+
:options => [OpenNebulaHelper::FORMAT, OneVMHelper::ALL_TEMPLATE] do
|
|
357
346
|
helper.show_resource(args[0], options)
|
|
358
347
|
end
|
|
359
348
|
|
data/bin/onezone
CHANGED
|
@@ -26,25 +26,14 @@ else
|
|
|
26
26
|
GEMS_LOCATION = ONE_LOCATION + '/share/gems'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# %%RUBYGEMS_SETUP_BEGIN%%
|
|
30
29
|
if File.directory?(GEMS_LOCATION)
|
|
31
30
|
real_gems_path = File.realpath(GEMS_LOCATION)
|
|
32
31
|
if !defined?(Gem) || Gem.path != [real_gems_path]
|
|
33
32
|
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# https://github.com/OpenNebula/one/issues/5379
|
|
37
|
-
begin
|
|
38
|
-
verb = $VERBOSE
|
|
39
|
-
$VERBOSE = nil
|
|
40
|
-
require 'rubygems'
|
|
41
|
-
Gem.use_paths(real_gems_path)
|
|
42
|
-
ensure
|
|
43
|
-
$VERBOSE = verb
|
|
44
|
-
end
|
|
33
|
+
require 'rubygems'
|
|
34
|
+
Gem.use_paths(real_gems_path)
|
|
45
35
|
end
|
|
46
36
|
end
|
|
47
|
-
# %%RUBYGEMS_SETUP_END%%
|
|
48
37
|
|
|
49
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
|
50
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
|
@@ -82,8 +71,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
82
71
|
########################################################################
|
|
83
72
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
|
84
73
|
|
|
85
|
-
list_options
|
|
86
|
-
list_options
|
|
74
|
+
list_options = CLIHelper::OPTIONS
|
|
75
|
+
list_options += OpenNebulaHelper::FORMAT
|
|
87
76
|
list_options << OpenNebulaHelper::NUMERIC
|
|
88
77
|
list_options << OpenNebulaHelper::DESCRIBE
|
|
89
78
|
|
|
@@ -222,7 +211,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
222
211
|
Shows information for the given Zone
|
|
223
212
|
EOT
|
|
224
213
|
|
|
225
|
-
command :show, show_desc, :zoneid, :options => OpenNebulaHelper::
|
|
214
|
+
command :show, show_desc, :zoneid, :options => OpenNebulaHelper::FORMAT do
|
|
226
215
|
helper.show_resource(args[0], options)
|
|
227
216
|
end
|
|
228
217
|
|
data/lib/cli_helper.rb
CHANGED
|
@@ -61,8 +61,7 @@ module CLIHelper
|
|
|
61
61
|
' ' * 31 << 'column=value pairs.' <<
|
|
62
62
|
' ' * 31 << "Valid operators #{FILTER_OPS.join(',')}" <<
|
|
63
63
|
' ' * 31 << 'e.g. NAME=test (match name with test)' <<
|
|
64
|
-
' ' * 31 << 'NAME~test (match
|
|
65
|
-
' ' * 31 << 'the substring \'test\')'
|
|
64
|
+
' ' * 31 << 'NAME~test (match test, te, tes..)'
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
OPERATOR = {
|
|
@@ -182,7 +181,7 @@ module CLIHelper
|
|
|
182
181
|
ANSI_YELLOW = "\33[33m"
|
|
183
182
|
|
|
184
183
|
# CLI states
|
|
185
|
-
OK_STATES = %w[runn rdy on
|
|
184
|
+
OK_STATES = %w[runn rdy on SUCCESS RUNNING]
|
|
186
185
|
BAD_STATES = %w[fail
|
|
187
186
|
err
|
|
188
187
|
error
|
|
@@ -190,7 +189,7 @@ module CLIHelper
|
|
|
190
189
|
FAILED_DEPLOYING
|
|
191
190
|
FAILED_UNDEPLOYING
|
|
192
191
|
FAILED_SCALING]
|
|
193
|
-
REGULAR_STATES = %w[
|
|
192
|
+
REGULAR_STATES = %w[PENDING DEPLOYING CONFIGURING WARNING]
|
|
194
193
|
|
|
195
194
|
# Set state color
|
|
196
195
|
#
|
|
@@ -358,14 +357,14 @@ module CLIHelper
|
|
|
358
357
|
# @param options [Hash] Object with CLI user options
|
|
359
358
|
# @param top [Boolean] True to not update columns again
|
|
360
359
|
def show(data, options = {}, top = false)
|
|
361
|
-
update_columns(options) unless top
|
|
362
|
-
|
|
363
360
|
if options[:list]
|
|
364
361
|
@cli_columns = options[:list].collect {|o| o.upcase.to_sym }
|
|
365
362
|
else
|
|
366
363
|
@cli_columns = @default_columns
|
|
367
364
|
end
|
|
368
365
|
|
|
366
|
+
update_columns(options) unless top
|
|
367
|
+
|
|
369
368
|
if data.is_a? Hash
|
|
370
369
|
@data = data
|
|
371
370
|
|
|
@@ -600,9 +599,7 @@ module CLIHelper
|
|
|
600
599
|
end
|
|
601
600
|
end
|
|
602
601
|
|
|
603
|
-
if options
|
|
604
|
-
filter_data!(res_data, options) if options[:filter]
|
|
605
|
-
end
|
|
602
|
+
filter_data!(res_data, options) if options && options[:filter]
|
|
606
603
|
|
|
607
604
|
res_data
|
|
608
605
|
end
|
|
@@ -91,28 +91,19 @@ class AcctHelper < OpenNebulaHelper::OneHelper
|
|
|
91
91
|
:format => String
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
XML = {
|
|
95
|
-
:name => "xml",
|
|
96
|
-
:short => "-x",
|
|
97
|
-
:large => "--xml",
|
|
98
|
-
:description => "Show the resource in xml format"
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
JSON = {
|
|
102
|
-
:name => "json",
|
|
103
|
-
:short => "-j",
|
|
104
|
-
:large => "--json",
|
|
105
|
-
:description => "Show the resource in json format"
|
|
106
|
-
}
|
|
107
|
-
|
|
108
94
|
SPLIT={
|
|
109
95
|
:name => "split",
|
|
110
96
|
:large => "--split",
|
|
111
97
|
:description => "Split the output in a table for each VM"
|
|
112
98
|
}
|
|
113
99
|
|
|
114
|
-
ACCT_OPTIONS = [START_TIME_ACCT, END_TIME_ACCT, USERFILTER, GROUP, HOST, XPATH,
|
|
115
|
-
SHOWBACK_OPTIONS = [START_TIME_SHOWBACK, END_TIME_SHOWBACK, USERFILTER, GROUP
|
|
100
|
+
ACCT_OPTIONS = [START_TIME_ACCT, END_TIME_ACCT, USERFILTER, GROUP, HOST, XPATH, SPLIT]
|
|
101
|
+
SHOWBACK_OPTIONS = [START_TIME_SHOWBACK, END_TIME_SHOWBACK, USERFILTER, GROUP]
|
|
102
|
+
|
|
103
|
+
ACCT_OPTIONS << OpenNebulaHelper::XML
|
|
104
|
+
ACCT_OPTIONS << OpenNebulaHelper::JSON
|
|
105
|
+
|
|
106
|
+
SHOWBACK_OPTIONS += OpenNebulaHelper::FORMAT
|
|
116
107
|
|
|
117
108
|
ACCT_TABLE = CLIHelper::ShowTable.new(self.table_conf("oneacct.yaml"), nil) do
|
|
118
109
|
column :UID, "User ID", :size=>4 do |d|
|
|
@@ -227,15 +218,11 @@ class AcctHelper < OpenNebulaHelper::OneHelper
|
|
|
227
218
|
d["HOURS"]
|
|
228
219
|
end
|
|
229
220
|
|
|
230
|
-
column :RUNNING_HOURS, "Running hours", :size=>7 do |d|
|
|
231
|
-
d["RHOURS"] || '-'
|
|
232
|
-
end
|
|
233
|
-
|
|
234
221
|
column :COST, "Cost", :size=>15 do |d|
|
|
235
222
|
d["TOTAL_COST"]
|
|
236
223
|
end
|
|
237
224
|
|
|
238
|
-
default :USER_NAME, :GROUP_NAME, :VM_ID, :VM_NAME, :MONTH, :YEAR, :HOURS, :
|
|
225
|
+
default :USER_NAME, :GROUP_NAME, :VM_ID, :VM_NAME, :MONTH, :YEAR, :HOURS, :COST
|
|
239
226
|
end
|
|
240
227
|
|
|
241
228
|
def self.print_start_end_time_header(start_time, end_time)
|
|
@@ -28,6 +28,16 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
FILE_DATASTORE = {
|
|
32
|
+
:name => "file_datastore",
|
|
33
|
+
:large => "--file-datastore id|name" ,
|
|
34
|
+
:description => "Selects the file datastore",
|
|
35
|
+
:format => String,
|
|
36
|
+
:proc => lambda { |o, options|
|
|
37
|
+
OpenNebulaHelper.rname_to_id(o, "DATASTORE")
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
def self.rname
|
|
32
42
|
"DATASTORE"
|
|
33
43
|
end
|