opennebula-cli 6.8.0 → 6.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/oneacct +1 -1
- data/bin/onebackupjob +6 -0
- data/bin/onedatastore +5 -2
- data/bin/oneflow +4 -2
- data/bin/oneflow-template +34 -29
- data/bin/onehook +9 -0
- data/bin/oneimage +19 -5
- data/bin/onemarket +5 -2
- data/bin/onemarketapp +8 -6
- data/bin/onesecgroup +8 -1
- data/bin/oneshowback +1 -1
- data/bin/onetemplate +15 -10
- data/bin/oneuser +1 -1
- data/bin/onevcenter +1 -1
- data/bin/onevm +109 -24
- data/bin/onevmgroup +13 -3
- data/bin/onevnet +8 -3
- data/bin/onevntemplate +8 -0
- data/bin/onevrouter +14 -9
- data/bin/onezone +8 -1
- data/lib/one_helper/onebackupjob_helper.rb +2 -0
- data/lib/one_helper/oneflow_helper.rb +4 -1
- data/lib/one_helper/oneflowtemplate_helper.rb +4 -1
- data/lib/one_helper/onehost_helper.rb +2 -0
- data/lib/one_helper/oneimage_helper.rb +24 -3
- data/lib/one_helper/onemarketapp_helper.rb +5 -4
- data/lib/one_helper/onevm_helper.rb +18 -1
- data/lib/one_helper.rb +26 -8
- data/share/schemas/xsd/acct.xsd +1 -0
- data/share/schemas/xsd/backupjob.xsd +1 -0
- data/share/schemas/xsd/vm.xsd +1 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15c54d3ad1c7f151f8f8c85761c9e7d807ebaf3b60e11c8ba722f9efa55b5e36
|
4
|
+
data.tar.gz: 2162024e4c15e1fe2fcd811adb3a10d84e33943f5f6a67d930a93d2b3734b859
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca211f3593bc2262afaacf6ee1872c00335f7edb86ca52d532fe2abbdfd16d89ba8d4f1b26607c3e44e3bb31e0ed14f33aeefb0cd9cf62b986c0fc8429eb870c
|
7
|
+
data.tar.gz: 708bf45d47a6755eb71bba7df087025ee4c2ff016a4d0cb4acff390ff7d3373b3695045e9c63ed5d880011c9520bde7ddc5fc00d20b04d0f8ab3402fb4e96c87
|
data/bin/oneacct
CHANGED
@@ -75,7 +75,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
75
75
|
exit(0)
|
76
76
|
end
|
77
77
|
|
78
|
-
filter_flag =
|
78
|
+
filter_flag = options[:userfilter] || VirtualMachinePool::INFO_ALL
|
79
79
|
if options[:start_time]
|
80
80
|
start_time = options[:start_time].to_i
|
81
81
|
else
|
data/bin/onebackupjob
CHANGED
@@ -130,6 +130,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
130
130
|
- using a template description file:
|
131
131
|
|
132
132
|
onebackupjob create weekly_backup.tmpl
|
133
|
+
|
134
|
+
- using a template description via stdin:
|
135
|
+
|
136
|
+
cat $bj_template | onebackupjob create
|
133
137
|
EOT
|
134
138
|
|
135
139
|
command :create,
|
@@ -143,6 +147,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
143
147
|
begin
|
144
148
|
if args[0]
|
145
149
|
template = File.read(args[0])
|
150
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
151
|
+
template = stdin
|
146
152
|
else
|
147
153
|
template = OneBackupJobHelper.create_backupjob_template(options)
|
148
154
|
end
|
data/bin/onedatastore
CHANGED
@@ -113,8 +113,11 @@ CommandParser::CmdParser.new(ARGV) do
|
|
113
113
|
|
114
114
|
helper.create_resource(options) do |datastore|
|
115
115
|
begin
|
116
|
-
|
117
|
-
|
116
|
+
if args[0]
|
117
|
+
template = File.read(args[0])
|
118
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
119
|
+
template = stdin
|
120
|
+
end
|
118
121
|
datastore.allocate(template, cid)
|
119
122
|
rescue StandardError => e
|
120
123
|
STDERR.puts e.message
|
data/bin/oneflow
CHANGED
@@ -79,7 +79,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
79
79
|
DELETE = {
|
80
80
|
:name => 'delete',
|
81
81
|
:large => '--delete',
|
82
|
-
:description => 'Force flow
|
82
|
+
:description => 'Force flow recover delete'
|
83
83
|
}
|
84
84
|
|
85
85
|
APPEND = {
|
@@ -130,7 +130,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
130
130
|
List the available services
|
131
131
|
EOT
|
132
132
|
|
133
|
-
command :list, list_desc,
|
133
|
+
command :list, list_desc,
|
134
|
+
:options => FORMAT + CLIHelper::OPTIONS + [OpenNebulaHelper::DESCRIBE] do
|
134
135
|
helper.list_service_pool(helper.client(options), options)
|
135
136
|
end
|
136
137
|
|
@@ -162,6 +163,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
162
163
|
|
163
164
|
delete_desc = <<-EOT.unindent
|
164
165
|
Delete a given service
|
166
|
+
To force service removal please use 'oneflow recover --delete <service_id>' command
|
165
167
|
EOT
|
166
168
|
|
167
169
|
command :delete, delete_desc, [:range, :service_id_list] do
|
data/bin/oneflow-template
CHANGED
@@ -143,7 +143,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
143
143
|
List the available Service Templates
|
144
144
|
EOT
|
145
145
|
|
146
|
-
command :list, list_desc,
|
146
|
+
command :list, list_desc,
|
147
|
+
:options => FORMAT + CLIHelper::OPTIONS + [OpenNebulaHelper::DESCRIBE] do
|
147
148
|
helper.list_service_template_pool(helper.client(options), options)
|
148
149
|
end
|
149
150
|
|
@@ -186,11 +187,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
186
187
|
command :create, create_desc, [:file, nil], :options => Service::JSON_FORMAT do
|
187
188
|
client = helper.client(options)
|
188
189
|
|
189
|
-
|
190
|
-
|
191
|
-
|
190
|
+
if args[0]
|
191
|
+
template = File.read(args[0])
|
192
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
193
|
+
template = stdin
|
194
|
+
end
|
192
195
|
|
193
|
-
if template
|
196
|
+
if !template
|
194
197
|
STDERR.puts 'A template must be provided'
|
195
198
|
exit(-1)
|
196
199
|
end
|
@@ -257,38 +260,40 @@ CommandParser::CmdParser.new(ARGV) do
|
|
257
260
|
rc = 0
|
258
261
|
client = helper.client(options)
|
259
262
|
|
260
|
-
|
261
|
-
template =
|
262
|
-
|
263
|
-
template =
|
263
|
+
if args[1]
|
264
|
+
template = File.read(args[1])
|
265
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
266
|
+
template = stdin
|
267
|
+
end
|
268
|
+
params['merge_template'] = JSON.parse(template) if template
|
264
269
|
|
265
|
-
|
270
|
+
unless params['merge_template']
|
271
|
+
response = client.get("#{RESOURCE_PATH}/#{args[0]}")
|
266
272
|
|
267
|
-
|
268
|
-
|
273
|
+
if CloudClient.is_error?(response)
|
274
|
+
rc = [response.code.to_i, response.to_s]
|
275
|
+
break
|
276
|
+
end
|
269
277
|
|
270
|
-
|
271
|
-
|
272
|
-
break
|
273
|
-
end
|
278
|
+
params['merge_template'] = {}
|
279
|
+
body = JSON.parse(response.body)['DOCUMENT']['TEMPLATE']['BODY']
|
274
280
|
|
275
|
-
|
276
|
-
|
281
|
+
# Check global custom attributes
|
282
|
+
custom_attrs = helper.custom_attrs(body['custom_attrs'])
|
283
|
+
params['merge_template'].merge!(custom_attrs) unless custom_attrs.nil?
|
277
284
|
|
278
|
-
|
279
|
-
|
280
|
-
|
285
|
+
# Check role level custom attributes
|
286
|
+
custom_role_attrs = helper.custom_role_attrs(body['roles'])
|
287
|
+
params['merge_template'].merge!(custom_role_attrs) unless custom_role_attrs.nil?
|
281
288
|
|
282
|
-
|
283
|
-
|
284
|
-
|
289
|
+
# Check vnets attributes
|
290
|
+
vnets = helper.networks(body['networks'])
|
291
|
+
params['merge_template'].merge!(vnets) unless vnets.nil?
|
292
|
+
end
|
285
293
|
|
286
|
-
|
287
|
-
vnets = helper.networks(body['networks'])
|
288
|
-
params['merge_template'].merge!(vnets) unless vnets.nil?
|
289
|
-
end
|
294
|
+
json = Service.build_json_action('instantiate', params)
|
290
295
|
|
291
|
-
|
296
|
+
number.times do
|
292
297
|
response = client.post("#{RESOURCE_PATH}/#{args[0]}/action", json)
|
293
298
|
|
294
299
|
if CloudClient.is_error?(response)
|
data/bin/onehook
CHANGED
@@ -164,6 +164,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
164
164
|
|
165
165
|
onehook create hook.tmpl
|
166
166
|
|
167
|
+
- using a Hook description file via stdin:
|
168
|
+
|
169
|
+
cat $hook_template | onehook create
|
170
|
+
|
167
171
|
EOT
|
168
172
|
|
169
173
|
command :create, create_desc, :file, :options =>
|
@@ -172,6 +176,11 @@ CommandParser::CmdParser.new(ARGV) do
|
|
172
176
|
begin
|
173
177
|
if args[0]
|
174
178
|
template = File.read(args[0])
|
179
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
180
|
+
template = stdin
|
181
|
+
else
|
182
|
+
STDERR.puts 'No hook template provided'
|
183
|
+
exit(-1)
|
175
184
|
end
|
176
185
|
|
177
186
|
if options[:dry]
|
data/bin/oneimage
CHANGED
@@ -130,6 +130,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
130
130
|
list_options += OpenNebulaHelper::FORMAT
|
131
131
|
list_options << OpenNebulaHelper::NUMERIC
|
132
132
|
list_options << OpenNebulaHelper::DESCRIBE
|
133
|
+
list_options << OneImageHelper::FILTERS
|
133
134
|
|
134
135
|
CREATE_OPTIONS = [OneDatastoreHelper::DATASTORE,
|
135
136
|
OneImageHelper::IMAGE,
|
@@ -215,10 +216,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
215
216
|
check_capacity = true
|
216
217
|
end
|
217
218
|
|
218
|
-
|
219
|
-
|
219
|
+
conflicting_opts = []
|
220
|
+
if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
221
|
+
OneImageHelper.create_template_options_used?(options, conflicting_opts)
|
222
|
+
|
223
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
224
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
220
225
|
|
221
|
-
STDERR.puts 'You cannot use both template and template creation options.'
|
222
226
|
next -1
|
223
227
|
end
|
224
228
|
|
@@ -235,8 +239,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
235
239
|
begin
|
236
240
|
if args[0]
|
237
241
|
template = File.read(args[0])
|
238
|
-
elsif
|
239
|
-
template =
|
242
|
+
elsif !stdin.empty?
|
243
|
+
template = stdin
|
240
244
|
else
|
241
245
|
res = OneImageHelper.create_image_template(options)
|
242
246
|
|
@@ -487,6 +491,16 @@ CommandParser::CmdParser.new(ARGV) do
|
|
487
491
|
EOT
|
488
492
|
|
489
493
|
command :list, list_desc, [:filterflag, nil], :options => list_options do
|
494
|
+
if options.key?(:backup)
|
495
|
+
filter = 'TYPE=BK'
|
496
|
+
|
497
|
+
if options[:filter]
|
498
|
+
options[:filter] << filter
|
499
|
+
else
|
500
|
+
options[:filter] = [filter]
|
501
|
+
end
|
502
|
+
options.delete(:backup)
|
503
|
+
end
|
490
504
|
helper.list_pool(options, false, args[0])
|
491
505
|
end
|
492
506
|
|
data/bin/onemarket
CHANGED
@@ -105,8 +105,11 @@ CommandParser::CmdParser.new(ARGV) do
|
|
105
105
|
command :create, create_desc, [:file, nil] do
|
106
106
|
helper.create_resource(options) do |marketplace|
|
107
107
|
begin
|
108
|
-
|
109
|
-
|
108
|
+
if args[0]
|
109
|
+
template = File.read(args[0])
|
110
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
111
|
+
template = stdin
|
112
|
+
end
|
110
113
|
marketplace.allocate(template)
|
111
114
|
rescue StandardError => e
|
112
115
|
STDERR.puts e.message
|
data/bin/onemarketapp
CHANGED
@@ -191,10 +191,12 @@ CommandParser::CmdParser.new(ARGV) do
|
|
191
191
|
exit(-1)
|
192
192
|
end
|
193
193
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
conflicting_opts = []
|
195
|
+
if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
196
|
+
OneMarketPlaceAppHelper.create_template_options_used?(options, conflicting_opts)
|
197
|
+
|
198
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
199
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
198
200
|
next -1
|
199
201
|
end
|
200
202
|
|
@@ -202,8 +204,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
202
204
|
begin
|
203
205
|
if args[0]
|
204
206
|
template = File.read(args[0])
|
205
|
-
elsif
|
206
|
-
template =
|
207
|
+
elsif !stdin.empty?
|
208
|
+
template = stdin
|
207
209
|
else
|
208
210
|
res = OneMarketPlaceAppHelper
|
209
211
|
.create_datastore_template(options)
|
data/bin/onesecgroup
CHANGED
@@ -110,7 +110,14 @@ CommandParser::CmdParser.new(ARGV) do
|
|
110
110
|
command :create, create_desc, :file do
|
111
111
|
helper.create_resource(options) do |obj|
|
112
112
|
begin
|
113
|
-
|
113
|
+
if args[0]
|
114
|
+
template = File.read(args[0])
|
115
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
116
|
+
template = stdin
|
117
|
+
else
|
118
|
+
STDERR.puts 'No Security Group description provided'
|
119
|
+
exit(-1)
|
120
|
+
end
|
114
121
|
|
115
122
|
obj.allocate(template)
|
116
123
|
rescue StandardError => e
|
data/bin/oneshowback
CHANGED
data/bin/onetemplate
CHANGED
@@ -166,10 +166,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
166
166
|
command :create, create_desc, [:file, nil], :options =>
|
167
167
|
[OneTemplateHelper::VM_NAME] + OpenNebulaHelper::TEMPLATE_OPTIONS +
|
168
168
|
[OpenNebulaHelper::DRY] do
|
169
|
-
|
170
|
-
|
169
|
+
conflicting_opts = []
|
170
|
+
if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
171
|
+
OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
|
172
|
+
|
173
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
174
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
171
175
|
|
172
|
-
STDERR.puts 'You can not use both template file and template creation options.'
|
173
176
|
next -1
|
174
177
|
end
|
175
178
|
|
@@ -177,8 +180,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
177
180
|
begin
|
178
181
|
if args[0]
|
179
182
|
template = File.read(args[0])
|
180
|
-
elsif
|
181
|
-
template =
|
183
|
+
elsif !stdin.empty?
|
184
|
+
template = stdin
|
182
185
|
else
|
183
186
|
res = OpenNebulaHelper.create_template(options)
|
184
187
|
|
@@ -255,11 +258,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
255
258
|
command :instantiate, instantiate_desc, :templateid, [:file, nil],
|
256
259
|
:options => instantiate_options + OpenNebulaHelper::TEMPLATE_OPTIONS do
|
257
260
|
exit_code = 0
|
261
|
+
conflicting_opts = []
|
262
|
+
if (args[1] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
263
|
+
OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
|
258
264
|
|
259
|
-
|
260
|
-
|
265
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
266
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
261
267
|
|
262
|
-
STDERR.puts 'You cannot use both template and template creation options.'
|
263
268
|
next -1
|
264
269
|
end
|
265
270
|
|
@@ -305,8 +310,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
305
310
|
|
306
311
|
if args[1]
|
307
312
|
extra_template = File.read(args[1])
|
308
|
-
elsif
|
309
|
-
extra_template =
|
313
|
+
elsif !stdin.empty?
|
314
|
+
extra_template = stdin
|
310
315
|
else
|
311
316
|
res = OpenNebulaHelper.create_template(options, t)
|
312
317
|
|
data/bin/oneuser
CHANGED
@@ -621,7 +621,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
621
621
|
Example, request a valid token for a generic driver (e.g. core auth, LDAP...):
|
622
622
|
oneuser token-create my_user --time 3600
|
623
623
|
|
624
|
-
Example, request a group
|
624
|
+
Example, request a group specific token (new resources will be created in that
|
625
625
|
group and only resources that belong to that group will be listed):
|
626
626
|
oneuser token-create my_user --group <id|group>
|
627
627
|
|
data/bin/onevcenter
CHANGED
data/bin/onevm
CHANGED
@@ -349,19 +349,21 @@ CommandParser::CmdParser.new(ARGV) do
|
|
349
349
|
number = options[:multiple] || 1
|
350
350
|
exit_code = nil
|
351
351
|
|
352
|
-
|
353
|
-
|
352
|
+
conflicting_opts = []
|
353
|
+
if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
354
|
+
OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
|
355
|
+
|
356
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
357
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
354
358
|
|
355
|
-
STDERR.puts 'You can not use both template file and template'\
|
356
|
-
' creation options.'
|
357
359
|
exit(-1)
|
358
360
|
end
|
359
361
|
|
360
362
|
begin
|
361
363
|
if args[0]
|
362
364
|
template = File.read(args[0])
|
363
|
-
elsif
|
364
|
-
template =
|
365
|
+
elsif !stdin.empty?
|
366
|
+
template = stdin
|
365
367
|
else
|
366
368
|
res = OpenNebulaHelper.create_template(options)
|
367
369
|
|
@@ -615,8 +617,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
615
617
|
|
616
618
|
if options[:file]
|
617
619
|
extra_template = File.read(options[:file])
|
618
|
-
elsif
|
619
|
-
extra_template =
|
620
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
621
|
+
extra_template = stdin
|
620
622
|
end
|
621
623
|
|
622
624
|
helper.perform_actions(args[0], options, verbose) do |vm|
|
@@ -689,7 +691,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
689
691
|
end
|
690
692
|
|
691
693
|
resume_desc = <<-EOT.unindent
|
692
|
-
Resumes the execution of
|
694
|
+
Resumes the execution of a saved VM
|
693
695
|
|
694
696
|
States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF, UNKNOWN
|
695
697
|
EOT
|
@@ -718,7 +720,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
718
720
|
States for success/failure recovers: Any ACTIVE state.
|
719
721
|
States for a retry recover: Any *FAILURE state
|
720
722
|
States for delete: Any
|
721
|
-
States for
|
723
|
+
States for recreate: Any but DONE/POWEROFF/SUSPENDED
|
722
724
|
States for delete-db: Any
|
723
725
|
EOT
|
724
726
|
|
@@ -774,8 +776,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
774
776
|
TARGET, CACHE, DISCARD, PREFIX] do
|
775
777
|
if options[:file]
|
776
778
|
template = File.read(options[:file])
|
777
|
-
elsif
|
778
|
-
template =
|
779
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
780
|
+
template = stdin
|
779
781
|
elsif options[:image]
|
780
782
|
image_id = options[:image]
|
781
783
|
target = options[:target]
|
@@ -851,8 +853,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
851
853
|
] do
|
852
854
|
if options[:file]
|
853
855
|
template = File.read(options[:file])
|
854
|
-
elsif
|
855
|
-
template =
|
856
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
857
|
+
template = stdin
|
856
858
|
elsif options[:network]
|
857
859
|
network_id = options[:network]
|
858
860
|
ip = options[:ip]
|
@@ -1267,8 +1269,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1267
1269
|
end
|
1268
1270
|
|
1269
1271
|
resize_desc = <<-EOT.unindent
|
1270
|
-
Resizes the capacity of a Virtual Machine
|
1271
|
-
RUNNING)
|
1272
|
+
Resizes the capacity of a Virtual Machine
|
1272
1273
|
|
1273
1274
|
#{OpenNebulaHelper::TEMPLATE_INPUT}
|
1274
1275
|
EOT
|
@@ -1277,8 +1278,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1277
1278
|
:options => OpenNebulaHelper::CAPACITY_OPTIONS_VM + [ENFORCE, OpenNebulaHelper::FILE] do
|
1278
1279
|
if options[:file]
|
1279
1280
|
template = File.read(options[:file])
|
1280
|
-
elsif
|
1281
|
-
template =
|
1281
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
1282
|
+
template = stdin
|
1282
1283
|
else
|
1283
1284
|
template = ''
|
1284
1285
|
|
@@ -1325,6 +1326,26 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1325
1326
|
end
|
1326
1327
|
end
|
1327
1328
|
|
1329
|
+
backupmode_set_desc = <<-EOT.unindent
|
1330
|
+
Updates the backup mode of a VM. Can be #{OpenNebulaHelper::BACKUP_MODES.join('|')}
|
1331
|
+
EOT
|
1332
|
+
|
1333
|
+
command :backupmode, backupmode_set_desc, :vmid, :mode do
|
1334
|
+
vm_ref = args[0]
|
1335
|
+
backup_mode = args[1]
|
1336
|
+
|
1337
|
+
if !helper.backup_mode_valid?(backup_mode)
|
1338
|
+
err_msg = "Invalid backup mode: #{backup_mode}\n"
|
1339
|
+
err_msg << "Valid backup modes are: #{OpenNebulaHelper::BACKUP_MODES.join(',')}"
|
1340
|
+
|
1341
|
+
STDERR.puts err_msg
|
1342
|
+
exit(-1)
|
1343
|
+
end
|
1344
|
+
|
1345
|
+
# TODO: Ensure other BACKUP_CONFIG is not overwritten
|
1346
|
+
helper.set_backup_mode(vm_ref, backup_mode)
|
1347
|
+
end
|
1348
|
+
|
1328
1349
|
updateconf_desc = <<-EOT.unindent
|
1329
1350
|
Updates the configuration of a VM. Valid states are: running, pending,
|
1330
1351
|
failure, poweroff, undeploy, hold or cloning.
|
@@ -1337,13 +1358,13 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1337
1358
|
The full list of configuration attributes are:
|
1338
1359
|
|
1339
1360
|
OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "UUID"]
|
1340
|
-
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT", "IOTHREADS"]
|
1361
|
+
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT", "VIRTIO_SCSI_QUEUES", "VIRTIO_BLK_QUEUES", "IOTHREADS"]
|
1341
1362
|
INPUT = ["TYPE", "BUS"]
|
1342
1363
|
GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
|
1343
1364
|
VIDEO = ["TYPE", "IOMMU", "ATS", "VRAM", "RESOLUTION"]
|
1344
1365
|
RAW = ["DATA", "DATA_VMX", "TYPE", "VALIDATE"]
|
1345
1366
|
CPU_MODEL = ["MODEL"]
|
1346
|
-
BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE"]
|
1367
|
+
BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE", "INCREMENT_MODE"]
|
1347
1368
|
CONTEXT (any value, **variable substitution will be made**)
|
1348
1369
|
EOT
|
1349
1370
|
|
@@ -1352,15 +1373,17 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1352
1373
|
template = ''
|
1353
1374
|
|
1354
1375
|
begin
|
1355
|
-
|
1356
|
-
|
1376
|
+
if args[1]
|
1377
|
+
template = File.read(args[1])
|
1378
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
1379
|
+
template = stdin
|
1380
|
+
end
|
1357
1381
|
rescue StandardError => e
|
1358
1382
|
STDERR.puts "Error reading template: #{e.message}."
|
1359
1383
|
exit(-1)
|
1360
1384
|
end
|
1361
1385
|
|
1362
|
-
helper.perform_action(args[0], options,
|
1363
|
-
'Updating VM configuration') do |vm|
|
1386
|
+
helper.perform_action(args[0], options, 'Updating VM configuration') do |vm|
|
1364
1387
|
if template.empty?
|
1365
1388
|
rc = vm.info
|
1366
1389
|
|
@@ -1587,6 +1610,68 @@ CommandParser::CmdParser.new(ARGV) do
|
|
1587
1610
|
'-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
|
1588
1611
|
EOT
|
1589
1612
|
|
1613
|
+
pci_attach_desc = <<-EOT.unindent
|
1614
|
+
Attaches a PCI to a VM.
|
1615
|
+
|
1616
|
+
You can specify the PCI device with --pci (short_address) or
|
1617
|
+
--pci_device (device ID), --pci_class (class ID) and/or --pci_vendor (vendor ID).
|
1618
|
+
|
1619
|
+
States: POWEROFF
|
1620
|
+
EOT
|
1621
|
+
|
1622
|
+
command :"pci-attach", pci_attach_desc, :vmid,
|
1623
|
+
:options => [
|
1624
|
+
OpenNebulaHelper::FILE,
|
1625
|
+
PCI,
|
1626
|
+
PCI_CLASS,
|
1627
|
+
PCI_VENDOR,
|
1628
|
+
PCI_DEVICE
|
1629
|
+
] do
|
1630
|
+
pci_attrs = [:pci, :pci_device, :pci_vendor, :pci_class].any? do |o|
|
1631
|
+
!options[o].nil?
|
1632
|
+
end
|
1633
|
+
|
1634
|
+
if options[:file]
|
1635
|
+
template = File.read(options[:file])
|
1636
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
1637
|
+
template = stdin
|
1638
|
+
elsif pci_attrs
|
1639
|
+
pcia = options[:pci]
|
1640
|
+
pcid = options[:pci_device]
|
1641
|
+
pcic = options[:pci_class]
|
1642
|
+
pciv = options[:pci_vendor]
|
1643
|
+
|
1644
|
+
pcis = []
|
1645
|
+
pcis << "SHORT_ADDRESS = \"#{pcia}\"" if pcia
|
1646
|
+
pcis << "DEVICE = \"#{pcid}\"" if pcid
|
1647
|
+
pcis << "CLASS = \"#{pcic}\"" if pcic
|
1648
|
+
pcis << "VENDOR = \"#{pciv}\"" if pciv
|
1649
|
+
|
1650
|
+
template = "PCI = [ #{pcis.join(',')} ]"
|
1651
|
+
else
|
1652
|
+
STDERR.puts 'Provide a PCI description file with --file or the relevant pci options:'
|
1653
|
+
exit(-1)
|
1654
|
+
end
|
1655
|
+
|
1656
|
+
helper.perform_action(args[0], options, 'Attaching PCI device') do |vm|
|
1657
|
+
vm.pci_attach(template)
|
1658
|
+
end
|
1659
|
+
end
|
1660
|
+
|
1661
|
+
pci_detach_desc = <<-EOT.unindent
|
1662
|
+
Detaches a PCI device from a VM
|
1663
|
+
|
1664
|
+
States: POWEROFF
|
1665
|
+
EOT
|
1666
|
+
|
1667
|
+
command :"pci-detach", pci_detach_desc, :vmid, :pciid do
|
1668
|
+
pciid = args[1].to_i
|
1669
|
+
|
1670
|
+
helper.perform_action(args[0], options, 'Detaching PCI') do |vm|
|
1671
|
+
vm.pci_detach(pciid)
|
1672
|
+
end
|
1673
|
+
end
|
1674
|
+
|
1590
1675
|
command :ssh,
|
1591
1676
|
ssh_desc,
|
1592
1677
|
:vmid,
|
data/bin/onevmgroup
CHANGED
@@ -136,7 +136,14 @@ CommandParser::CmdParser.new(ARGV) do
|
|
136
136
|
command :create, create_desc, :file do
|
137
137
|
helper.create_resource(options) do |obj|
|
138
138
|
begin
|
139
|
-
|
139
|
+
if args[0]
|
140
|
+
template = File.read(args[0])
|
141
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
142
|
+
template = stdin
|
143
|
+
else
|
144
|
+
STDERR.puts 'No VM Group description provided'
|
145
|
+
exit(-1)
|
146
|
+
end
|
140
147
|
|
141
148
|
obj.allocate(template)
|
142
149
|
rescue StandardError => e
|
@@ -283,8 +290,11 @@ CommandParser::CmdParser.new(ARGV) do
|
|
283
290
|
|
284
291
|
command :"role-add", role_add_desc, :vmgroupid, [:file, nil] do
|
285
292
|
begin
|
286
|
-
|
287
|
-
|
293
|
+
if args[1]
|
294
|
+
template = File.read(args[1])
|
295
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
296
|
+
template = stdin
|
297
|
+
end
|
288
298
|
rescue StandardError => e
|
289
299
|
STDERR.puts "Error reading template: #{e.message}."
|
290
300
|
exit(-1)
|
data/bin/onevnet
CHANGED
@@ -171,8 +171,11 @@ CommandParser::CmdParser.new(ARGV) do
|
|
171
171
|
|
172
172
|
helper.create_resource(options) do |vn|
|
173
173
|
begin
|
174
|
-
|
175
|
-
|
174
|
+
if args[0]
|
175
|
+
template = File.read(args[0])
|
176
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
177
|
+
template = stdin
|
178
|
+
end
|
176
179
|
vn.allocate(template, cid)
|
177
180
|
rescue StandardError => e
|
178
181
|
STDERR.puts "Error creating network: #{e.message}"
|
@@ -200,6 +203,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
200
203
|
helper.perform_action(args[0], options, 'address range added') do |vn|
|
201
204
|
if args[1]
|
202
205
|
ar = File.read(args[1])
|
206
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
207
|
+
ar = stdin
|
203
208
|
else
|
204
209
|
ar = OpenNebulaHelper.create_ar(options)
|
205
210
|
end
|
@@ -474,7 +479,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
474
479
|
States for delete: Any but READY
|
475
480
|
EOT
|
476
481
|
|
477
|
-
command :recover, recover_desc, [:range, :
|
482
|
+
command :recover, recover_desc, [:range, :vnetid_list],
|
478
483
|
:options => [SUCCESS, FAILURE, DELETE, RETRY] do
|
479
484
|
if !options[:success].nil?
|
480
485
|
result = 1
|
data/bin/onevntemplate
CHANGED
@@ -149,6 +149,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
149
149
|
|
150
150
|
onevntemplate create vn_description.tmpl
|
151
151
|
|
152
|
+
- using a Virtual Network Template description file via stdin:
|
153
|
+
|
154
|
+
cat $vn_template | onevntemplate create
|
155
|
+
|
152
156
|
EOT
|
153
157
|
|
154
158
|
command :create, create_desc, [:file, nil], :options =>
|
@@ -157,6 +161,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
157
161
|
begin
|
158
162
|
if args[0]
|
159
163
|
template = File.read(args[0])
|
164
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
165
|
+
template = stdin
|
160
166
|
end
|
161
167
|
|
162
168
|
if options[:dry]
|
@@ -250,6 +256,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
250
256
|
|
251
257
|
if args[1]
|
252
258
|
extra_template = File.read(args[1])
|
259
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
260
|
+
extra_template = stdin
|
253
261
|
else
|
254
262
|
res = OpenNebulaHelper.create_template(options, t)
|
255
263
|
|
data/bin/onevrouter
CHANGED
@@ -140,8 +140,11 @@ CommandParser::CmdParser.new(ARGV) do
|
|
140
140
|
command :create, create_desc, [:file, nil] do
|
141
141
|
helper.create_resource(options) do |obj|
|
142
142
|
begin
|
143
|
-
|
144
|
-
|
143
|
+
if args[0]
|
144
|
+
template = File.read(args[0])
|
145
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
146
|
+
template = stdin
|
147
|
+
end
|
145
148
|
obj.allocate(template)
|
146
149
|
rescue StandardError => e
|
147
150
|
STDERR.puts e.message
|
@@ -171,10 +174,12 @@ CommandParser::CmdParser.new(ARGV) do
|
|
171
174
|
:vrouterid, :templateid, [:file, nil],
|
172
175
|
:options => instantiate_options +
|
173
176
|
OpenNebulaHelper::TEMPLATE_OPTIONS do
|
174
|
-
|
175
|
-
|
177
|
+
conflicting_opts = []
|
178
|
+
if (args[2] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
|
179
|
+
OpenNebulaHelper.create_template_options_used?(options, conflicting_opts)
|
176
180
|
|
177
|
-
STDERR.puts 'You cannot
|
181
|
+
STDERR.puts 'You cannot pass template on STDIN and use template creation options, ' <<
|
182
|
+
"conflicting options: #{conflicting_opts.join(', ')}."
|
178
183
|
exit(-1)
|
179
184
|
end
|
180
185
|
|
@@ -198,8 +203,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
198
203
|
|
199
204
|
if args[2]
|
200
205
|
extra_template = File.read(args[2])
|
201
|
-
elsif
|
202
|
-
extra_template =
|
206
|
+
elsif !stdin.empty?
|
207
|
+
extra_template = stdin
|
203
208
|
else
|
204
209
|
res = OpenNebulaHelper.create_template(options, t)
|
205
210
|
|
@@ -304,8 +309,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
304
309
|
OneVirtualRouterHelper::FLOAT] do
|
305
310
|
if options[:file]
|
306
311
|
template = File.read(options[:file])
|
307
|
-
elsif
|
308
|
-
template =
|
312
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
313
|
+
template = stdin
|
309
314
|
elsif options[:network]
|
310
315
|
network_id = options[:network]
|
311
316
|
ip = options[:ip]
|
data/bin/onezone
CHANGED
@@ -109,7 +109,14 @@ CommandParser::CmdParser.new(ARGV) do
|
|
109
109
|
command :create, create_desc, :file do
|
110
110
|
helper.create_resource(options) do |zone|
|
111
111
|
begin
|
112
|
-
|
112
|
+
if args[0]
|
113
|
+
template = File.read(args[0])
|
114
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
115
|
+
template = stdin
|
116
|
+
else
|
117
|
+
STDERR.puts 'No zone template provided'
|
118
|
+
exit(-1)
|
119
|
+
end
|
113
120
|
zone.allocate(template)
|
114
121
|
rescue StandardError => e
|
115
122
|
STDERR.puts e.message
|
@@ -155,6 +155,8 @@ class OneBackupJobHelper < OpenNebulaHelper::OneHelper
|
|
155
155
|
# Get user information
|
156
156
|
if file
|
157
157
|
str = File.read(file)
|
158
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
159
|
+
str = stdin
|
158
160
|
else
|
159
161
|
str = OpenNebulaHelper.update_template(id, bj, nil, xpath)
|
160
162
|
end
|
@@ -105,7 +105,10 @@ class OneFlowHelper < OpenNebulaHelper::OneHelper
|
|
105
105
|
elsif options[:yaml]
|
106
106
|
[0, array_list.to_yaml(:indent => 4)]
|
107
107
|
else
|
108
|
-
format_service_pool
|
108
|
+
table = format_service_pool
|
109
|
+
|
110
|
+
table.show(array_list, options)
|
111
|
+
table.describe_columns if options[:describe]
|
109
112
|
|
110
113
|
0
|
111
114
|
end
|
@@ -85,8 +85,11 @@ class OneFlowTemplateHelper < OpenNebulaHelper::OneHelper
|
|
85
85
|
elsif options[:yaml]
|
86
86
|
[0, JSON.parse(response.body).to_yaml(:indent => 4)]
|
87
87
|
else
|
88
|
+
table = format_service_template_pool
|
88
89
|
documents = JSON.parse(response.body)['DOCUMENT_POOL']
|
89
|
-
|
90
|
+
|
91
|
+
table.show(documents['DOCUMENT'], options)
|
92
|
+
table.describe_columns if options[:describe]
|
90
93
|
|
91
94
|
0
|
92
95
|
end
|
@@ -794,6 +794,8 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
|
794
794
|
numa_nodes.each do |node|
|
795
795
|
mon_node = monitoring.find {|x| x['NODE_ID'] == node['NODE_ID'] }
|
796
796
|
|
797
|
+
next if mon_node.nil?
|
798
|
+
|
797
799
|
node['MEMORY']['FREE'] = mon_node['MEMORY']['FREE']
|
798
800
|
node['MEMORY']['USED'] = mon_node['MEMORY']['USED']
|
799
801
|
|
@@ -173,6 +173,15 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
|
173
173
|
:format => String
|
174
174
|
}
|
175
175
|
|
176
|
+
FILTERS = [
|
177
|
+
{
|
178
|
+
:name => 'backup',
|
179
|
+
:large => '--backup',
|
180
|
+
:description => 'Show only backup type images',
|
181
|
+
:format => String
|
182
|
+
}
|
183
|
+
]
|
184
|
+
|
176
185
|
def self.rname
|
177
186
|
'IMAGE'
|
178
187
|
end
|
@@ -263,13 +272,13 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
|
263
272
|
tmpl_pool.info
|
264
273
|
|
265
274
|
pool.each do |img|
|
275
|
+
next if img['TYPE'].to_i == 6 # skip backup images
|
276
|
+
|
266
277
|
attrs = { :id => img['ID'],
|
267
278
|
:name => img['NAME'],
|
268
279
|
:uname => img['UNAME'] }
|
269
280
|
|
270
|
-
orphans << img['ID'] if check_orphan(tmpl_pool,
|
271
|
-
xpath,
|
272
|
-
'IMAGE', attrs)
|
281
|
+
orphans << img['ID'] if check_orphan(tmpl_pool, xpath, 'IMAGE', attrs)
|
273
282
|
end
|
274
283
|
|
275
284
|
orphans
|
@@ -509,6 +518,18 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
|
509
518
|
[0, template]
|
510
519
|
end
|
511
520
|
|
521
|
+
def create_template_options_used?(options, conflicting_opts)
|
522
|
+
# Get the template options names as symbols, options hash uses symbols
|
523
|
+
template_options=TEMPLATE_OPTIONS.map do |o|
|
524
|
+
o[:name].to_sym
|
525
|
+
end
|
526
|
+
|
527
|
+
# Check if one at least one of the template options is in options hash
|
528
|
+
conflicting_opts.replace(options.keys & template_options)
|
529
|
+
|
530
|
+
!conflicting_opts.empty?
|
531
|
+
end
|
532
|
+
|
512
533
|
end
|
513
534
|
|
514
535
|
end
|
@@ -129,16 +129,17 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
def self.create_template_options_used?(options)
|
132
|
+
def self.create_template_options_used?(options, conflicting_opts)
|
133
133
|
# Get the template options names as symbols. options hash
|
134
134
|
# uses symbols
|
135
135
|
template_options=self::TEMPLATE_OPTIONS.map do |o|
|
136
136
|
o[:name].to_sym
|
137
137
|
end
|
138
138
|
|
139
|
-
# Check if
|
140
|
-
|
141
|
-
|
139
|
+
# Check if at least one of the template options is in options hash
|
140
|
+
conflicting_opts.replace(options.keys & template_options)
|
141
|
+
|
142
|
+
!conflicting_opts.empty?
|
142
143
|
end
|
143
144
|
|
144
145
|
# Import object into marketplace
|
@@ -397,6 +397,8 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
397
397
|
# Get user information
|
398
398
|
if file
|
399
399
|
str = File.read(file)
|
400
|
+
elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
|
401
|
+
str = stdin
|
400
402
|
else
|
401
403
|
str = OpenNebulaHelper.update_template(vm_id, vm, nil, xpath)
|
402
404
|
end
|
@@ -637,6 +639,21 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
637
639
|
# rubocop:enable Style/SpecialGlobalVars
|
638
640
|
end
|
639
641
|
|
642
|
+
def get_backup_mode(vm_id)
|
643
|
+
vm = retrieve_resource(vm_id)
|
644
|
+
|
645
|
+
if vm.has_elements?('/VM/BACKUPS/BACKUP_CONFIG')
|
646
|
+
vm.template_like_str('BACKUPS/BACKUP_CONFIG/MODE')
|
647
|
+
else
|
648
|
+
nil
|
649
|
+
end
|
650
|
+
end
|
651
|
+
|
652
|
+
def set_backup_mode(vm_ref, backup_mode)
|
653
|
+
vm = retrieve_resource(vm_ref)
|
654
|
+
vm.updateconf("BACKUP_CONFIG = [\"MODE\"=\"#{backup_mode}\"]")
|
655
|
+
end
|
656
|
+
|
640
657
|
private
|
641
658
|
|
642
659
|
def factory(id = nil)
|
@@ -1449,7 +1466,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
1449
1466
|
vm_snapshots.each do |disk|
|
1450
1467
|
disk_id = disk['DISK_ID']
|
1451
1468
|
|
1452
|
-
sshots = [disk['SNAPSHOT']].flatten
|
1469
|
+
sshots = [disk['SNAPSHOT'] || []].flatten
|
1453
1470
|
sshots.each do |snapshot|
|
1454
1471
|
data = snapshot.merge('DISK_ID' => disk_id)
|
1455
1472
|
snapshots << data
|
data/lib/one_helper.rb
CHANGED
@@ -593,6 +593,8 @@ Bash symbols must be escaped on STDIN passing'
|
|
593
593
|
|
594
594
|
OPTIONS = FORMAT, EXTENDED, NUMERIC, KILOBYTES
|
595
595
|
|
596
|
+
BACKUP_MODES = ['FULL', 'INCREMENT']
|
597
|
+
|
596
598
|
class OneHelper
|
597
599
|
|
598
600
|
attr_accessor :client
|
@@ -717,6 +719,14 @@ Bash symbols must be escaped on STDIN passing'
|
|
717
719
|
end
|
718
720
|
end
|
719
721
|
|
722
|
+
def backup_mode_valid?(sus_backup_mode)
|
723
|
+
BACKUP_MODES.each do |backup_mode|
|
724
|
+
return true if backup_mode.casecmp?(sus_backup_mode)
|
725
|
+
end
|
726
|
+
|
727
|
+
false
|
728
|
+
end
|
729
|
+
|
720
730
|
#-----------------------------------------------------------------------
|
721
731
|
# List pool functions
|
722
732
|
#-----------------------------------------------------------------------
|
@@ -1702,8 +1712,8 @@ Bash symbols must be escaped on STDIN passing'
|
|
1702
1712
|
def self.update_template_helper(append, _id, resource, path, xpath, update = true)
|
1703
1713
|
if path
|
1704
1714
|
File.read(path)
|
1705
|
-
elsif
|
1706
|
-
|
1715
|
+
elsif !(stdin = self.read_stdin).empty?
|
1716
|
+
stdin
|
1707
1717
|
elsif append
|
1708
1718
|
editor_input
|
1709
1719
|
else
|
@@ -2085,16 +2095,17 @@ Bash symbols must be escaped on STDIN passing'
|
|
2085
2095
|
ar << ']'
|
2086
2096
|
end
|
2087
2097
|
|
2088
|
-
def self.create_template_options_used?(options)
|
2098
|
+
def self.create_template_options_used?(options, conflicting_opts)
|
2089
2099
|
# Get the template options names as symbols. options hash
|
2090
2100
|
# uses symbols
|
2091
2101
|
template_options=OpenNebulaHelper::TEMPLATE_OPTIONS.map do |o|
|
2092
2102
|
o[:name].to_sym
|
2093
2103
|
end
|
2094
2104
|
|
2095
|
-
# Check if
|
2096
|
-
|
2097
|
-
|
2105
|
+
# Check if at least one of the template options is in options hash
|
2106
|
+
conflicting_opts.replace(options.keys & template_options)
|
2107
|
+
|
2108
|
+
!conflicting_opts.empty?
|
2098
2109
|
end
|
2099
2110
|
|
2100
2111
|
def self.sunstone_url
|
@@ -2313,7 +2324,7 @@ Bash symbols must be escaped on STDIN passing'
|
|
2313
2324
|
answer = STDIN.readline.chop
|
2314
2325
|
|
2315
2326
|
answer = initial if answer == ''
|
2316
|
-
noanswer = (
|
2327
|
+
noanswer = (answer == '') && optional
|
2317
2328
|
end while !noanswer && (answer =~ exp).nil?
|
2318
2329
|
|
2319
2330
|
if noanswer
|
@@ -2379,7 +2390,7 @@ Bash symbols must be escaped on STDIN passing'
|
|
2379
2390
|
answer = options[answer.to_i]
|
2380
2391
|
end
|
2381
2392
|
|
2382
|
-
noanswer = (
|
2393
|
+
noanswer = (answer == '') && optional
|
2383
2394
|
end while !noanswer && !options.include?(answer)
|
2384
2395
|
|
2385
2396
|
if noanswer
|
@@ -2650,4 +2661,11 @@ Bash symbols must be escaped on STDIN passing'
|
|
2650
2661
|
end
|
2651
2662
|
end
|
2652
2663
|
|
2664
|
+
def self.read_stdin
|
2665
|
+
if STDIN.wait_readable(0)
|
2666
|
+
STDIN.read()
|
2667
|
+
else
|
2668
|
+
''
|
2669
|
+
end
|
2670
|
+
end
|
2653
2671
|
end
|
data/share/schemas/xsd/acct.xsd
CHANGED
@@ -162,6 +162,7 @@
|
|
162
162
|
<xs:element name="BACKUP_VOLATILE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
163
163
|
<xs:element name="FS_FREEZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
164
164
|
<xs:element name="INCREMENTAL_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
165
|
+
<xs:element name="INCREMENT_MODE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
165
166
|
<xs:element name="KEEP_LAST" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
166
167
|
<xs:element name="LAST_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
167
168
|
<xs:element name="LAST_BACKUP_SIZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
@@ -27,6 +27,7 @@
|
|
27
27
|
<xs:element name="BACKUP_VMS" type="xs:string"/>
|
28
28
|
<xs:element name="BACKUP_VOLATILE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
29
29
|
<xs:element name="DATASTORE_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
30
|
+
<xs:element name="ERROR" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
30
31
|
<xs:element name="EXECUTION" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
31
32
|
<xs:element name="FS_FREEZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
32
33
|
<xs:element name="KEEP_LAST" type="xs:integer" minOccurs="0" maxOccurs="1"/>
|
data/share/schemas/xsd/vm.xsd
CHANGED
@@ -299,6 +299,7 @@
|
|
299
299
|
<xs:element name="BACKUP_VOLATILE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
300
300
|
<xs:element name="FS_FREEZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
301
301
|
<xs:element name="INCREMENTAL_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
302
|
+
<xs:element name="INCREMENT_MODE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
302
303
|
<xs:element name="KEEP_LAST" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
303
304
|
<xs:element name="LAST_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
304
305
|
<xs:element name="LAST_BACKUP_SIZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opennebula-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.8.
|
4
|
+
version: 6.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opennebula
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 6.8.
|
19
|
+
version: 6.8.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 6.8.
|
26
|
+
version: 6.8.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|