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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/bin/oneacct +1 -1
  3. data/bin/oneacl +1 -1
  4. data/bin/onecluster +1 -1
  5. data/bin/onedatastore +1 -1
  6. data/bin/oneflow +1 -1
  7. data/bin/oneflow-template +1 -1
  8. data/bin/onegroup +1 -1
  9. data/bin/onehook +1 -1
  10. data/bin/onehost +21 -3
  11. data/bin/oneimage +1 -1
  12. data/bin/onemarket +1 -1
  13. data/bin/onemarketapp +2 -2
  14. data/bin/onesecgroup +1 -1
  15. data/bin/oneshowback +1 -1
  16. data/bin/onetemplate +1 -1
  17. data/bin/oneuser +1 -1
  18. data/bin/onevcenter +141 -71
  19. data/bin/onevdc +1 -1
  20. data/bin/onevm +49 -9
  21. data/bin/onevmgroup +1 -1
  22. data/bin/onevnet +58 -1
  23. data/bin/onevntemplate +1 -1
  24. data/bin/onevrouter +1 -1
  25. data/bin/onezone +1 -1
  26. data/lib/cli_helper.rb +12 -3
  27. data/lib/command_parser.rb +1 -1
  28. data/lib/one_helper/oneacct_helper.rb +1 -1
  29. data/lib/one_helper/oneacl_helper.rb +1 -1
  30. data/lib/one_helper/onecluster_helper.rb +1 -1
  31. data/lib/one_helper/onedatastore_helper.rb +1 -1
  32. data/lib/one_helper/oneflow_helper.rb +1 -1
  33. data/lib/one_helper/oneflowtemplate_helper.rb +1 -1
  34. data/lib/one_helper/onegroup_helper.rb +1 -1
  35. data/lib/one_helper/onehook_helper.rb +1 -1
  36. data/lib/one_helper/onehost_helper.rb +1 -1
  37. data/lib/one_helper/oneimage_helper.rb +1 -1
  38. data/lib/one_helper/onemarket_helper.rb +1 -1
  39. data/lib/one_helper/onemarketapp_helper.rb +1 -1
  40. data/lib/one_helper/onequota_helper.rb +1 -1
  41. data/lib/one_helper/onesecgroup_helper.rb +1 -1
  42. data/lib/one_helper/onetemplate_helper.rb +1 -1
  43. data/lib/one_helper/oneuser_helper.rb +1 -1
  44. data/lib/one_helper/onevcenter_helper.rb +68 -5
  45. data/lib/one_helper/onevdc_helper.rb +1 -1
  46. data/lib/one_helper/onevm_helper.rb +1 -1
  47. data/lib/one_helper/onevmgroup_helper.rb +1 -1
  48. data/lib/one_helper/onevnet_helper.rb +15 -2
  49. data/lib/one_helper/onevntemplate_helper.rb +1 -1
  50. data/lib/one_helper/onevrouter_helper.rb +1 -1
  51. data/lib/one_helper/onezone_helper.rb +18 -2
  52. data/lib/one_helper.rb +2 -2
  53. data/share/schemas/xsd/opennebula_configuration.xsd +2 -0
  54. data/share/schemas/xsd/vm.xsd +13 -1
  55. data/share/schemas/xsd/vm_pool.xsd +2 -0
  56. data/share/schemas/xsd/vnet.xsd +2 -0
  57. data/share/schemas/xsd/vnet_pool.xsd +2 -0
  58. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4908cbc17aac8f9c51ea753a53ae639ae001ffafd53e434de2607dbeca48a17
4
- data.tar.gz: b8177017450198bf4c1a37a0239568c090c8ed8c1527cd5de04079ceb72a6f6a
3
+ metadata.gz: 1588a85307a1dab565154022eae9690ad0efd89273e8c44868a2f3fce1fda6a0
4
+ data.tar.gz: 55ab9853a214fa409a77b545eea811014ad859cc96514d42d8eba2306d2b7b7c
5
5
  SHA512:
6
- metadata.gz: e1768f1cfaf3e35b24c0ea83e646d86fe4d02363ca9d9e96e8b9f7e41f8ca4405e81728d1b95284660579a02b01041253f4f1c56a93ef5ebc4a7fb4966730134
7
- data.tar.gz: a089348845dc43030ae6e079c8d71d8a0abc1978dd369bddebaf718d42ad7be24e476308d622e47673d906e387a2465055a64d1117ff1cbc48d04abf9e35cb47
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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, importvm_desc, :hostid, :name do
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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-2021, OpenNebula Project, OpenNebula Systems #
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 => 'object',
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 => 'host',
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 => 'datastore',
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 => 'configuration',
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
- VCENTER = {
102
- :name => 'vcenter',
103
- :large => '--vcenter vCenter',
104
- :description => 'The vCenter hostname',
105
- :format => String
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
- USER = {
109
- :name => 'vuser',
110
- :large => '--vuser username',
111
- :description => 'The username to interact with vCenter',
112
- :format => String
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
- PASS = {
116
- :name => 'vpass',
117
- :large => '--vpass password',
118
- :description => 'The password for the user',
119
- :format => String
154
+ NAME = {
155
+ :name => 'name',
156
+ :large => '--name name',
157
+ :format => String,
158
+ :description => 'Import template copy with name'
120
159
  }
121
160
 
122
- PORT = {
123
- :name => 'port',
124
- :short => '-p port',
125
- :large => '--port port',
161
+ FOLDER = {
162
+ :name => 'folder',
163
+ :large => '--folder folder',
126
164
  :format => String,
127
- :description => 'vCenter API port, defaults to 443 (SSL) or 80'
165
+ :description => 'Import template in folder'
128
166
  }
129
167
 
130
168
  USE_DEFAULTS = {
131
- :name => 'defaults',
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 => 'all',
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
- list = importer.retrieve_resources(args)
221
+ args[:filter] = true
222
+ args[:short] = true
179
223
 
180
- helper.list_object(options, list)
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
- exit 0
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
- list = importer.retrieve_resources(args)
246
+ args[:filter] = false
247
+ args[:short] = true
211
248
 
212
- helper.list_object(options, list)
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
- exit 0
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, [:oid, nil],
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 = VCenterDriver::VcImporter.new_child(helper.client,
244
- vi_client,
245
- options[:object])
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
- " resources info in host: #{options[:host]} with"\
253
- " this input: #{args.first}"
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
- exit 0
304
+ 0
267
305
  end
268
306
 
269
307
  command :import_defaults,
270
308
  import_desc,
271
309
  [:oid, nil],
272
- :options => [OBJECT, HOST, DATASTORE, CONFIG] do
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 = VCenterDriver::VcImporter.new_child(helper.client,
276
- vi_client,
277
- options[:object])
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
- importer.process_import(indexes, options)
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
- exit 0
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 <vcenter_user> --vpass <password>
372
+ onevcenter hosts --vcenter <vcenter> --vuser <user> --vpass <pass>
307
373
  EOT
374
+
308
375
  command :hosts,
309
376
  host_desc,
310
- :options => [VCENTER, USER, PASS, USE_DEFAULTS, PORT] do
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
- exit 0
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 = args[0]
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
- exit 0
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-2021, OpenNebula Project, OpenNebula Systems #
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 #