opennebula-cli 5.12.5 → 5.13.85.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/oneacct +9 -4
- data/bin/oneacl +8 -5
- data/bin/onecluster +10 -7
- data/bin/onedatastore +10 -7
- data/bin/oneflow +85 -13
- data/bin/oneflow-template +45 -8
- data/bin/onegroup +10 -7
- data/bin/onehook +10 -7
- data/bin/onehost +10 -7
- data/bin/oneimage +100 -9
- data/bin/onemarket +10 -7
- data/bin/onemarketapp +118 -11
- data/bin/onesecgroup +13 -7
- data/bin/oneshowback +23 -10
- data/bin/onetemplate +16 -9
- data/bin/oneuser +30 -7
- data/bin/onevcenter +7 -4
- data/bin/onevdc +10 -7
- data/bin/onevm +147 -12
- data/bin/onevmgroup +13 -7
- data/bin/onevnet +8 -5
- data/bin/onevntemplate +11 -7
- data/bin/onevrouter +10 -7
- data/bin/onezone +10 -7
- data/lib/cli_helper.rb +6 -8
- data/lib/command_parser.rb +1 -1
- data/lib/one_helper.rb +414 -46
- data/lib/one_helper/oneacct_helper.rb +8 -17
- 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 +500 -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 +16 -4
- 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 +4 -3
- 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 +13 -6
- 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 +79 -18
- data/lib/one_helper/oneprovision_helper.rb +0 -362
data/bin/onehook
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 #
|
@@ -27,9 +27,12 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
31
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -133,8 +136,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
133
136
|
########################################################################
|
134
137
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
135
138
|
|
136
|
-
list_options
|
137
|
-
list_options
|
139
|
+
list_options = CLIHelper::OPTIONS
|
140
|
+
list_options += OpenNebulaHelper::FORMAT
|
138
141
|
list_options << OpenNebulaHelper::NUMERIC
|
139
142
|
list_options << OpenNebulaHelper::DESCRIBE
|
140
143
|
|
@@ -228,7 +231,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
228
231
|
EOT
|
229
232
|
|
230
233
|
command :show, show_desc, :hookid,
|
231
|
-
:options => [OpenNebulaHelper::
|
234
|
+
:options => [OpenNebulaHelper::FORMAT, OpenNebulaHelper::EXTENDED,
|
232
235
|
EXECUTION] do
|
233
236
|
helper.show_resource(args[0], options)
|
234
237
|
end
|
data/bin/onehost
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 #
|
@@ -29,9 +29,12 @@ else
|
|
29
29
|
end
|
30
30
|
|
31
31
|
if File.directory?(GEMS_LOCATION)
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
33
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
34
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
35
|
+
require 'rubygems'
|
36
|
+
Gem.use_paths(real_gems_path)
|
37
|
+
end
|
35
38
|
end
|
36
39
|
|
37
40
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -168,8 +171,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
168
171
|
[:file, nil], :options => CREAT_OPTIONS do
|
169
172
|
if options[:im].nil? || options[:vm].nil?
|
170
173
|
STDERR.puts 'Drivers are mandatory to create a host:'
|
171
|
-
STDERR.puts
|
172
|
-
STDERR.puts
|
174
|
+
STDERR.puts "\t -i information driver"
|
175
|
+
STDERR.puts "\t -v hypervisor driver"
|
173
176
|
exit(-1)
|
174
177
|
end
|
175
178
|
|
@@ -283,7 +286,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
283
286
|
EOT
|
284
287
|
|
285
288
|
command :show, show_desc, :hostid,
|
286
|
-
:options => [OpenNebulaHelper::
|
289
|
+
:options => [OpenNebulaHelper::FORMAT, OpenNebulaHelper::DECRYPT] do
|
287
290
|
helper.show_resource(args[0], options)
|
288
291
|
end
|
289
292
|
|
data/bin/oneimage
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 #
|
@@ -27,14 +27,18 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
31
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
36
39
|
$LOAD_PATH << RUBY_LIB_LOCATION + '/cli'
|
37
40
|
|
41
|
+
require 'tempfile'
|
38
42
|
require 'command_parser'
|
39
43
|
require 'one_helper/oneimage_helper'
|
40
44
|
require 'one_helper/onedatastore_helper'
|
@@ -73,17 +77,25 @@ CommandParser::CmdParser.new(ARGV) do
|
|
73
77
|
:description => 'lock all actions'
|
74
78
|
}
|
75
79
|
|
80
|
+
NO_CONTEXT = {
|
81
|
+
:name => 'no_context',
|
82
|
+
:large => '--no-context',
|
83
|
+
:description => 'Do not add context when building from Dockerfile'
|
84
|
+
}
|
85
|
+
|
76
86
|
########################################################################
|
77
87
|
# Global Options
|
78
88
|
########################################################################
|
79
89
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
80
90
|
|
81
|
-
list_options
|
82
|
-
list_options
|
91
|
+
list_options = CLIHelper::OPTIONS
|
92
|
+
list_options += OpenNebulaHelper::FORMAT
|
83
93
|
list_options << OpenNebulaHelper::NUMERIC
|
84
94
|
list_options << OpenNebulaHelper::DESCRIBE
|
85
95
|
|
86
|
-
CREATE_OPTIONS = [OneDatastoreHelper::DATASTORE,
|
96
|
+
CREATE_OPTIONS = [OneDatastoreHelper::DATASTORE,
|
97
|
+
OneImageHelper::IMAGE,
|
98
|
+
NO_CONTEXT]
|
87
99
|
|
88
100
|
########################################################################
|
89
101
|
# Formatters for arguments
|
@@ -152,7 +164,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
152
164
|
:options => CREATE_OPTIONS + OneImageHelper::TEMPLATE_OPTIONS do
|
153
165
|
if options[:datastore].nil? && !options[:dry]
|
154
166
|
STDERR.puts 'Datastore to save the image is mandatory: '
|
155
|
-
STDERR.puts
|
167
|
+
STDERR.puts "\t -d datastore_id"
|
156
168
|
exit(-1)
|
157
169
|
end
|
158
170
|
|
@@ -168,6 +180,15 @@ CommandParser::CmdParser.new(ARGV) do
|
|
168
180
|
next -1
|
169
181
|
end
|
170
182
|
|
183
|
+
# Add context information when building image (just working on Docker)
|
184
|
+
if (options.key? :no_context) && options[:path]
|
185
|
+
if options[:path].include?('?')
|
186
|
+
options[:path] << '&context=no'
|
187
|
+
else
|
188
|
+
options[:path] << '?context=no'
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
171
192
|
helper.create_resource(options) do |image|
|
172
193
|
begin
|
173
194
|
if args[0]
|
@@ -390,7 +411,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
390
411
|
Shows information for the given Image
|
391
412
|
EOT
|
392
413
|
|
393
|
-
command :show, show_desc, :imageid,
|
414
|
+
command :show, show_desc, :imageid,
|
415
|
+
:options => [OpenNebulaHelper::FORMAT, OpenNebulaHelper::DECRYPT] do
|
394
416
|
helper.show_resource(args[0], options)
|
395
417
|
end
|
396
418
|
|
@@ -450,4 +472,73 @@ CommandParser::CmdParser.new(ARGV) do
|
|
450
472
|
|
451
473
|
return 0
|
452
474
|
end
|
475
|
+
|
476
|
+
dockerfile_desc = <<-EOT.unindent
|
477
|
+
Create an image based on a Dockerfile
|
478
|
+
EOT
|
479
|
+
|
480
|
+
command :dockerfile,
|
481
|
+
dockerfile_desc,
|
482
|
+
:options => CREATE_OPTIONS +
|
483
|
+
OneImageHelper::TEMPLATE_OPTIONS do
|
484
|
+
# Check user options
|
485
|
+
unless options[:datastore]
|
486
|
+
STDERR.puts 'Datastore to save the image is mandatory: '
|
487
|
+
STDERR.puts "\t -d datastore_id"
|
488
|
+
exit(-1)
|
489
|
+
end
|
490
|
+
|
491
|
+
unless options[:name]
|
492
|
+
STDERR.puts 'No name provided'
|
493
|
+
exit(-1)
|
494
|
+
end
|
495
|
+
|
496
|
+
unless options[:size]
|
497
|
+
STDERR.puts 'No size given'
|
498
|
+
exit(-1)
|
499
|
+
end
|
500
|
+
|
501
|
+
# Prepare editor
|
502
|
+
tmp = Tempfile.new('dockerfile')
|
503
|
+
|
504
|
+
if ENV['EDITOR']
|
505
|
+
editor_path = ENV['EDITOR']
|
506
|
+
else
|
507
|
+
editor_path = EDITOR_PATH
|
508
|
+
end
|
509
|
+
|
510
|
+
system("#{editor_path} #{tmp.path}")
|
511
|
+
|
512
|
+
unless $CHILD_STATUS.exitstatus.zero?
|
513
|
+
STDERR.puts('Editor not defined')
|
514
|
+
exit(-1)
|
515
|
+
end
|
516
|
+
|
517
|
+
tmp.close
|
518
|
+
|
519
|
+
# Create image
|
520
|
+
helper.create_resource(options) do |image|
|
521
|
+
begin
|
522
|
+
b64 = Base64.strict_encode64(File.read(tmp.path))
|
523
|
+
options[:path] = "dockerfile:///?fileb64=#{b64}&" \
|
524
|
+
"size=#{options[:size]}"
|
525
|
+
|
526
|
+
options[:path] << '&context=no' if options.key?(:no_context)
|
527
|
+
|
528
|
+
res = OneImageHelper.create_image_template(options)
|
529
|
+
|
530
|
+
if res.first != 0
|
531
|
+
STDERR.puts res.last
|
532
|
+
next -1
|
533
|
+
end
|
534
|
+
|
535
|
+
template = res.last
|
536
|
+
|
537
|
+
image.allocate(template, options[:datastore], false)
|
538
|
+
rescue StandardError => e
|
539
|
+
STDERR.puts e.message
|
540
|
+
exit(-1)
|
541
|
+
end
|
542
|
+
end
|
543
|
+
end
|
453
544
|
end
|
data/bin/onemarket
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 #
|
@@ -27,9 +27,12 @@ else
|
|
27
27
|
end
|
28
28
|
|
29
29
|
if File.directory?(GEMS_LOCATION)
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
31
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
32
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
33
|
+
require 'rubygems'
|
34
|
+
Gem.use_paths(real_gems_path)
|
35
|
+
end
|
33
36
|
end
|
34
37
|
|
35
38
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -53,8 +56,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
53
56
|
########################################################################
|
54
57
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
55
58
|
|
56
|
-
list_options
|
57
|
-
list_options
|
59
|
+
list_options = CLIHelper::OPTIONS
|
60
|
+
list_options += OpenNebulaHelper::FORMAT
|
58
61
|
list_options << OpenNebulaHelper::NUMERIC
|
59
62
|
list_options << OpenNebulaHelper::DESCRIBE
|
60
63
|
|
@@ -154,7 +157,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
154
157
|
EOT
|
155
158
|
|
156
159
|
command :show, show_desc,
|
157
|
-
:marketplaceid, :options => OpenNebulaHelper::
|
160
|
+
:marketplaceid, :options => OpenNebulaHelper::FORMAT do
|
158
161
|
helper.show_resource(args[0], options)
|
159
162
|
end
|
160
163
|
|
data/bin/onemarketapp
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 #
|
@@ -29,9 +29,12 @@ else
|
|
29
29
|
end
|
30
30
|
|
31
31
|
if File.directory?(GEMS_LOCATION)
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
real_gems_path = File.realpath(GEMS_LOCATION)
|
33
|
+
if !defined?(Gem) || Gem.path != [real_gems_path]
|
34
|
+
$LOAD_PATH.reject! {|l| l =~ /vendor_ruby/ }
|
35
|
+
require 'rubygems'
|
36
|
+
Gem.use_paths(real_gems_path)
|
37
|
+
end
|
35
38
|
end
|
36
39
|
|
37
40
|
$LOAD_PATH << RUBY_LIB_LOCATION
|
@@ -42,6 +45,9 @@ require 'one_helper/onemarketapp_helper'
|
|
42
45
|
require 'one_helper/onemarket_helper'
|
43
46
|
require 'one_helper/onedatastore_helper'
|
44
47
|
|
48
|
+
require 'vcenter_driver'
|
49
|
+
CONFIG = VCenterConf.new
|
50
|
+
|
45
51
|
CommandParser::CmdParser.new(ARGV) do
|
46
52
|
usage '`onemarket` <command> [<args>] [<options>]'
|
47
53
|
version OpenNebulaHelper::ONE_VERSION
|
@@ -83,20 +89,56 @@ CommandParser::CmdParser.new(ARGV) do
|
|
83
89
|
:description => 'DockerHub image tag (default latest)'
|
84
90
|
}
|
85
91
|
|
92
|
+
YES = {
|
93
|
+
:name => 'yes',
|
94
|
+
:large => '--yes',
|
95
|
+
:description => 'Import associated VM templates/images',
|
96
|
+
:proc => lambda do |_, options|
|
97
|
+
options[:yes] = 'yes'
|
98
|
+
end
|
99
|
+
}
|
100
|
+
|
101
|
+
NO = {
|
102
|
+
:name => 'no',
|
103
|
+
:large => '--no',
|
104
|
+
:description => 'Do not import/export associated VM templates/images',
|
105
|
+
:proc => lambda do |_, options|
|
106
|
+
options[:no] = 'no'
|
107
|
+
end
|
108
|
+
}
|
109
|
+
|
110
|
+
TEMPLATE = {
|
111
|
+
:name => 'template',
|
112
|
+
:large => '--template template_id ',
|
113
|
+
:description => 'Associate with VM template',
|
114
|
+
:format => Integer
|
115
|
+
}
|
116
|
+
|
117
|
+
MARKET = {
|
118
|
+
:name => 'market',
|
119
|
+
:large => '--market market_id',
|
120
|
+
:format => Integer,
|
121
|
+
:description => 'Market to import all objects'
|
122
|
+
}
|
123
|
+
|
86
124
|
########################################################################
|
87
125
|
# Global Options
|
88
126
|
########################################################################
|
89
127
|
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
|
90
128
|
|
91
|
-
list_options
|
92
|
-
list_options
|
129
|
+
list_options = CLIHelper::OPTIONS
|
130
|
+
list_options += OpenNebulaHelper::FORMAT
|
93
131
|
list_options << OpenNebulaHelper::NUMERIC
|
94
132
|
list_options << OpenNebulaHelper::DESCRIBE
|
95
133
|
|
96
134
|
CREATE_OPTIONS = [OneMarketPlaceHelper::MARKETPLACE]
|
97
135
|
EXPORT_OPTIONS = [OneDatastoreHelper::DATASTORE,
|
136
|
+
OneDatastoreHelper::FILE_DATASTORE,
|
98
137
|
OneMarketPlaceAppHelper::VMNAME,
|
99
|
-
TAG
|
138
|
+
TAG,
|
139
|
+
NO,
|
140
|
+
TEMPLATE]
|
141
|
+
IMPORT_OPTIONS = [YES, NO, MARKET, OneMarketPlaceAppHelper::VMNAME]
|
100
142
|
|
101
143
|
########################################################################
|
102
144
|
# Formatters for arguments
|
@@ -135,7 +177,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
135
177
|
OneMarketPlaceAppHelper::TEMPLATE_OPTIONS do
|
136
178
|
if options[:marketplace].nil?
|
137
179
|
STDERR.puts 'Marketplace to save the app is mandatory: '
|
138
|
-
STDERR.puts
|
180
|
+
STDERR.puts "\t -m marketplace_id"
|
139
181
|
exit(-1)
|
140
182
|
end
|
141
183
|
|
@@ -175,6 +217,60 @@ CommandParser::CmdParser.new(ARGV) do
|
|
175
217
|
end
|
176
218
|
end
|
177
219
|
|
220
|
+
import_desc = <<-EOT.unindent
|
221
|
+
Imports a service template into the marketplace
|
222
|
+
EOT
|
223
|
+
|
224
|
+
command [:'service-template', :import],
|
225
|
+
import_desc,
|
226
|
+
:service_template_id,
|
227
|
+
:options => IMPORT_OPTIONS do
|
228
|
+
helper.import(args[0], ServiceTemplate) do |id|
|
229
|
+
helper.import_service_template(id, options)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
vm_import_desc = <<-EOT.unindent
|
234
|
+
Imports a VM template into the marketplace
|
235
|
+
EOT
|
236
|
+
|
237
|
+
command [:'vm-template', :import],
|
238
|
+
vm_import_desc,
|
239
|
+
:vm_template_id,
|
240
|
+
:options => IMPORT_OPTIONS do
|
241
|
+
helper.import(args[0], TemplatePool) do |id|
|
242
|
+
helper.import_vm_template(id, options)
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
vm_import_desc = <<-EOT.unindent
|
247
|
+
Imports a VM into the marketplace
|
248
|
+
EOT
|
249
|
+
|
250
|
+
command [:vm, :import],
|
251
|
+
vm_import_desc,
|
252
|
+
:vm_id,
|
253
|
+
:options => IMPORT_OPTIONS do
|
254
|
+
t_id = helper.save_as_template(
|
255
|
+
helper.get_obj_id(args[0], VirtualMachinePool)
|
256
|
+
)
|
257
|
+
|
258
|
+
if OpenNebula.is_error?(t_id)
|
259
|
+
STDERR.puts t_id.message
|
260
|
+
exit(-1)
|
261
|
+
else
|
262
|
+
helper.import(t_id, TemplatePool) do |id|
|
263
|
+
helper.import_vm_template(id, options)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
puts
|
268
|
+
puts 'To delete saved template use: ' \
|
269
|
+
"`onetemplate delete #{t_id} --recursive`"
|
270
|
+
|
271
|
+
0
|
272
|
+
end
|
273
|
+
|
178
274
|
export_desc = <<-EOT.unindent
|
179
275
|
Exports the marketplace app to the OpenNebula cloud
|
180
276
|
EOT
|
@@ -183,20 +279,31 @@ CommandParser::CmdParser.new(ARGV) do
|
|
183
279
|
helper.perform_action(args[0], options, 'exported') do |obj|
|
184
280
|
tag ="tag=#{options[:tag]}" if options[:tag]
|
185
281
|
|
282
|
+
obj.extend(MarketPlaceAppExt)
|
283
|
+
|
186
284
|
rc = obj.export(
|
187
285
|
:dsid => options[:datastore],
|
188
286
|
:name => args[1],
|
189
287
|
:vmtemplate_name => options[:vmname],
|
190
|
-
:url_args => tag
|
288
|
+
:url_args => tag,
|
289
|
+
:notemplate => options[:no] == 'no',
|
290
|
+
:template => options[:template],
|
291
|
+
:default_template => CONFIG[:default_template]
|
191
292
|
)
|
192
293
|
|
193
|
-
|
294
|
+
if OpenNebula.is_error?(rc)
|
295
|
+
STDERR.puts rc.message
|
296
|
+
exit(-1)
|
297
|
+
end
|
194
298
|
|
195
299
|
rc.each do |key, value|
|
300
|
+
next if value.nil? || value.empty? || key == :image_type
|
301
|
+
|
196
302
|
puts key.to_s.upcase
|
197
303
|
value.each do |id|
|
198
304
|
if OpenNebula.is_error?(id)
|
199
305
|
puts id.to_str
|
306
|
+
exit(-1)
|
200
307
|
else
|
201
308
|
puts " ID: #{id}"
|
202
309
|
end
|
@@ -300,7 +407,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
300
407
|
Shows information for the given marketplace app
|
301
408
|
EOT
|
302
409
|
|
303
|
-
command :show, show_desc, :appid, :options => OpenNebulaHelper::
|
410
|
+
command :show, show_desc, :appid, :options => OpenNebulaHelper::FORMAT do
|
304
411
|
helper.show_resource(args[0], options)
|
305
412
|
end
|
306
413
|
|