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
data/bin/onevm 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 #
@@ -239,6 +239,10 @@ CommandParser::CmdParser.new(ARGV) do
239
239
  :description => 'SSH options to use'
240
240
  }
241
241
 
242
+ OpenNebulaHelper::TEMPLATE_OPTIONS_VM.delete_if do |v|
243
+ %w[as_gid as_uid].include?(v[:name])
244
+ end
245
+
242
246
  ########################################################################
243
247
  # Global Options
244
248
  ########################################################################
@@ -909,6 +913,36 @@ CommandParser::CmdParser.new(ARGV) do
909
913
  end
910
914
  end
911
915
 
916
+ sg_attach_desc = <<-EOT.unindent
917
+ Attaches a Security Group to a VM.
918
+
919
+ States: All, except BOOT, MIGRATE and HOTPLUG_NIC
920
+ EOT
921
+
922
+ command :"sg-attach", sg_attach_desc, :vmid, :nicid, :sgid do
923
+ nic_id = args[1].to_i
924
+ sg_id = args[2].to_i
925
+
926
+ helper.perform_action(args[0], options, 'Attach SG') do |vm|
927
+ vm.sg_attach(nic_id, sg_id)
928
+ end
929
+ end
930
+
931
+ sg_detach_desc = <<-EOT.unindent
932
+ Detaches a Security Group from a VM.
933
+
934
+ States: All, except BOOT, MIGRATE and HOTPLUG_NIC
935
+ EOT
936
+
937
+ command :"sg-detach", sg_detach_desc, :vmid, :nicid, :sgid do
938
+ nic_id = args[1].to_i
939
+ sg_id = args[2].to_i
940
+
941
+ helper.perform_action(args[0], options, 'Detach SG') do |vm|
942
+ vm.sg_detach(nic_id, sg_id)
943
+ end
944
+ end
945
+
912
946
  chgrp_desc = <<-EOT.unindent
913
947
  Changes the VM group
914
948
  EOT
@@ -1394,16 +1428,22 @@ CommandParser::CmdParser.new(ARGV) do
1394
1428
  acc_t = 0
1395
1429
  acc_w = 0
1396
1430
 
1397
- charters.each do |action, time|
1398
- sched = "+#{time[:time].to_i + acc_t}"
1431
+ helper.perform_action(args[0], {}, 'Charter added') do |vm|
1432
+ vm.info
1433
+
1434
+ diff_stime = Time.now.to_i - vm['/VM/STIME'].to_i
1399
1435
 
1400
- helper.schedule_actions([args[0]].flatten,
1401
- { :schedule => sched },
1402
- action.to_s,
1403
- time[:warning][:time] + acc_w)
1436
+ charters.each do |action, time|
1437
+ sched = "+#{time[:time].to_i + acc_t + diff_stime}"
1404
1438
 
1405
- acc_t += time[:time].to_i
1406
- acc_w += time[:warning][:time].to_i
1439
+ helper.schedule_actions([args[0]].flatten,
1440
+ { :schedule => sched },
1441
+ action.to_s,
1442
+ time[:warning][:time] + acc_w)
1443
+
1444
+ acc_t += time[:time].to_i
1445
+ acc_w += time[:warning][:time].to_i
1446
+ end
1407
1447
  end
1408
1448
 
1409
1449
  0
data/bin/onevmgroup 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/onevnet 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 #
@@ -94,6 +94,26 @@ CommandParser::CmdParser.new(ARGV) do
94
94
  'bypass the consistency checks'
95
95
  }
96
96
 
97
+ SUCCESS = {
98
+ :name => 'success',
99
+ :large => '--success',
100
+ :description => 'Recover a Virtual Network by succeeding ' \
101
+ 'the pending action'
102
+ }
103
+
104
+ FAILURE = {
105
+ :name => 'failure',
106
+ :large => '--failure',
107
+ :description => 'Recover a Virtual Network by failing ' \
108
+ 'the pending action'
109
+ }
110
+
111
+ DELETE = {
112
+ :name => 'delete',
113
+ :large => '--delete',
114
+ :description => 'No recover action possible, delete the Virtual Network'
115
+ }
116
+
97
117
  ########################################################################
98
118
  # Global Options
99
119
  ########################################################################
@@ -428,4 +448,41 @@ CommandParser::CmdParser.new(ARGV) do
428
448
 
429
449
  return 0
430
450
  end
