opennebula-cli 6.2.1 → 6.3.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 +1 -1
- data/bin/oneacl +1 -1
- data/bin/onecluster +1 -1
- data/bin/onedatastore +1 -1
- data/bin/oneflow +1 -1
- data/bin/oneflow-template +1 -1
- data/bin/onegroup +1 -1
- data/bin/onehook +1 -1
- data/bin/onehost +21 -3
- data/bin/oneimage +1 -1
- data/bin/onemarket +1 -1
- data/bin/onemarketapp +2 -2
- data/bin/onesecgroup +1 -1
- data/bin/oneshowback +1 -1
- data/bin/onetemplate +1 -1
- data/bin/oneuser +1 -1
- data/bin/onevcenter +141 -71
- data/bin/onevdc +1 -1
- data/bin/onevm +49 -9
- data/bin/onevmgroup +1 -1
- data/bin/onevnet +58 -1
- data/bin/onevntemplate +1 -1
- data/bin/onevrouter +1 -1
- data/bin/onezone +1 -1
- data/lib/cli_helper.rb +12 -3
- data/lib/command_parser.rb +1 -1
- data/lib/one_helper/oneacct_helper.rb +1 -1
- data/lib/one_helper/oneacl_helper.rb +1 -1
- data/lib/one_helper/onecluster_helper.rb +1 -1
- data/lib/one_helper/onedatastore_helper.rb +1 -1
- data/lib/one_helper/oneflow_helper.rb +1 -1
- data/lib/one_helper/oneflowtemplate_helper.rb +1 -1
- 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 -1
- data/lib/one_helper/oneimage_helper.rb +1 -1
- data/lib/one_helper/onemarket_helper.rb +1 -1
- data/lib/one_helper/onemarketapp_helper.rb +1 -1
- data/lib/one_helper/onequota_helper.rb +1 -1
- data/lib/one_helper/onesecgroup_helper.rb +1 -1
- data/lib/one_helper/onetemplate_helper.rb +1 -1
- data/lib/one_helper/oneuser_helper.rb +1 -1
- data/lib/one_helper/onevcenter_helper.rb +68 -5
- data/lib/one_helper/onevdc_helper.rb +1 -1
- data/lib/one_helper/onevm_helper.rb +1 -1
- data/lib/one_helper/onevmgroup_helper.rb +1 -1
- data/lib/one_helper/onevnet_helper.rb +15 -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 +18 -2
- data/lib/one_helper.rb +2 -2
- data/share/schemas/xsd/opennebula_configuration.xsd +2 -0
- data/share/schemas/xsd/vm.xsd +13 -1
- data/share/schemas/xsd/vm_pool.xsd +2 -0
- data/share/schemas/xsd/vnet.xsd +2 -0
- data/share/schemas/xsd/vnet_pool.xsd +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1588a85307a1dab565154022eae9690ad0efd89273e8c44868a2f3fce1fda6a0
|
4
|
+
data.tar.gz: 55ab9853a214fa409a77b545eea811014ad859cc96514d42d8eba2306d2b7b7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fea30466ca26840e77109f214a74004cf667b2e83e69f27d60cabc4e33762332beef29a9b46655d85a9acf998fff0e61580fab817cee9a1dcf1a0d668bc41db
|
7
|
+
data.tar.gz: b9fecc5cbf600983b623ce99dd8bc424d991c7597eec98b5392b0a9980d10d057ebb73163cfa218d4788315005e4be5e0119389d4f8d15755b60e4e13007a079
|
data/bin/oneacct
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/oneacl
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onecluster
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onedatastore
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/oneflow
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/oneflow-template
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onegroup
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onehook
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onehost
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -109,6 +109,20 @@ CommandParser::CmdParser.new(ARGV) do
|
|
109
109
|
:format => String
|
110
110
|
}
|
111
111
|
|
112
|
+
IPV4 = {
|
113
|
+
:name => 'ipv4',
|
114
|
+
:large => '--ipv4 ip1,ip2',
|
115
|
+
:description => 'Comma separated IPV4 to set',
|
116
|
+
:format => Array
|
117
|
+
}
|
118
|
+
|
119
|
+
IPV6 = {
|
120
|
+
:name => 'ipv6',
|
121
|
+
:large => '--ipv6 ip1,ip2',
|
122
|
+
:description => 'Comma separated IPV6 to set',
|
123
|
+
:format => Array
|
124
|
+
}
|
125
|
+
|
112
126
|
CREAT_OPTIONS = [IM, VMM, OneClusterHelper::CLUSTER, TYPE]
|
113
127
|
SYNC_OPTIONS = [OneClusterHelper::CLUSTER, FORCE, SSH]
|
114
128
|
|
@@ -344,12 +358,16 @@ CommandParser::CmdParser.new(ARGV) do
|
|
344
358
|
Import VM to OpenNebula
|
345
359
|
EOT
|
346
360
|
|
347
|
-
command :importvm,
|
361
|
+
command :importvm,
|
362
|
+
importvm_desc,
|
363
|
+
:hostid,
|
364
|
+
:name,
|
365
|
+
:options => [IPV4, IPV6] do
|
348
366
|
helper.perform_action(args[0], options, 'imported') do |o|
|
349
367
|
rc = o.info
|
350
368
|
next rc if OpenNebula.is_error?(rc)
|
351
369
|
|
352
|
-
o.import_wild(args[1])
|
370
|
+
o.import_wild(args[1], options[:ipv4], options[:ipv6])
|
353
371
|
end
|
354
372
|
end
|
355
373
|
|
data/bin/oneimage
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onemarket
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onemarketapp
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -309,7 +309,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
309
309
|
puts key.to_s.upcase
|
310
310
|
value.each do |id|
|
311
311
|
if OpenNebula.is_error?(id)
|
312
|
-
puts id.to_str
|
312
|
+
STDERR.puts id.to_str
|
313
313
|
exit(-1)
|
314
314
|
else
|
315
315
|
puts " ID: #{id}"
|
data/bin/onesecgroup
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/oneshowback
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onetemplate
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/oneuser
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
data/bin/onevcenter
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|
@@ -66,17 +66,56 @@ CommandParser::CmdParser.new(ARGV) do
|
|
66
66
|
helper.set_client(options)
|
67
67
|
end
|
68
68
|
|
69
|
+
############################################################################
|
70
|
+
# Authentication Options
|
71
|
+
############################################################################
|
72
|
+
|
73
|
+
VCENTER = {
|
74
|
+
:name => 'vcenter',
|
75
|
+
:large => '--vcenter vCenter',
|
76
|
+
:description => 'The vCenter hostname',
|
77
|
+
:format => String
|
78
|
+
}
|
79
|
+
|
80
|
+
USER = {
|
81
|
+
:name => 'vuser',
|
82
|
+
:large => '--vuser username',
|
83
|
+
:description => 'The username to interact with vCenter',
|
84
|
+
:format => String
|
85
|
+
}
|
86
|
+
|
87
|
+
PASS = {
|
88
|
+
:name => 'vpass',
|
89
|
+
:large => '--vpass password',
|
90
|
+
:description => 'The password for the user',
|
91
|
+
:format => String
|
92
|
+
}
|
93
|
+
|
94
|
+
PORT = {
|
95
|
+
:name => 'port',
|
96
|
+
:short => '-p port',
|
97
|
+
:large => '--port port',
|
98
|
+
:format => String,
|
99
|
+
:description => 'vCenter API port, defaults to 443 (SSL) or 80'
|
100
|
+
}
|
101
|
+
|
102
|
+
AUTH_OPTS = [VCENTER, USER, PASS, PORT]
|
103
|
+
|
104
|
+
############################################################################
|
105
|
+
# List & Import
|
106
|
+
############################################################################
|
107
|
+
|
69
108
|
OBJECT = {
|
70
|
-
:name
|
109
|
+
:name => 'object',
|
71
110
|
:short => '-o object',
|
72
111
|
:large => '--object object ',
|
73
112
|
:format => String,
|
74
113
|
:description => 'vCenter object: [datastores, templates,'\
|
75
|
-
'networks, datastores, images]'
|
114
|
+
'networks, datastores, images, hosts]'
|
76
115
|
}
|
77
116
|
|
78
117
|
HOST = {
|
79
|
-
:name
|
118
|
+
:name => 'host',
|
80
119
|
:short => '-h host_id',
|
81
120
|
:large => '--host host_id',
|
82
121
|
:format => String,
|
@@ -84,7 +123,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
84
123
|
}
|
85
124
|
|
86
125
|
DATASTORE = {
|
87
|
-
:name
|
126
|
+
:name => 'datastore',
|
88
127
|
:short => '-d datastore_id',
|
89
128
|
:large => '--datastore datastore_id',
|
90
129
|
:format => String,
|
@@ -92,55 +131,63 @@ CommandParser::CmdParser.new(ARGV) do
|
|
92
131
|
}
|
93
132
|
|
94
133
|
CONFIG = {
|
95
|
-
:name
|
134
|
+
:name => 'configuration',
|
96
135
|
:large => '--config file',
|
97
136
|
:format => String,
|
98
137
|
:description => 'Configuration file for custom options'
|
99
138
|
}
|
100
139
|
|
101
|
-
|
102
|
-
:name
|
103
|
-
:large => '--
|
104
|
-
:
|
105
|
-
:
|
140
|
+
LINKED_CLONE = {
|
141
|
+
:name => 'linked_clone',
|
142
|
+
:large => '--linked_clone linked_clone',
|
143
|
+
:format => String,
|
144
|
+
:description => 'Import template as linked clone, 0/1'
|
106
145
|
}
|
107
146
|
|
108
|
-
|
109
|
-
:name
|
110
|
-
:large => '--
|
111
|
-
:
|
112
|
-
:
|
147
|
+
COPY = {
|
148
|
+
:name => 'copy',
|
149
|
+
:large => '--copy copy',
|
150
|
+
:format => String,
|
151
|
+
:description => 'Import template as copy, 0/1'
|
113
152
|
}
|
114
153
|
|
115
|
-
|
116
|
-
:name
|
117
|
-
:large => '--
|
118
|
-
:
|
119
|
-
:
|
154
|
+
NAME = {
|
155
|
+
:name => 'name',
|
156
|
+
:large => '--name name',
|
157
|
+
:format => String,
|
158
|
+
:description => 'Import template copy with name'
|
120
159
|
}
|
121
160
|
|
122
|
-
|
123
|
-
:name
|
124
|
-
:
|
125
|
-
:large => '--port port',
|
161
|
+
FOLDER = {
|
162
|
+
:name => 'folder',
|
163
|
+
:large => '--folder folder',
|
126
164
|
:format => String,
|
127
|
-
:description => '
|
165
|
+
:description => 'Import template in folder'
|
128
166
|
}
|
129
167
|
|
130
168
|
USE_DEFAULTS = {
|
131
|
-
:name
|
169
|
+
:name => 'defaults',
|
132
170
|
:large => '--use-defaults',
|
133
171
|
:description => 'Use defaults for answers to questions',
|
134
172
|
:format => String
|
135
173
|
}
|
136
174
|
|
137
175
|
ALL = {
|
138
|
-
:name
|
176
|
+
:name => 'all',
|
139
177
|
:large => '--all',
|
140
178
|
:description => 'Import all list',
|
141
179
|
:format => String
|
142
180
|
}
|
143
181
|
|
182
|
+
CLUSTER_REF = {
|
183
|
+
:name => 'cluster_ref',
|
184
|
+
:large => '--cluster-ref cluster_ref',
|
185
|
+
:format => String,
|
186
|
+
:description => 'Cluster ref to import'
|
187
|
+
}
|
188
|
+
|
189
|
+
LIST_OPTS = [OBJECT, HOST, DATASTORE, CLIHelper::CSV_OPT] + AUTH_OPTS
|
190
|
+
|
144
191
|
############################################################################
|
145
192
|
# Global Options
|
146
193
|
############################################################################
|
@@ -161,29 +208,26 @@ CommandParser::CmdParser.new(ARGV) do
|
|
161
208
|
- listing available images:
|
162
209
|
|
163
210
|
onevcenter list -o datastores -h <host_id> -d <ds-img_id>
|
211
|
+
|
212
|
+
- listing available clusters:
|
213
|
+
|
214
|
+
onevcenter list -o hosts --vcenter <IP> --vuser <U> --vpass <P>
|
164
215
|
EOT
|
165
216
|
|
166
|
-
command :list,
|
167
|
-
list_desc,
|
168
|
-
:options => [OBJECT, HOST, DATASTORE, VCENTER, USER, PASS,
|
169
|
-
CLIHelper::CSV_OPT] do
|
217
|
+
command :list, list_desc, :options => LIST_OPTS do
|
170
218
|
begin
|
171
219
|
args = helper.parse_opts(options)
|
172
|
-
args[:filter] = true
|
173
|
-
args[:short] = true
|
174
|
-
vi_client = VCenterDriver::VIClient.new_from_host(options[:host])
|
175
|
-
importer = VCenterDriver::VcImporter
|
176
|
-
.new_child(helper.client, vi_client, options[:object])
|
177
220
|
|
178
|
-
|
221
|
+
args[:filter] = true
|
222
|
+
args[:short] = true
|
179
223
|
|
180
|
-
helper.
|
224
|
+
helper.list(options, args)
|
181
225
|
rescue StandardError => e
|
182
226
|
STDERR.puts e.message
|
183
227
|
exit 1
|
184
228
|
end
|
185
229
|
|
186
|
-
|
230
|
+
0
|
187
231
|
end
|
188
232
|
|
189
233
|
list_desc = <<-EOT.unindent
|
@@ -193,29 +237,22 @@ CommandParser::CmdParser.new(ARGV) do
|
|
193
237
|
- listing networks including uplinks:
|
194
238
|
|
195
239
|
onevcenter list_all -o networks -h <host_id>
|
196
|
-
|
197
240
|
EOT
|
198
241
|
|
199
|
-
command :list_all,
|
200
|
-
list_desc,
|
201
|
-
:options => [OBJECT, HOST, DATASTORE, VCENTER, USER, PASS] do
|
242
|
+
command :list_all, list_desc, :options => LIST_OPTS do
|
202
243
|
begin
|
203
244
|
args = helper.parse_opts(options)
|
204
|
-
args[:filter] = false
|
205
|
-
args[:short] = true
|
206
|
-
vi_client = VCenterDriver::VIClient.new_from_host(options[:host])
|
207
|
-
importer = VCenterDriver::VcImporter
|
208
|
-
.new_child(helper.client, vi_client, options[:object])
|
209
245
|
|
210
|
-
|
246
|
+
args[:filter] = false
|
247
|
+
args[:short] = true
|
211
248
|
|
212
|
-
helper.
|
249
|
+
helper.list(options, args)
|
213
250
|
rescue StandardError => e
|
214
251
|
STDERR.puts e.message
|
215
252
|
exit 1
|
216
253
|
end
|
217
254
|
|
218
|
-
|
255
|
+
0
|
219
256
|
end
|
220
257
|
|
221
258
|
import_desc = <<-EOT.unindent
|
@@ -236,21 +273,22 @@ CommandParser::CmdParser.new(ARGV) do
|
|
236
273
|
EOT
|
237
274
|
|
238
275
|
command :import,
|
239
|
-
import_desc,
|
276
|
+
import_desc,
|
277
|
+
[:oid, nil],
|
240
278
|
:options => [OBJECT, HOST, DATASTORE] do
|
241
279
|
begin
|
242
280
|
vi_client = VCenterDriver::VIClient.new_from_host(options[:host])
|
243
|
-
importer
|
244
|
-
|
245
|
-
|
281
|
+
importer = VCenterDriver::VcImporter.new_child(helper.client,
|
282
|
+
vi_client,
|
283
|
+
options[:object])
|
246
284
|
|
247
285
|
importer.retrieve_resources(helper.parse_opts(options))
|
248
286
|
indexes = importer.get_indexes(args.first)
|
249
287
|
|
250
288
|
if indexes.nil?
|
251
289
|
raise "Could not get any unimported #{options[:object]}"\
|
252
|
-
|
253
|
-
|
290
|
+
" resources info in host: #{options[:host]} with"\
|
291
|
+
" this input: #{args.first}"
|
254
292
|
end
|
255
293
|
|
256
294
|
importer.process_import(indexes, options) do |object_info|
|
@@ -263,18 +301,25 @@ CommandParser::CmdParser.new(ARGV) do
|
|
263
301
|
exit 1
|
264
302
|
end
|
265
303
|
|
266
|
-
|
304
|
+
0
|
267
305
|
end
|
268
306
|
|
269
307
|
command :import_defaults,
|
270
308
|
import_desc,
|
271
309
|
[:oid, nil],
|
272
|
-
:options => [OBJECT,
|
310
|
+
:options => [OBJECT,
|
311
|
+
HOST,
|
312
|
+
DATASTORE,
|
313
|
+
CONFIG,
|
314
|
+
FOLDER,
|
315
|
+
LINKED_CLONE,
|
316
|
+
COPY,
|
317
|
+
NAME] do
|
273
318
|
begin
|
274
319
|
vi_client = VCenterDriver::VIClient.new_from_host(options[:host])
|
275
|
-
importer
|
276
|
-
|
277
|
-
|
320
|
+
importer = VCenterDriver::VcImporter.new_child(helper.client,
|
321
|
+
vi_client,
|
322
|
+
options[:object])
|
278
323
|
|
279
324
|
if options[:object] == 'networks' && !args.first.nil?
|
280
325
|
indexes = args.first
|
@@ -283,15 +328,36 @@ CommandParser::CmdParser.new(ARGV) do
|
|
283
328
|
indexes = importer.get_indexes(args.first)
|
284
329
|
end
|
285
330
|
|
286
|
-
|
331
|
+
if options[:object] == 'templates' &&
|
332
|
+
indexes &&
|
333
|
+
indexes.split(',').length == 1
|
334
|
+
opts = {
|
335
|
+
:type => 'default',
|
336
|
+
:linked_clone => '0',
|
337
|
+
:copy => '0',
|
338
|
+
:name => '',
|
339
|
+
:folder => ''
|
340
|
+
}
|
341
|
+
|
342
|
+
if options[:linked_clone]
|
343
|
+
opts[:linked_clone] = options[:linked_clone]
|
344
|
+
end
|
345
|
+
|
346
|
+
opts[:copy] = options[:copy] if options[:copy]
|
347
|
+
opts[:name] = options[:name] if options[:name]
|
348
|
+
opts[:folder] = options[:folder] if options[:folder]
|
349
|
+
|
350
|
+
options[indexes] = opts
|
351
|
+
end
|
287
352
|
|
353
|
+
importer.process_import(indexes, options)
|
288
354
|
importer.stdout
|
289
355
|
rescue StandardError => e
|
290
356
|
STDERR.puts e.message
|
291
357
|
exit 1
|
292
358
|
end
|
293
359
|
|
294
|
-
|
360
|
+
0
|
295
361
|
end
|
296
362
|
|
297
363
|
############################################################################
|
@@ -303,11 +369,12 @@ CommandParser::CmdParser.new(ARGV) do
|
|
303
369
|
Example:
|
304
370
|
- Get available clusters:
|
305
371
|
|
306
|
-
onevcenter hosts --vcenter <vcenter> --vuser <
|
372
|
+
onevcenter hosts --vcenter <vcenter> --vuser <user> --vpass <pass>
|
307
373
|
EOT
|
374
|
+
|
308
375
|
command :hosts,
|
309
376
|
host_desc,
|
310
|
-
:options => [
|
377
|
+
:options => [CLUSTER_REF, USE_DEFAULTS] + AUTH_OPTS do
|
311
378
|
con_ops = helper.connection_options('Hosts', options)
|
312
379
|
|
313
380
|
begin
|
@@ -316,7 +383,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|
316
383
|
exit 1
|
317
384
|
end
|
318
385
|
|
319
|
-
|
386
|
+
0
|
320
387
|
end
|
321
388
|
|
322
389
|
############################################################################
|
@@ -331,8 +398,9 @@ CommandParser::CmdParser.new(ARGV) do
|
|
331
398
|
|
332
399
|
onevcenter cleargs 15
|
333
400
|
EOT
|
401
|
+
|
334
402
|
command :cleartags, cleartags_desc, :vmid do
|
335
|
-
vmid
|
403
|
+
vmid = args[0]
|
336
404
|
remove_str = "\n onevm recover --delete-db #{vmid}" \
|
337
405
|
"\n\nAfter a monitoring cycle, the VM will appear "\
|
338
406
|
'as a Wild VM for reimport.'
|
@@ -349,8 +417,8 @@ CommandParser::CmdParser.new(ARGV) do
|
|
349
417
|
puts remove_str
|
350
418
|
exit 0
|
351
419
|
end
|
352
|
-
puts '.'
|
353
420
|
|
421
|
+
puts '.'
|
354
422
|
puts 'The following keys will be removed:'
|
355
423
|
keys.each {|key| puts "\t- #{key}" }
|
356
424
|
|
@@ -359,8 +427,10 @@ CommandParser::CmdParser.new(ARGV) do
|
|
359
427
|
STDERR.puts "Couldn't clear VM tags. Reason: #{e.message}"
|
360
428
|
exit 1
|
361
429
|
end
|
430
|
+
|
362
431
|
puts "\nKeys removed from VM. Is safe to remove it"
|
363
432
|
puts remove_str
|
364
|
-
|
433
|
+
|
434
|
+
0
|
365
435
|
end
|
366
436
|
end
|
data/bin/onevdc
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
# -------------------------------------------------------------------------- #
|
4
|
-
# Copyright 2002-
|
4
|
+
# Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
|
5
5
|
# #
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
7
|
# not use this file except in compliance with the License. You may obtain #
|