opennebula-cli 5.10.5 → 5.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/oneacct +4 -2
- data/bin/oneacl +4 -2
- data/bin/onecluster +4 -2
- data/bin/onedatastore +4 -2
- data/bin/oneflow +151 -552
- data/bin/oneflow-template +173 -293
- data/bin/onegroup +4 -2
- data/bin/onehook +4 -2
- data/bin/onehost +78 -10
- data/bin/oneimage +4 -2
- data/bin/onemarket +4 -2
- data/bin/onemarketapp +17 -4
- data/bin/onesecgroup +4 -2
- data/bin/oneshowback +4 -2
- data/bin/onetemplate +4 -2
- data/bin/oneuser +4 -2
- data/bin/onevcenter +4 -2
- data/bin/onevdc +4 -2
- data/bin/onevm +170 -17
- data/bin/onevmgroup +4 -2
- data/bin/onevnet +16 -41
- data/bin/onevntemplate +4 -2
- data/bin/onevrouter +4 -2
- data/bin/onezone +7 -2
- data/lib/cli_helper.rb +54 -30
- data/lib/command_parser.rb +53 -19
- data/lib/one_helper.rb +258 -6
- 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 +4 -4
- data/lib/one_helper/onedatastore_helper.rb +1 -1
- data/lib/one_helper/oneflow_helper.rb +423 -0
- data/lib/one_helper/oneflowtemplate_helper.rb +312 -0
- 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 +148 -68
- data/lib/one_helper/oneimage_helper.rb +2 -2
- data/lib/one_helper/onemarket_helper.rb +1 -1
- data/lib/one_helper/onemarketapp_helper.rb +1 -1
- data/lib/one_helper/oneprovision_helper.rb +104 -60
- 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 +9 -180
- data/lib/one_helper/oneuser_helper.rb +1 -1
- data/lib/one_helper/onevcenter_helper.rb +5 -4
- data/lib/one_helper/onevdc_helper.rb +1 -1
- data/lib/one_helper/onevm_helper.rb +117 -21
- data/lib/one_helper/onevmgroup_helper.rb +1 -1
- data/lib/one_helper/onevnet_helper.rb +66 -2
- 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 +3 -1
- metadata +8 -6
data/bin/onegroup
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onehook
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onehost
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -29,7 +29,9 @@ else
|
|
29
29
|
end
|
30
30
|
|
31
31
|
if File.directory?(GEMS_LOCATION)
|
32
|
-
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
33
35
|
end
|
34
36
|
|
35
37
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -77,13 +79,12 @@ CommandParser::CmdParser.new(ARGV) do
|
|
77
79
|
:description => 'Force probe upgrade in onehost sync'
|
78
80
|
}
|
79
81
|
|
80
|
-
|
81
|
-
:name => '
|
82
|
-
:large => '--
|
83
|
-
:description => 'Use
|
84
|
-
'probes are no longer in the fronted
|
85
|
-
'deleted in the hosts.
|
86
|
-
'installed in the frontend and nodes.'
|
82
|
+
SSH = {
|
83
|
+
:name => 'ssh',
|
84
|
+
:large => '--ssh',
|
85
|
+
:description => 'Use SSH to synchronize remotes. In case some '\
|
86
|
+
'probes are no longer in the fronted they will be '\
|
87
|
+
'deleted in the hosts.'
|
87
88
|
}
|
88
89
|
|
89
90
|
TYPE = {
|
@@ -95,7 +96,53 @@ CommandParser::CmdParser.new(ARGV) do
|
|
95
96
|
}
|
96
97
|
|
97
98
|
CREAT_OPTIONS = [IM, VMM, OneClusterHelper::CLUSTER, TYPE]
|
98
|
-
SYNC_OPTIONS = [OneClusterHelper::CLUSTER, FORCE,
|
99
|
+
SYNC_OPTIONS = [OneClusterHelper::CLUSTER, FORCE, SSH]
|
100
|
+
|
101
|
+
########################################################################
|
102
|
+
# Monitoring PLOT options
|
103
|
+
########################################################################
|
104
|
+
START_T = {
|
105
|
+
:name => 'start',
|
106
|
+
:large => '--start date',
|
107
|
+
:description => 'Start date to show data',
|
108
|
+
:format => String
|
109
|
+
}
|
110
|
+
|
111
|
+
END_T = {
|
112
|
+
:name => 'end',
|
113
|
+
:large => '--end date',
|
114
|
+
:description => 'End date to show data',
|
115
|
+
:format => String
|
116
|
+
}
|
117
|
+
|
118
|
+
UNIT = {
|
119
|
+
:name => 'unit',
|
120
|
+
:large => '--unit unit',
|
121
|
+
:description => 'Unit to format data',
|
122
|
+
:format => String
|
123
|
+
}
|
124
|
+
|
125
|
+
TABLE = {
|
126
|
+
:name => 'table',
|
127
|
+
:large => '--table',
|
128
|
+
:description => 'Show monitoring information in table format'
|
129
|
+
}
|
130
|
+
|
131
|
+
N_ELEMS = {
|
132
|
+
:name => 'n_elems',
|
133
|
+
:large => '--n elements',
|
134
|
+
:description => 'Number of records to show',
|
135
|
+
:format => Integer
|
136
|
+
}
|
137
|
+
|
138
|
+
CSV_WITH_SEP = {
|
139
|
+
:name => 'csv',
|
140
|
+
:large => '--csv separator',
|
141
|
+
:description => 'Show data in CSV format',
|
142
|
+
:format => String
|
143
|
+
}
|
144
|
+
|
145
|
+
PLOT_OPTS = [START_T, END_T, UNIT, TABLE, N_ELEMS, CSV_WITH_SEP]
|
99
146
|
|
100
147
|
########################################################################
|
101
148
|
# Formatters for arguments
|
@@ -304,4 +351,25 @@ CommandParser::CmdParser.new(ARGV) do
|
|
304
351
|
:options => [OneClusterHelper::CLUSTER] do
|
305
352
|
helper.forceupdate(args[0], options)
|
306
353
|
end
|
354
|
+
|
355
|
+
monitoring_desc = <<-EOT.unindent
|
356
|
+
Show monitoring metrics in a graphic
|
357
|
+
EOT
|
358
|
+
|
359
|
+
command :monitoring,
|
360
|
+
monitoring_desc,
|
361
|
+
:hostid,
|
362
|
+
:attr,
|
363
|
+
:options => PLOT_OPTS do
|
364
|
+
helper.perform_action(args[0], options, 'monitoring') do |host|
|
365
|
+
rc = host.info
|
366
|
+
|
367
|
+
if OpenNebula.is_error?(rc)
|
368
|
+
STDERR.puts rc.message
|
369
|
+
exit(-1)
|
370
|
+
end
|
371
|
+
|
372
|
+
helper.monitoring(host, args[1], options)
|
373
|
+
end
|
374
|
+
end
|
307
375
|
end
|
data/bin/oneimage
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onemarket
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onemarketapp
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -29,7 +29,9 @@ else
|
|
29
29
|
end
|
30
30
|
|
31
31
|
if File.directory?(GEMS_LOCATION)
|
32
|
-
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
33
35
|
end
|
34
36
|
|
35
37
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -74,6 +76,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
74
76
|
:description => 'lock all actions'
|
75
77
|
}
|
76
78
|
|
79
|
+
TAG = {
|
80
|
+
:name => 'tag',
|
81
|
+
:large => '--tag tag',
|
82
|
+
:format => String,
|
83
|
+
:description => 'DockerHub image tag (default latest)'
|
84
|
+
}
|
85
|
+
|
77
86
|
########################################################################
|
78
87
|
# Global Options
|
79
88
|
########################################################################
|
@@ -86,7 +95,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
86
95
|
|
87
96
|
CREATE_OPTIONS = [OneMarketPlaceHelper::MARKETPLACE]
|
88
97
|
EXPORT_OPTIONS = [OneDatastoreHelper::DATASTORE,
|
89
|
-
OneMarketPlaceAppHelper::VMNAME
|
98
|
+
OneMarketPlaceAppHelper::VMNAME,
|
99
|
+
TAG]
|
90
100
|
|
91
101
|
########################################################################
|
92
102
|
# Formatters for arguments
|
@@ -171,10 +181,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
171
181
|
|
172
182
|
command :export, export_desc, :appid, :name, :options => EXPORT_OPTIONS do
|
173
183
|
helper.perform_action(args[0], options, 'exported') do |obj|
|
184
|
+
tag ="tag=#{options[:tag]}" if options[:tag]
|
185
|
+
|
174
186
|
rc = obj.export(
|
175
187
|
:dsid => options[:datastore],
|
176
188
|
:name => args[1],
|
177
|
-
:vmtemplate_name => options[:vmname]
|
189
|
+
:vmtemplate_name => options[:vmname],
|
190
|
+
:url_args => tag
|
178
191
|
)
|
179
192
|
|
180
193
|
next rc if OpenNebula.is_error?(rc)
|
data/bin/onesecgroup
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/oneshowback
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onetemplate
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/oneuser
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onevcenter
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -29,7 +29,9 @@ else
|
|
29
29
|
end
|
30
30
|
|
31
31
|
if File.directory?(GEMS_LOCATION)
|
32
|
-
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
33
35
|
end
|
34
36
|
|
35
37
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onevdc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
data/bin/onevm
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2020, 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 #
|
@@ -27,7 +27,9 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
30
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
31
|
+
require 'rubygems'
|
32
|
+
Gem.use_paths(File.realpath(GEMS_LOCATION))
|
31
33
|
end
|
32
34
|
|
33
35
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -927,6 +929,9 @@ CommandParser::CmdParser.new(ARGV) do
|
|
927
929
|
OneVMHelper::HOURLY,
|
928
930
|
OneVMHelper::END_TIME] do
|
929
931
|
if !options[:schedule].nil?
|
932
|
+
# add name as an argument
|
933
|
+
options[:args] = args[1]
|
934
|
+
|
930
935
|
helper.schedule_actions(args[0], options, @comm_name)
|
931
936
|
else
|
932
937
|
helper.perform_actions(args[0], options, 'snapshot created') do |o|
|
@@ -940,9 +945,22 @@ CommandParser::CmdParser.new(ARGV) do
|
|
940
945
|
Reverts a VM to a saved snapshot
|
941
946
|
EOT
|
942
947
|
|
943
|
-
command :"snapshot-revert", snapshot_revert_desc, :vmid, :snapshot_id
|
944
|
-
|
945
|
-
|
948
|
+
command :"snapshot-revert", snapshot_revert_desc, :vmid, :snapshot_id,
|
949
|
+
:options => [OneVMHelper::SCHEDULE,
|
950
|
+
OneVMHelper::WEEKLY,
|
951
|
+
OneVMHelper::MONTHLY,
|
952
|
+
OneVMHelper::YEARLY,
|
953
|
+
OneVMHelper::HOURLY,
|
954
|
+
OneVMHelper::END_TIME] do
|
955
|
+
if !options[:schedule].nil?
|
956
|
+
# add snap ID as an argument
|
957
|
+
options[:args] = args[1]
|
958
|
+
|
959
|
+
helper.schedule_actions([args[0]], options, @comm_name)
|
960
|
+
else
|
961
|
+
helper.perform_action(args[0], options, 'snapshot reverted') do |o|
|
962
|
+
o.snapshot_revert(args[1].to_i)
|
963
|
+
end
|
946
964
|
end
|
947
965
|
end
|
948
966
|
|
@@ -951,9 +969,22 @@ CommandParser::CmdParser.new(ARGV) do
|
|
951
969
|
Delets a snapshot of a VM
|
952
970
|
EOT
|
953
971
|
|
954
|
-
command :"snapshot-delete", snapshot_delete_desc, :vmid, :snapshot_id
|
955
|
-
|
956
|
-
|
972
|
+
command :"snapshot-delete", snapshot_delete_desc, :vmid, :snapshot_id,
|
973
|
+
:options => [OneVMHelper::SCHEDULE,
|
974
|
+
OneVMHelper::WEEKLY,
|
975
|
+
OneVMHelper::MONTHLY,
|
976
|
+
OneVMHelper::YEARLY,
|
977
|
+
OneVMHelper::HOURLY,
|
978
|
+
OneVMHelper::END_TIME] do
|
979
|
+
if !options[:schedule].nil?
|
980
|
+
# add snap ID as an argument
|
981
|
+
options[:args] = args[1]
|
982
|
+
|
983
|
+
helper.schedule_actions([args[0]], options, @comm_name)
|
984
|
+
else
|
985
|
+
helper.perform_action(args[0], options, 'snapshot deleted') do |o|
|
986
|
+
o.snapshot_delete(args[1])
|
987
|
+
end
|
957
988
|
end
|
958
989
|
end
|
959
990
|
|
@@ -965,9 +996,23 @@ CommandParser::CmdParser.new(ARGV) do
|
|
965
996
|
EOT
|
966
997
|
|
967
998
|
command :"disk-snapshot-create", disk_snapshot_create_desc,
|
968
|
-
:vmid, :diskid, :name
|
969
|
-
|
970
|
-
|
999
|
+
:vmid, :diskid, :name,
|
1000
|
+
:options => [OneVMHelper::SCHEDULE,
|
1001
|
+
OneVMHelper::WEEKLY,
|
1002
|
+
OneVMHelper::MONTHLY,
|
1003
|
+
OneVMHelper::YEARLY,
|
1004
|
+
OneVMHelper::HOURLY,
|
1005
|
+
OneVMHelper::END_TIME] do
|
1006
|
+
if !options[:schedule].nil?
|
1007
|
+
# add disk ID and name as arguments
|
1008
|
+
options[:args] = "#{args[1]},#{args[2]}"
|
1009
|
+
|
1010
|
+
helper.schedule_actions([args[0]], options, @comm_name)
|
1011
|
+
else
|
1012
|
+
helper.perform_action(args[0], options,
|
1013
|
+
'disk snapshot created') do |o|
|
1014
|
+
o.disk_snapshot_create(args[1].to_i, args[2])
|
1015
|
+
end
|
971
1016
|
end
|
972
1017
|
end
|
973
1018
|
|
@@ -978,9 +1023,23 @@ CommandParser::CmdParser.new(ARGV) do
|
|
978
1023
|
EOT
|
979
1024
|
|
980
1025
|
command :"disk-snapshot-revert", disk_snapshot_revert_desc,
|
981
|
-
:vmid, :diskid, :disk_snapshot_id
|
982
|
-
|
983
|
-
|
1026
|
+
:vmid, :diskid, :disk_snapshot_id,
|
1027
|
+
:options => [OneVMHelper::SCHEDULE,
|
1028
|
+
OneVMHelper::WEEKLY,
|
1029
|
+
OneVMHelper::MONTHLY,
|
1030
|
+
OneVMHelper::YEARLY,
|
1031
|
+
OneVMHelper::HOURLY,
|
1032
|
+
OneVMHelper::END_TIME] do
|
1033
|
+
if !options[:schedule].nil?
|
1034
|
+
# add disk ID and snap ID as arguments
|
1035
|
+
options[:args] = "#{args[1]},#{args[2]}"
|
1036
|
+
|
1037
|
+
helper.schedule_actions([args[0]], options, @comm_name)
|
1038
|
+
else
|
1039
|
+
helper.perform_action(args[0], options,
|
1040
|
+
'disk snapshot reverted') do |o|
|
1041
|
+
o.disk_snapshot_revert(args[1].to_i, args[2].to_i)
|
1042
|
+
end
|
984
1043
|
end
|
985
1044
|
end
|
986
1045
|
|
@@ -991,9 +1050,23 @@ CommandParser::CmdParser.new(ARGV) do
|
|
991
1050
|
EOT
|
992
1051
|
|
993
1052
|
command :"disk-snapshot-delete", disk_snapshot_delete_desc,
|
994
|
-
:vmid, :diskid, :disk_snapshot_id
|
995
|
-
|
996
|
-
|
1053
|
+
:vmid, :diskid, :disk_snapshot_id,
|
1054
|
+
:options => [OneVMHelper::SCHEDULE,
|
1055
|
+
OneVMHelper::WEEKLY,
|
1056
|
+
OneVMHelper::MONTHLY,
|
1057
|
+
OneVMHelper::YEARLY,
|
1058
|
+
OneVMHelper::HOURLY,
|
1059
|
+
OneVMHelper::END_TIME] do
|
1060
|
+
if !options[:schedule].nil?
|
1061
|
+
# add disk ID and snap ID as arguments
|
1062
|
+
options[:args] = "#{args[1]},#{args[2]}"
|
1063
|
+
|
1064
|
+
helper.schedule_actions([args[0]], options, @comm_name)
|
1065
|
+
else
|
1066
|
+
helper.perform_action(args[0], options,
|
1067
|
+
'disk snapshot deleted') do |o|
|
1068
|
+
o.disk_snapshot_delete(args[1].to_i, args[2].to_i)
|
1069
|
+
end
|
997
1070
|
end
|
998
1071
|
end
|
999
1072
|
|
@@ -1225,6 +1298,86 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1225
1298
|
end
|
1226
1299
|
end
|
1227
1300
|
|
1301
|
+
########################### Charters Management ############################
|
1302
|
+
|
1303
|
+
create_chart_desc = <<-EOT.unindent
|
1304
|
+
Adds a charter to the VM, these are some consecutive scheduled actions
|
1305
|
+
|
1306
|
+
You can configure the actions in /etc/one/cli/onevm.yaml
|
1307
|
+
EOT
|
1308
|
+
|
1309
|
+
command :'create-chart', create_chart_desc, [:range, :vmid_list] do
|
1310
|
+
charters = helper.get_charters
|
1311
|
+
|
1312
|
+
if charters.nil?
|
1313
|
+
STDERR.puts 'No charters found on configuration file'
|
1314
|
+
exit(-1)
|
1315
|
+
end
|
1316
|
+
|
1317
|
+
acc_t = 0
|
1318
|
+
acc_w = 0
|
1319
|
+
|
1320
|
+
charters.each do |action, time|
|
1321
|
+
sched = "+#{time[:time].to_i + acc_t}"
|
1322
|
+
|
1323
|
+
helper.schedule_actions(args[0],
|
1324
|
+
{ :schedule => sched },
|
1325
|
+
action.to_s,
|
1326
|
+
time[:warning][:time] + acc_w)
|
1327
|
+
|
1328
|
+
acc_t += time[:time].to_i
|
1329
|
+
acc_w += time[:warning][:time].to_i
|
1330
|
+
end
|
1331
|
+
|
1332
|
+
0
|
1333
|
+
end
|
1334
|
+
|
1335
|
+
delete_chart_desc = <<-EOT.unindent
|
1336
|
+
Deletes a charter from the VM
|
1337
|
+
EOT
|
1338
|
+
|
1339
|
+
command :'delete-chart', delete_chart_desc, :vmid, :sched_id do
|
1340
|
+
helper.perform_action(args[0], {}, 'Charter deleted') do |vm|
|
1341
|
+
rc = vm.info
|
1342
|
+
|
1343
|
+
if OpenNebula.is_error?(rc)
|
1344
|
+
STDERR.puts "Error #{rc.message}"
|
1345
|
+
exit(-1)
|
1346
|
+
end
|
1347
|
+
|
1348
|
+
xpath = "USER_TEMPLATE/SCHED_ACTION[ID=#{args[1]}]"
|
1349
|
+
|
1350
|
+
unless vm.retrieve_elements(xpath)
|
1351
|
+
STDERR.puts "Sched action #{args[1]} not found"
|
1352
|
+
exit(-1)
|
1353
|
+
end
|
1354
|
+
|
1355
|
+
vm.delete_element(xpath)
|
1356
|
+
rc = vm.update(vm.user_template_str)
|
1357
|
+
|
1358
|
+
if OpenNebula.is_error?(rc)
|
1359
|
+
STDERR.puts "Error deleting: #{rc.message}"
|
1360
|
+
exit(-1)
|
1361
|
+
end
|
1362
|
+
end
|
1363
|
+
|
1364
|
+
0
|
1365
|
+
end
|
1366
|
+
|
1367
|
+
update_chart_desc = <<-EOT.unindent
|
1368
|
+
Updates a charter from a VM
|
1369
|
+
EOT
|
1370
|
+
|
1371
|
+
command :'update-chart',
|
1372
|
+
update_chart_desc,
|
1373
|
+
:vmid,
|
1374
|
+
:sched_id,
|
1375
|
+
[:file, nil] do
|
1376
|
+
helper.update_schedule_action(args[0], args[1], args[2])
|
1377
|
+
|
1378
|
+
0
|
1379
|
+
end
|
1380
|
+
|
1228
1381
|
# Deprecated commands
|
1229
1382
|
|
1230
1383
|
deprecated_command(:shutdown, 'terminate')
|