451
+
452
+ recover_desc = <<-EOT.unindent
453
+ Recovers a Virtual Network in ERROR state or waiting for a driver operation
454
+ to complete.
455
+ The recovery may be done by failing, succeeding or retrying the current operation.
456
+ YOU NEED TO MANUALLY CHECK THE VN STATUS, to decide if the
457
+ operation was successful or not, or if it can be retried.
458
+
459
+ States for success/failure recovers: LOCK_CREATE, LOCK_DELETE state.
460
+ States for a retry recover: LOCK_CREATE, LOCK_DELETE state
461
+ States for delete: Any but READY
462
+ EOT
463
+
464
+ command :recover, recover_desc, [:range, :vmid_list],
465
+ :options => [SUCCESS, FAILURE, DELETE] do
466
+ if !options[:success].nil?
467
+ result = 1
468
+ elsif !options[:failure].nil?
469
+ result = 0
470
+ elsif !options[:delete].nil?
471
+ result = 2
472
+ else
473
+ error_message = <<-EOT.unindent
474
+ Need to specify the result of the pending action.
475
+ \t--success recover the VN by succeeding the missing action.
476
+ \t--failure recover the VN by failing the missing action.
477
+ \t--delete no recover possible, delete the VN.
478
+ EOT
479
+
480
+ STDERR.puts error_message
481
+ exit(-1)
482
+ end
483
+
484
+ helper.perform_actions(args[0], options, 'recovering') do |vn|
485
+ vn.recover(result)
486
+ end
487
+ end
431
488
  end
data/bin/onevntemplate 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/onevrouter 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/onezone 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/lib/cli_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -61,7 +61,8 @@ module CLIHelper
61
61
  ' ' * 31 << 'column=value pairs.' <<
62
62
  ' ' * 31 << "Valid operators #{FILTER_OPS.join(',')}" <<
63
63
  ' ' * 31 << 'e.g. NAME=test (match name with test)' <<
64
- ' ' * 31 << 'NAME~test (match test, te, tes..)'
64
+ ' ' * 31 << 'NAME~test (match every NAME containing' <<
65
+ ' ' * 31 << 'the substring \'test\')'
65
66
  }
66
67
 
67
68
  OPERATOR = {
@@ -187,9 +188,17 @@ module CLIHelper
187
188
  error
188
189
  ERROR
189
190
  FAILED_DEPLOYING
191
+ FAILED_DEPLOYING_NETS
190
192
  FAILED_UNDEPLOYING
193
+ FAILED_UNDEPLOYING_NETS
191
194
  FAILED_SCALING]
192
- REGULAR_STATES = %w[PENDING DEPLOYING CONFIGURING WARNING]
195
+ REGULAR_STATES = %w[PENDING
196
+ DEPLOYING
197
+ DEPLOYING_NETS
198
+ UNDEPLOYING
199
+ UNDEPLOYING_NETS
200
+ CONFIGURING
201
+ WARNING]
193
202
 
194
203
  # Set state color
195
204
  #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -27,9 +27,10 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
27
27
  module VOBJECT
28
28
 
29
29
  DATASTORE = 1
30
- TEMPLATE = 2
31
- NETWORK = 3
32
- IMAGE = 4
30
+ TEMPLATE = 2
31
+ NETWORK = 3
32
+ IMAGE = 4
33
+ HOST = 5
33
34
 
34
35
  end
35
36
 
@@ -85,6 +86,12 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
85
86
  :columns => { :IMID => 5, :REF => 35, :PATH => 60 },
86
87
  :cli => [:host, :datastore],
87
88
  :dialogue => ->(arg) {}
89
+ },
90
+ VOBJECT::HOST => {
91
+ :struct => %w[HOST_LIST HOST],
92
+ :columns => { :DATACENTER => 10, :NAME => 30, :REF => 35 },
93
+ :cli => [],
94
+ :dialogue => ->(arg) {}
88
95
  }
89
96
  }
90
97
 
@@ -143,6 +150,8 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
143
150
  @vobject = VOBJECT::NETWORK
144
151
  when 'images'
145
152
  @vobject = VOBJECT::IMAGE
153
+ when 'hosts'
154
+ @vobject = VOBJECT::HOST
146
155
  else
147
156
  puts "unknown #{type} type option"
148
157
  puts ' -o options:'
@@ -150,6 +159,7 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
150
159
  puts ' templates'
151
160
  puts ' networks'
152
161
  puts ' images'
162
+ puts ' hosts'
153
163
 
154
164
  exit 0
155
165
  end
@@ -186,6 +196,28 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
186
196
  }
187
197
  end
188
198
 
199
+ # General method to list vCenter objects
200
+ #
201
+ # @param options [Hash] User CLI options
202
+ # @param args [Hash] Search arguments
203
+ def list(options, args)
204
+ if !options[:host]
205
+ # This case is to list available hosts, instead other object
206
+ list_hosts(options)
207
+ else
208
+ vi_client = VCenterDriver::VIClient.new_from_host(
209
+ options[:host]
210
+ )
211
+ importer = VCenterDriver::VcImporter.new_child(
212
+ @client,
213
+ vi_client,
214
+ options[:object]
215
+ )
216
+
217
+ list_object(options, importer.retrieve_resources(args))
218
+ end
219
+ end
220
+
189
221
  # This method will print a list for a vcenter_resource.
190
222
  #
191
223
  def list_object(options, list)
@@ -198,6 +230,31 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
198
230
  table.show(list, options)
199
231
  end
200
232
 
