opennebula-cli 5.12.13 → 5.13.80.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/oneacct +5 -14
- data/bin/oneacl +4 -15
- data/bin/onecluster +6 -17
- data/bin/onedatastore +6 -17
- data/bin/oneflow +81 -23
- data/bin/oneflow-template +51 -27
- data/bin/onegroup +6 -17
- data/bin/onehook +6 -17
- data/bin/onehost +4 -15
- data/bin/oneimage +95 -18
- data/bin/onemarket +6 -17
- data/bin/onemarketapp +113 -20
- data/bin/onesecgroup +9 -17
- data/bin/oneshowback +14 -20
- data/bin/onetemplate +8 -18
- data/bin/oneuser +26 -17
- data/bin/onevcenter +6 -28
- data/bin/onevdc +6 -17
- data/bin/onevm +142 -21
- data/bin/onevmgroup +9 -17
- data/bin/onevnet +4 -15
- data/bin/onevntemplate +7 -17
- data/bin/onevrouter +6 -17
- data/bin/onezone +6 -17
- data/lib/cli_helper.rb +7 -10
- data/lib/command_parser.rb +1 -1
- data/lib/one_helper/oneacct_helper.rb +9 -22
- 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 +11 -1
- data/lib/one_helper/oneflow_helper.rb +20 -5
- data/lib/one_helper/oneflowtemplate_helper.rb +28 -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 +1 -5
- data/lib/one_helper/oneimage_helper.rb +7 -7
- data/lib/one_helper/onemarket_helper.rb +1 -1
- data/lib/one_helper/onemarketapp_helper.rb +494 -96
- 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 +12 -1
- data/lib/one_helper/oneuser_helper.rb +11 -3
- data/lib/one_helper/onevcenter_helper.rb +176 -146
- data/lib/one_helper/onevdc_helper.rb +1 -1
- data/lib/one_helper/onevm_helper.rb +9 -9
- data/lib/one_helper/onevmgroup_helper.rb +1 -1
- data/lib/one_helper/onevnet_helper.rb +1 -1
- data/lib/one_helper/onevntemplate_helper.rb +1 -1
- data/lib/one_helper/onevrouter_helper.rb +1 -20
- data/lib/one_helper/onezone_helper.rb +12 -1
- data/lib/one_helper.rb +398 -37
- 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/oneuser
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, 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 #
|
@@ -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
|
|
@@ -573,7 +562,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
573
562
|
EOT
|
574
563
|
|
575
564
|
command :show, show_desc, [:userid, nil],
|
576
|
-
:options => OpenNebulaHelper::
|
565
|
+
:options => OpenNebulaHelper::FORMAT do
|
577
566
|
user = args[0] || OpenNebula::User::SELF
|
578
567
|
helper.show_resource(user, options)
|
579
568
|
end
|
@@ -815,4 +804,24 @@ CommandParser::CmdParser.new(ARGV) do
|
|
815
804
|
user.login(username, '', 0)
|
816
805
|
end
|
817
806
|
end
|
807
|
+
|
808
|
+
enable_desc = <<-EOT.unindent
|
809
|
+
Enables the given User
|
810
|
+
EOT
|
811
|
+
|
812
|
+
command :enable, enable_desc, [:range, :userid_list] do
|
813
|
+
helper.perform_actions(args[0], options, 'enabled') do |user|
|
814
|
+
user.enable
|
815
|
+
end
|
816
|
+
end
|
817
|
+
|
818
|
+
disable_desc = <<-EOT.unindent
|
819
|
+
Disables the given User
|
820
|
+
EOT
|
821
|
+
|
822
|
+
command :disable, disable_desc, [:range, :userid_list] do
|
823
|
+
helper.perform_actions(args[0], options, 'disabled') do |user|
|
824
|
+
user.disable
|
825
|
+
end
|
826
|
+
end
|
818
827
|
end
|
data/bin/onevcenter
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, 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 #
|
@@ -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
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, 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 #
|
@@ -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
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, 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 #
|
@@ -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
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, 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 #
|
@@ -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
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, 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 #
|
@@ -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
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, 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 #
|
@@ -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
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2021, 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 #
|
@@ -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
|
|