opennebula-cli 6.4.4 → 6.5.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 +4 -4
- data/bin/oneacct +1 -1
- data/bin/oneacl +1 -1
- data/bin/onecluster +1 -1
- data/bin/onedatastore +1 -1
- data/bin/oneflow +1 -1
- data/bin/oneflow-template +2 -2
- data/bin/onegroup +1 -1
- data/bin/onehook +1 -1
- data/bin/onehost +1 -1
- data/bin/oneimage +52 -3
- data/bin/oneirb +1 -1
- data/bin/onelog +1 -1
- data/bin/onemarket +1 -1
- data/bin/onemarketapp +1 -1
- data/bin/onesecgroup +1 -1
- data/bin/oneshowback +1 -1
- data/bin/onetemplate +1 -1
- data/bin/oneuser +3 -3
- data/bin/onevcenter +1 -1
- data/bin/onevdc +1 -1
- data/bin/onevm +142 -157
- data/bin/onevmgroup +1 -1
- data/bin/onevnet +16 -4
- data/bin/onevntemplate +1 -1
- data/bin/onevrouter +1 -1
- data/bin/onezone +1 -1
- data/lib/cli_helper.rb +20 -20
- data/lib/command_parser.rb +1 -1
- data/lib/one_helper/oneacct_helper.rb +1 -1
- data/lib/one_helper/oneacl_helper.rb +1 -1
- data/lib/one_helper/onecluster_helper.rb +1 -1
- data/lib/one_helper/onedatastore_helper.rb +1 -1
- data/lib/one_helper/oneflow_helper.rb +2 -2
- data/lib/one_helper/oneflowtemplate_helper.rb +2 -2
- data/lib/one_helper/onegroup_helper.rb +1 -1
- data/lib/one_helper/onehook_helper.rb +1 -1
- data/lib/one_helper/onehost_helper.rb +15 -58
- data/lib/one_helper/oneimage_helper.rb +73 -12
- data/lib/one_helper/onemarket_helper.rb +1 -1
- data/lib/one_helper/onemarketapp_helper.rb +3 -3
- data/lib/one_helper/onequota_helper.rb +1 -1
- data/lib/one_helper/onesecgroup_helper.rb +1 -1
- data/lib/one_helper/onetemplate_helper.rb +1 -2
- data/lib/one_helper/oneuser_helper.rb +1 -1
- data/lib/one_helper/onevcenter_helper.rb +7 -7
- data/lib/one_helper/onevdc_helper.rb +1 -1
- data/lib/one_helper/onevm_helper.rb +68 -56
- data/lib/one_helper/onevmgroup_helper.rb +1 -1
- data/lib/one_helper/onevnet_helper.rb +37 -3
- data/lib/one_helper/onevntemplate_helper.rb +1 -1
- data/lib/one_helper/onevrouter_helper.rb +1 -1
- data/lib/one_helper/onezone_helper.rb +1 -1
- data/lib/one_helper.rb +3 -3
- data/share/schemas/xsd/acct.xsd +28 -0
- data/share/schemas/xsd/hook_message_state.xsd +5 -1
- data/share/schemas/xsd/host.xsd +3 -23
- data/share/schemas/xsd/image.xsd +18 -0
- data/share/schemas/xsd/opennebula_configuration.xsd +2 -0
- data/share/schemas/xsd/vm.xsd +30 -0
- data/share/schemas/xsd/vnet.xsd +28 -0
- data/share/schemas/xsd/vnet_pool.xsd +28 -0
- metadata +6 -6
data/bin/onevm
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
|
4
|
-
# Copyright 2002-
|
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
5
5
|
# #
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -195,32 +195,6 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
195
195
|
:description => 'lock all actions'
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
LOGGER = {
|
|
199
|
-
:name => 'logger',
|
|
200
|
-
:large => '--logger logger',
|
|
201
|
-
:format => String,
|
|
202
|
-
:description => 'Set logger to STDOUT or FILE'
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
KEEP = {
|
|
206
|
-
:name => 'keep',
|
|
207
|
-
:large => '--keep-backup',
|
|
208
|
-
:description => 'Keep previous backup when creating a new one'
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
ONESHOT = {
|
|
212
|
-
:name => 'oneshot',
|
|
213
|
-
:large => '--oneshot',
|
|
214
|
-
:description => 'Take an snapshot of the VM without saving backup info'
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
MARKET = {
|
|
218
|
-
:name => 'market',
|
|
219
|
-
:large => '--market market_id',
|
|
220
|
-
:format => Integer,
|
|
221
|
-
:description => 'Market to save oneshot'
|
|
222
|
-
}
|
|
223
|
-
|
|
224
198
|
NIC_ID = {
|
|
225
199
|
:name => 'nic_id',
|
|
226
200
|
:large => '--nic-id nic_id',
|
|
@@ -249,8 +223,42 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
249
223
|
:description => 'VNC client to use'
|
|
250
224
|
}
|
|
251
225
|
|
|
226
|
+
PCI = {
|
|
227
|
+
:name => 'pci',
|
|
228
|
+
:large => '--pci short_address',
|
|
229
|
+
:format => String,
|
|
230
|
+
:description => 'Select PCI device by its short address'
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
PCI_DEVICE = {
|
|
234
|
+
:name => 'pci_device',
|
|
235
|
+
:large => '--pci_device device ID',
|
|
236
|
+
:format => String,
|
|
237
|
+
:description => 'Select PCI device by its device ID'
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
PCI_VENDOR = {
|
|
241
|
+
:name => 'pci_vendor',
|
|
242
|
+
:large => '--pci_vendor vendor ID',
|
|
243
|
+
:format => String,
|
|
244
|
+
:description => 'Select PCI device by its vendor ID'
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
PCI_CLASS = {
|
|
248
|
+
:name => 'pci_class',
|
|
249
|
+
:large => '--pci_class class ID',
|
|
250
|
+
:format => String,
|
|
251
|
+
:description => 'Select PCI device by its class ID'
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
RESET_BACKUP = {
|
|
255
|
+
:name => 'reset',
|
|
256
|
+
:large => '--reset',
|
|
257
|
+
:description => 'Creates a new backup image, from a new full backup (only for incremental)'
|
|
258
|
+
}
|
|
259
|
+
|
|
252
260
|
OpenNebulaHelper::TEMPLATE_OPTIONS_VM.delete_if do |v|
|
|
253
|
-
[
|
|
261
|
+
%w[as_gid as_uid].include?(v[:name])
|
|
254
262
|
end
|
|
255
263
|
|
|
256
264
|
########################################################################
|
|
@@ -853,8 +861,11 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
853
861
|
end
|
|
854
862
|
|
|
855
863
|
nic_attach_desc = <<-EOT.unindent
|
|
856
|
-
Attaches a NIC to a
|
|
857
|
-
|
|
864
|
+
Attaches a NIC to a VM. When using --file add only one NIC instance.
|
|
865
|
+
|
|
866
|
+
To hotplug a PCI device and use it as a NIC interface in the VM select
|
|
867
|
+
it with --pci (short_address) or --pci_device (device ID),
|
|
868
|
+
--pci_class (class ID) and/or --pci_vendor (vendor ID).
|
|
858
869
|
|
|
859
870
|
To attach a nic alias, use --file or --alias option.
|
|
860
871
|
|
|
@@ -866,7 +877,11 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
866
877
|
OneVMHelper::NETWORK,
|
|
867
878
|
OneVMHelper::IP,
|
|
868
879
|
OneVMHelper::ALIAS,
|
|
869
|
-
OneVMHelper::NIC_NAME
|
|
880
|
+
OneVMHelper::NIC_NAME,
|
|
881
|
+
PCI,
|
|
882
|
+
PCI_CLASS,
|
|
883
|
+
PCI_VENDOR,
|
|
884
|
+
PCI_DEVICE] do
|
|
870
885
|
if options[:file].nil? && options[:network].nil?
|
|
871
886
|
STDERR.puts 'Provide a template file or a network:'
|
|
872
887
|
STDERR.puts "\t--file <file>"
|
|
@@ -878,36 +893,36 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
878
893
|
template = File.read(options[:file])
|
|
879
894
|
else
|
|
880
895
|
network_id = options[:network]
|
|
881
|
-
ip
|
|
882
|
-
nic_alias
|
|
883
|
-
nic_name
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
896
|
+
ip = options[:ip]
|
|
897
|
+
nic_alias = options[:alias]
|
|
898
|
+
nic_name = options[:nic_name]
|
|
899
|
+
|
|
900
|
+
is_pci = [:pci, :pci_device, :pci_vendor, :pci_class].any? do |o|
|
|
901
|
+
!options[o].nil?
|
|
902
|
+
end
|
|
903
|
+
|
|
904
|
+
if is_pci
|
|
905
|
+
pcia = options[:pci]
|
|
906
|
+
pcid = options[:pci_device]
|
|
907
|
+
pcic = options[:pci_class]
|
|
908
|
+
pciv = options[:pci_vendor]
|
|
909
|
+
|
|
910
|
+
template = 'PCI = [ TYPE = NIC'
|
|
911
|
+
template << ", NETWORK_ID = #{network_id}"
|
|
912
|
+
template << ", SHORT_ADDRESS = \"#{pcia}\"" if pcia
|
|
913
|
+
template << ", DEVICE = \"#{pcid}\"" if pcid
|
|
914
|
+
template << ", CLASS = \"#{pcic}\"" if pcic
|
|
915
|
+
template << ", VENDOR = \"#{pciv}\"" if pciv
|
|
916
|
+
elsif nic_alias
|
|
917
|
+
template = "NIC_ALIAS = [ PARENT = #{nic_alias}"
|
|
918
|
+
template << ", NETWORK_ID = #{network_id}"
|
|
899
919
|
else
|
|
900
|
-
|
|
901
|
-
template = "NIC = [ NETWORK_ID = #{network_id} ]"
|
|
902
|
-
elsif !nic_alias && nic_name
|
|
903
|
-
template = "NIC = [ NETWORK_ID = #{network_id},
|
|
904
|
-
NAME = #{nic_name} ]"
|
|
905
|
-
else
|
|
906
|
-
template = "NIC_ALIAS = \
|
|
907
|
-
[ NETWORK_ID = #{network_id},\
|
|
908
|
-
PARENT = #{nic_alias} ]"
|
|
909
|
-
end
|
|
920
|
+
template = "NIC = [ NETWORK_ID = #{network_id}"
|
|
910
921
|
end
|
|
922
|
+
|
|
923
|
+
template << ", IP = #{ip}" if ip
|
|
924
|
+
template << ", NAME = #{nic_name}" if nic_name
|
|
925
|
+
template << ']'
|
|
911
926
|
end
|
|
912
927
|
|
|
913
928
|
helper.perform_action(args[0], options, 'Attaching NIC') do |vm|
|
|
@@ -929,6 +944,40 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
929
944
|
end
|
|
930
945
|
end
|
|
931
946
|
|
|
947
|
+
nic_update_desc = <<-EOT.unindent
|
|
948
|
+
Updates a NIC for a VM. In case the VM is running, trigger NIC update on the host.
|
|
949
|
+
|
|
950
|
+
States: Almost all, except BOOT*, MIGRATE and HOTPLUG-NIC
|
|
951
|
+
EOT
|
|
952
|
+
|
|
953
|
+
command :"nic-update", nic_update_desc, :vmid, :nicid,
|
|
954
|
+
[:file, nil], :options => OpenNebulaHelper::APPEND do
|
|
955
|
+
vm_id = args[0].to_i
|
|
956
|
+
nic_id = args[1].to_i
|
|
957
|
+
file = args[2]
|
|
958
|
+
helper.perform_action(vm_id, options, 'Updating VM NIC') do |obj|
|
|
959
|
+
if options[:append]
|
|
960
|
+
str = OpenNebulaHelper
|
|
961
|
+
.append_template(vm_id, obj, file,
|
|
962
|
+
"TEMPLATE/NIC[NIC_ID=#{nic_id}]")
|
|
963
|
+
else
|
|
964
|
+
str = OpenNebulaHelper
|
|
965
|
+
.update_template(vm_id, obj, file,
|
|
966
|
+
"TEMPLATE/NIC[NIC_ID=#{nic_id}]")
|
|
967
|
+
end
|
|
968
|
+
|
|
969
|
+
# Ensure the updated attributes are in NIC section
|
|
970
|
+
unless str.gsub(' ', '').match(/NIC=\[/)
|
|
971
|
+
str = "NIC=[\n#{str.split("\n").join(",\n")}]"
|
|
972
|
+
end
|
|
973
|
+
|
|
974
|
+
helper.set_client(options)
|
|
975
|
+
obj = helper.retrieve_resource(obj.id)
|
|
976
|
+
|
|
977
|
+
obj.nic_update(nic_id, str, options[:append])
|
|
978
|
+
end
|
|
979
|
+
end
|
|
980
|
+
|
|
932
981
|
sg_attach_desc = <<-EOT.unindent
|
|
933
982
|
Attaches a Security Group to a VM.
|
|
934
983
|
|
|
@@ -1340,8 +1389,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
1340
1389
|
updateconf_desc = <<-EOT.unindent
|
|
1341
1390
|
Updates the configuration of a VM. Valid states are: running, pending,
|
|
1342
1391
|
failure, poweroff, undeploy, hold or cloning.
|
|
1343
|
-
In running state only changes in CONTEXT take effect
|
|
1344
|
-
other values may need a VM restart.
|
|
1392
|
+
In running state only changes in CONTEXT and BACKUP_CONFIG take effect
|
|
1393
|
+
immediately, other values may need a VM restart.
|
|
1345
1394
|
|
|
1346
1395
|
This command accepts a template file or opens an editor, the full list of
|
|
1347
1396
|
configuration attributes are:
|
|
@@ -1352,6 +1401,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
1352
1401
|
GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
|
|
1353
1402
|
RAW = ["DATA", "DATA_VMX", "TYPE", "VALIDATE"]
|
|
1354
1403
|
CPU_MODEL = ["MODEL"]
|
|
1404
|
+
BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE"]
|
|
1355
1405
|
CONTEXT (any value, **variable substitution will be made**)
|
|
1356
1406
|
EOT
|
|
1357
1407
|
|
|
@@ -1376,10 +1426,15 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
1376
1426
|
exit(-1)
|
|
1377
1427
|
end
|
|
1378
1428
|
|
|
1429
|
+
backup = vm.template_like_str('BACKUPS', true,
|
|
1430
|
+
'BACKUP_CONFIG')
|
|
1379
1431
|
template = vm.template_like_str('TEMPLATE', true,
|
|
1380
1432
|
'OS | FEATURES | INPUT | '\
|
|
1381
1433
|
'GRAPHICS | RAW | CONTEXT | '\
|
|
1382
1434
|
'CPU_MODEL')
|
|
1435
|
+
|
|
1436
|
+
template << "\n" << backup
|
|
1437
|
+
|
|
1383
1438
|
template = OpenNebulaHelper.editor_input(template)
|
|
1384
1439
|
end
|
|
1385
1440
|
|
|
@@ -1452,15 +1507,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
1452
1507
|
charters.each do |action, time|
|
|
1453
1508
|
sched = "+#{time[:time].to_i + acc_t + diff_stime}"
|
|
1454
1509
|
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
if OpenNebula.is_error?(rc)
|
|
1461
|
-
STDERR.puts rc.message
|
|
1462
|
-
exit(-1)
|
|
1463
|
-
end
|
|
1510
|
+
helper.schedule_actions([args[0]].flatten,
|
|
1511
|
+
{ :schedule => sched },
|
|
1512
|
+
action.to_s,
|
|
1513
|
+
time[:warning][:time] + acc_w)
|
|
1464
1514
|
|
|
1465
1515
|
acc_t += time[:time].to_i
|
|
1466
1516
|
acc_w += time[:warning][:time].to_i
|
|
@@ -1502,108 +1552,43 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
1502
1552
|
end
|
|
1503
1553
|
|
|
1504
1554
|
backup_vm_desc = <<-EOT.unindent
|
|
1505
|
-
Creates a VM backup
|
|
1555
|
+
Creates a VM backup on the given datastore
|
|
1556
|
+
|
|
1557
|
+
States: RUNNING, POWEROFF
|
|
1506
1558
|
EOT
|
|
1507
1559
|
|
|
1508
1560
|
command :backup,
|
|
1509
1561
|
backup_vm_desc,
|
|
1510
1562
|
:vmid,
|
|
1511
|
-
:options => [
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
# Read user options
|
|
1523
|
-
if options[:verbose]
|
|
1524
|
-
log_to = STDOUT
|
|
1525
|
-
elsif !options[:logger].nil?
|
|
1526
|
-
log_to = options[:logger]
|
|
1527
|
-
end
|
|
1528
|
-
|
|
1529
|
-
keep = options.key?(:keep)
|
|
1530
|
-
|
|
1531
|
-
if log_to
|
|
1532
|
-
logger = Logger.new(log_to)
|
|
1533
|
-
format = '%Y-%m-%d %H:%M:%S'
|
|
1534
|
-
|
|
1535
|
-
logger.formatter = proc do |severity, datetime, _p, msg|
|
|
1536
|
-
"#{datetime.strftime(format)} " \
|
|
1537
|
-
"#{severity.ljust(5)} : #{msg}\n"
|
|
1538
|
-
end
|
|
1539
|
-
end
|
|
1540
|
-
|
|
1541
|
-
binfo = {}
|
|
1542
|
-
binfo[:market] = options[:market]
|
|
1543
|
-
|
|
1544
|
-
if options.key?(:oneshot)
|
|
1545
|
-
binfo[:name] = "VM #{vm.id} BACKUP - " \
|
|
1546
|
-
"#{Time.now.strftime('%Y%m%d_%k%M')}"
|
|
1547
|
-
binfo[:freq] = 1
|
|
1548
|
-
binfo[:last] = Time.now.to_i - 100
|
|
1549
|
-
end
|
|
1550
|
-
|
|
1551
|
-
begin
|
|
1552
|
-
rc = vm.backup(keep, logger, binfo)
|
|
1553
|
-
|
|
1554
|
-
if OpenNebula.is_error?(rc)
|
|
1555
|
-
STDERR.puts rc.message
|
|
1556
|
-
exit(-1)
|
|
1557
|
-
else
|
|
1558
|
-
0
|
|
1559
|
-
end
|
|
1560
|
-
rescue StandardError => e
|
|
1561
|
-
STDERR.puts e
|
|
1562
|
-
exit(-1)
|
|
1563
|
-
end
|
|
1564
|
-
end
|
|
1565
|
-
end
|
|
1566
|
-
|
|
1567
|
-
restore_vm_desc = <<-EOT.unindent
|
|
1568
|
-
Restores a VM from a previous backup
|
|
1569
|
-
EOT
|
|
1570
|
-
|
|
1571
|
-
command :restore,
|
|
1572
|
-
restore_vm_desc,
|
|
1573
|
-
:vmid,
|
|
1574
|
-
:options => [OneDatastoreHelper::DATASTORE, LOGGER] do
|
|
1575
|
-
require 'logger'
|
|
1576
|
-
|
|
1577
|
-
unless options[:datastore]
|
|
1578
|
-
STDERR.puts 'ERROR: no datastore given'
|
|
1563
|
+
:options => [RESET_BACKUP,
|
|
1564
|
+
OneDatastoreHelper::DATASTORE,
|
|
1565
|
+
OneVMHelper::SCHEDULE,
|
|
1566
|
+
OneVMHelper::WEEKLY,
|
|
1567
|
+
OneVMHelper::MONTHLY,
|
|
1568
|
+
OneVMHelper::YEARLY,
|
|
1569
|
+
OneVMHelper::HOURLY,
|
|
1570
|
+
OneVMHelper::END_TIME] do
|
|
1571
|
+
if options[:datastore].nil?
|
|
1572
|
+
STDERR.puts 'Datastore to save the backup is mandatory: '
|
|
1573
|
+
STDERR.puts "\t -d datastore_id | name"
|
|
1579
1574
|
exit(-1)
|
|
1580
1575
|
end
|
|
1581
1576
|
|
|
1582
|
-
|
|
1583
|
-
vm.extend(OpenNebula::VirtualMachineExt)
|
|
1577
|
+
reset = options[:reset] == true
|
|
1584
1578
|
|
|
1585
|
-
|
|
1586
|
-
options[:
|
|
1587
|
-
logger = Logger.new(log_to)
|
|
1588
|
-
format = '%Y-%m-%d %H:%M:%S'
|
|
1579
|
+
if !options[:schedule].nil?
|
|
1580
|
+
options[:args] = options[:datastore]
|
|
1589
1581
|
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
end
|
|
1582
|
+
helper.schedule_actions([args[0]], options, @comm_name)
|
|
1583
|
+
else
|
|
1593
1584
|
|
|
1594
|
-
|
|
1595
|
-
rc = vm.
|
|
1585
|
+
helper.perform_action(args[0], options, 'Backup') do |vm|
|
|
1586
|
+
rc = vm.backup(options[:datastore], reset)
|
|
1596
1587
|
|
|
1597
1588
|
if OpenNebula.is_error?(rc)
|
|
1598
|
-
STDERR.puts rc.message
|
|
1589
|
+
STDERR.puts "Error creating VM backup: #{rc.message}"
|
|
1599
1590
|
exit(-1)
|
|
1600
|
-
else
|
|
1601
|
-
puts "ID: #{rc}"
|
|
1602
|
-
0
|
|
1603
1591
|
end
|
|
1604
|
-
rescue StandardError => e
|
|
1605
|
-
STDERR.puts e
|
|
1606
|
-
exit(-1)
|
|
1607
1592
|
end
|
|
1608
1593
|
end
|
|
1609
1594
|
end
|
data/bin/onevmgroup
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
|
4
|
-
# Copyright 2002-
|
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
5
5
|
# #
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onevnet
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
|
4
|
-
# Copyright 2002-
|
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
5
5
|
# #
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -114,6 +114,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
114
114
|
:description => 'No recover action possible, delete the Virtual Network'
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
RETRY = {
|
|
118
|
+
:name => 'retry',
|
|
119
|
+
:large => '--retry',
|
|
120
|
+
:description => 'Recover a Virtual Network by retrying the last ' \
|
|
121
|
+
'failed action'
|
|
122
|
+
}
|
|
123
|
+
|
|
117
124
|
########################################################################
|
|
118
125
|
# Global Options
|
|
119
126
|
########################################################################
|
|
@@ -363,6 +370,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
363
370
|
update_desc = <<-EOT.unindent
|
|
364
371
|
Update the template contents. If a path is not provided the editor will
|
|
365
372
|
be launched to modify the current content.
|
|
373
|
+
|
|
374
|
+
Note: Triggers Virtual Machine updates for used leases.
|
|
366
375
|
EOT
|
|
367
376
|
|
|
368
377
|
command :update, update_desc, :vnetid, [:file, nil],
|
|
@@ -456,19 +465,22 @@ CommandParser::CmdParser.new(ARGV) do
|
|
|
456
465
|
YOU NEED TO MANUALLY CHECK THE VN STATUS, to decide if the
|
|
457
466
|
operation was successful or not, or if it can be retried.
|
|
458
467
|
|
|
459
|
-
States for success
|
|
460
|
-
States for
|
|
468
|
+
States for success recovers: LOCK_CREATE, LOCK_DELETE, UPDATE_FAILURE state.
|
|
469
|
+
States for failure recovers: LOCK_CREATE, LOCK_DELETE state.
|
|
470
|
+
States for a retry recover: UPDATE_FAILURE
|
|
461
471
|
States for delete: Any but READY
|
|
462
472
|
EOT
|
|
463
473
|
|
|
464
474
|
command :recover, recover_desc, [:range, :vmid_list],
|
|
465
|
-
:options => [SUCCESS, FAILURE, DELETE] do
|
|
475
|
+
:options => [SUCCESS, FAILURE, DELETE, RETRY] do
|
|
466
476
|
if !options[:success].nil?
|
|
467
477
|
result = 1
|
|
468
478
|
elsif !options[:failure].nil?
|
|
469
479
|
result = 0
|
|
470
480
|
elsif !options[:delete].nil?
|
|
471
481
|
result = 2
|
|
482
|
+
elsif !options[:retry].nil?
|
|
483
|
+
result = 3
|
|
472
484
|
else
|
|
473
485
|
error_message = <<-EOT.unindent
|
|
474
486
|
Need to specify the result of the pending action.
|
data/bin/onevntemplate
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
|
4
|
-
# Copyright 2002-
|
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
5
5
|
# #
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onevrouter
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
|
4
|
-
# Copyright 2002-
|
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
5
5
|
# #
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onezone
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
|
4
|
-
# Copyright 2002-
|
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
5
5
|
# #
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/lib/cli_helper.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -20,7 +20,7 @@ require 'csv'
|
|
|
20
20
|
module CLIHelper
|
|
21
21
|
|
|
22
22
|
# Available operators for filtering operations
|
|
23
|
-
FILTER_OPS = [
|
|
23
|
+
FILTER_OPS = %w[= != < <= > >= ~]
|
|
24
24
|
|
|
25
25
|
# CLI general options
|
|
26
26
|
LIST = {
|
|
@@ -182,23 +182,23 @@ module CLIHelper
|
|
|
182
182
|
ANSI_YELLOW = "\33[33m"
|
|
183
183
|
|
|
184
184
|
# CLI states
|
|
185
|
-
OK_STATES = [
|
|
186
|
-
BAD_STATES = [
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
REGULAR_STATES = [
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
185
|
+
OK_STATES = %w[runn rdy on SUCCESS RUNNING]
|
|
186
|
+
BAD_STATES = %w[fail
|
|
187
|
+
err
|
|
188
|
+
error
|
|
189
|
+
ERROR
|
|
190
|
+
FAILED_DEPLOYING
|
|
191
|
+
FAILED_DEPLOYING_NETS
|
|
192
|
+
FAILED_UNDEPLOYING
|
|
193
|
+
FAILED_UNDEPLOYING_NETS
|
|
194
|
+
FAILED_SCALING]
|
|
195
|
+
REGULAR_STATES = %w[PENDING
|
|
196
|
+
DEPLOYING
|
|
197
|
+
DEPLOYING_NETS
|
|
198
|
+
UNDEPLOYING
|
|
199
|
+
UNDEPLOYING_NETS
|
|
200
|
+
CONFIGURING
|
|
201
|
+
WARNING]
|
|
202
202
|
|
|
203
203
|
# Set state color
|
|
204
204
|
#
|
|
@@ -809,7 +809,7 @@ module CLIHelper
|
|
|
809
809
|
# @param options [Hash] Object with CLI user options
|
|
810
810
|
def update_columns(options)
|
|
811
811
|
begin
|
|
812
|
-
if @conf
|
|
812
|
+
if @conf
|
|
813
813
|
config = YAML.load_file(@conf)
|
|
814
814
|
else
|
|
815
815
|
config = {}
|
data/lib/command_parser.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -297,7 +297,7 @@ class OneFlowHelper < OpenNebulaHelper::OneHelper
|
|
|
297
297
|
|
|
298
298
|
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
|
299
299
|
|
|
300
|
-
[
|
|
300
|
+
%w[OWNER GROUP OTHER].each do |e|
|
|
301
301
|
mask = '---'
|
|
302
302
|
permissions_hash = document['PERMISSIONS']
|
|
303
303
|
mask[0] = 'u' if permissions_hash["#{e}_U"] == '1'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -157,7 +157,7 @@ class OneFlowTemplateHelper < OpenNebulaHelper::OneHelper
|
|
|
157
157
|
|
|
158
158
|
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
|
159
159
|
|
|
160
|
-
[
|
|
160
|
+
%w[OWNER GROUP OTHER].each do |e|
|
|
161
161
|
mask = '---'
|
|
162
162
|
permissions_hash = document['PERMISSIONS']
|
|
163
163
|
mask[0] = 'u' if permissions_hash["#{e}_U"] == '1'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# -------------------------------------------------------------------------- #
|
|
2
|
-
# Copyright 2002-
|
|
2
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
|
3
3
|
# #
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
|
5
5
|
# not use this file except in compliance with the License. You may obtain #
|