233
+ # List unimported hosts
234
+ #
235
+ # @param options [Hash] User CLI options
236
+ def list_hosts(options)
237
+ con_ops = connection_options('hosts', options)
238
+ vi_client = VCenterDriver::VIClient.new(con_ops)
239
+ dc_folder = VCenterDriver::DatacenterFolder.new(vi_client)
240
+ hpool = VCenterDriver::VIHelper.one_pool(OpenNebula::HostPool,
241
+ false)
242
+
243
+ VCenterDriver::VIHelper.set_client(nil, @client)
244
+
245
+ list = []
246
+ hosts = dc_folder.get_unimported_hosts(hpool, vi_client.vim.host)
247
+
248
+ hosts.each do |key, value|
249
+ value.each do |v|
250
+ v[:datacenter] = key
251
+ list << v
252
+ end
253
+ end
254
+
255
+ format_list.show(hosts, options)
256
+ end
257
+
201
258
  # handles :cli section of TABLE
202
259
  # used for executing the dialogue in some VOBJECTS
203
260
  #
@@ -252,12 +309,18 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
252
309
  def format_list
253
310
  config = TABLE[@vobject][:columns]
254
311
  CLIHelper::ShowTable.new do
312
+ column :DATACENTER,
313
+ 'Object datacenter',
314
+ :size => config[:DATACENTER] || 15 do |d|
315
+ d[:datacenter]
316
+ end
317
+
255
318
  column :IMID, 'identifier for ...', :size=>config[:IMID] || 4 do |d|
256
319
  d[:import_id]
257
320
  end
258
321
 
259
322
  column :REF, 'ref', :left, :adjust, :size=>config[:REF] || 15 do |d|
260
- d[:ref]
323
+ d[:ref] || d[:cluster_ref]
261
324
  end
262
325
 
263
326
  column :NAME, 'Name', :left, :expand,
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -138,6 +138,12 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
138
138
  'onevnet.yaml'
139
139
  end
140
140
 
141
+ def self.state_to_str(id)
142
+ id = id.to_i
143
+ state_str = VirtualNetwork::VN_STATES[id]
144
+ VirtualNetwork::SHORT_VN_STATES[state_str]
145
+ end
146
+
141
147
  def format_pool(options)
142
148
  config_file = self.class.table_conf
143
149
 
@@ -170,12 +176,18 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
170
176
  d['BRIDGE']
171
177
  end
172
178
 
179
+ column :STATE, 'State of the Virtual Network', :left,
180
+ :size=>6 do |d|
181
+ OneVNetHelper.state_to_str(d['STATE'])
182
+ end
183
+
173
184
  column :LEASES, "Number of this Virtual Network's given leases",
174
185
  :size=>6 do |d|
175
186
  d['USED_LEASES']
176
187
  end
177
188
 
178
- default :ID, :USER, :GROUP, :NAME, :CLUSTERS, :BRIDGE, :LEASES
189
+ default :ID, :USER, :GROUP, :NAME, :CLUSTERS, :BRIDGE, :STATE,
190
+ :LEASES
179
191
  end
180
192
  end
181
193
 
@@ -315,6 +327,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
315
327
  vn.retrieve_elements('CLUSTERS/ID')
316
328
  ))
317
329
  puts format(str, 'BRIDGE', vn['BRIDGE'])
330
+ puts format(str, 'STATE', vn.state_str)
318
331
  puts format(str, 'VN_MAD', vn['VN_MAD']) unless vn['VN_MAD'].empty?
319
332
  puts format(str, 'PHYSICAL DEVICE',
320
333
  vn['PHYDEV']) unless vn['PHYDEV'].empty?
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -577,7 +577,23 @@ class OneZoneHelper < OpenNebulaHelper::OneHelper
577
577
  puts "Endpoint changed to \"#{zone['TEMPLATE/ENDPOINT']}\" in " <<
578
578
  "#{ENV['HOME']}/.one/one_endpoint"
579
579
  end
580
- return 0
580
+
581
+ return 0 unless zone['TEMPLATE/ONEFLOW_ENDPOINT']
582
+
583
+ # Set ONEFLOW_ENDPOINT
584
+ if temporary_zone
585
+ puts "Type: export ONEFLOW_URL=#{zone['TEMPLATE/ONEFLOW_ENDPOINT']}"
586
+ else
587
+ File.open(ENV['HOME'] + '/.one/oneflow_endpoint', 'w') do |f|
588
+ f.puts zone['TEMPLATE/ONEFLOW_ENDPOINT']
589
+ end
590
+
591
+ puts 'OneFlow Endpoint changed to ' \
592
+ "\"#{zone['TEMPLATE/ONEFLOW_ENDPOINT']}\" in " <<
593
+ "#{ENV['HOME']}/.one/oneflow_endpoint"
594
+ end
595
+
596
+ 0
581
597
  end
582
598
 
583
599
  private
data/lib/one_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2021, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2022, OpenNebula Project, OpenNebula Systems #
3
3
  # #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
5
  # not use this file except in compliance with the License. You may obtain #
@@ -30,7 +30,7 @@ include OpenNebula
30
30
  module OpenNebulaHelper
31
31
  ONE_VERSION=<<-EOT
32
32
  OpenNebula #{OpenNebula::VERSION}
33
- Copyright 2002-2021, OpenNebula Project, OpenNebula Systems
33
+ Copyright 2002-2022, OpenNebula Project, OpenNebula Systems
34
34
  EOT
35
35
 
36
36
  if ONE_LOCATION