opennebula-cli 5.4.15 → 5.5.80.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/NOTICE +1 -1
  3. data/bin/oneacct +3 -3
  4. data/bin/oneacl +2 -2
  5. data/bin/onecluster +1 -1
  6. data/bin/onedatastore +1 -1
  7. data/bin/oneflow +1 -1
  8. data/bin/oneflow-template +1 -1
  9. data/bin/onegroup +1 -1
  10. data/bin/onehost +1 -1
  11. data/bin/oneimage +64 -1
  12. data/bin/onemarket +1 -1
  13. data/bin/onemarketapp +65 -2
  14. data/bin/onesecgroup +1 -1
  15. data/bin/oneshowback +2 -2
  16. data/bin/onetemplate +66 -3
  17. data/bin/oneuser +3 -3
  18. data/bin/onevcenter +95 -86
  19. data/bin/onevdc +1 -1
  20. data/bin/onevm +75 -11
  21. data/bin/onevmgroup +64 -1
  22. data/bin/onevnet +64 -1
  23. data/bin/onevrouter +64 -1
  24. data/bin/onezone +1 -1
  25. data/lib/cli_helper.rb +1 -1
  26. data/lib/command_parser.rb +9 -1
  27. data/lib/one_helper/oneacct_helper.rb +22 -18
  28. data/lib/one_helper/oneacl_helper.rb +1 -1
  29. data/lib/one_helper/onecluster_helper.rb +1 -1
  30. data/lib/one_helper/onedatastore_helper.rb +1 -1
  31. data/lib/one_helper/onegroup_helper.rb +1 -1
  32. data/lib/one_helper/onehost_helper.rb +32 -6
  33. data/lib/one_helper/oneimage_helper.rb +2 -1
  34. data/lib/one_helper/onemarket_helper.rb +1 -1
  35. data/lib/one_helper/onemarketapp_helper.rb +2 -1
  36. data/lib/one_helper/onequota_helper.rb +1 -1
  37. data/lib/one_helper/onesecgroup_helper.rb +1 -1
  38. data/lib/one_helper/onetemplate_helper.rb +2 -1
  39. data/lib/one_helper/oneuser_helper.rb +13 -1
  40. data/lib/one_helper/onevcenter_helper.rb +425 -0
  41. data/lib/one_helper/onevdc_helper.rb +5 -5
  42. data/lib/one_helper/onevm_helper.rb +100 -2
  43. data/lib/one_helper/onevmgroup_helper.rb +14 -9
  44. data/lib/one_helper/onevnet_helper.rb +7 -3
  45. data/lib/one_helper/onevrouter_helper.rb +2 -1
  46. data/lib/one_helper/onezone_helper.rb +22 -39
  47. data/lib/one_helper.rb +64 -8
  48. metadata +7 -6
data/bin/onezone CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  # -------------------------------------------------------------------------- #
4
- # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
4
+ # Copyright 2002-2018, 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-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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 #
@@ -73,6 +73,14 @@ module CommandParser
73
73
 
74
74
  instance_eval(&block)
75
75
 
76
+ addons = Dir["#{OpenNebulaHelper::CLI_ADDONS_LOCATION}/#{File.basename($0)}/*"]
77
+ if defined?(addons) and !addons.nil?
78
+ addons.each do |addon_path|
79
+ addon_code = File.read(addon_path)
80
+ instance_eval(addon_code)
81
+ end
82
+ end
83
+
76
84
  self.run
77
85
  end
78
86
 
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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 #
@@ -144,43 +144,47 @@ class AcctHelper < OpenNebulaHelper::OneHelper
144
144
  end
145
145
 
146
146
  column :MEMORY, "Assigned memory", :size=>6 do |d|
147
- OpenNebulaHelper.unit_to_str(d["VM"]["TEMPLATE"]["MEMORY"].to_i, {}, 'M')
147
+ OpenNebulaHelper.unit_to_str(d["VM"]["TEMPLATE"]["MEMORY"].to_i, {}, 'M') rescue "-"
148
148
  end
149
149
 
150
150
  column :CPU, "Number of CPUs", :size=>3 do |d|
151
- d["VM"]["TEMPLATE"]["CPU"]
151
+ d["VM"]["TEMPLATE"]["CPU"] rescue "-"
152
152
  end
153
153
 
154
154
  column :NETRX, "Data received from the network", :size=>6 do |d|
155
155
  # NET is measured in bytes, unit_to_str expects KBytes
156
- OpenNebulaHelper.unit_to_str(d["VM"]["MONITORING"]["NETRX"].to_i / 1024.0, {})
156
+ OpenNebulaHelper.unit_to_str(d["VM"]["MONITORING"]["NETRX"].to_i / 1024.0, {}) rescue "-"
157
157
  end
158
158
 
159
159
  column :NETTX, "Data sent to the network", :size=>6 do |d|
160
160
  # NET is measured in bytes, unit_to_str expects KBytes
161
- OpenNebulaHelper.unit_to_str(d["VM"]["MONITORING"]["NETTX"].to_i / 1024.0, {})
161
+ OpenNebulaHelper.unit_to_str(d["VM"]["MONITORING"]["NETTX"].to_i / 1024.0, {}) rescue "-"
162
162
  end
163
163
 
164
164
  column :DISK, "Total disk size used", :size=>6 do |d|
165
165
  # DISK size is measured in mb, unit_to_str expects KBytes
166
- total_disk_size = 0
166
+ begin
167
+ total_disk_size = 0
167
168
 
168
- vm_id = d["VM"]["ID"].to_i
169
+ vm_id = d["VM"]["ID"].to_i
169
170
 
170
- disks_all = [d["VM"]["TEMPLATE"]["DISK"]].flatten.compact rescue []
171
- disks_all.each do |disk|
172
- total_disk_size += disk["SIZE"].to_i
173
- end
171
+ disks_all = [d["VM"]["TEMPLATE"]["DISK"]].flatten.compact rescue []
172
+ disks_all.each do |disk|
173
+ total_disk_size += disk["SIZE"].to_i
174
+ end
174
175
 
175
- snapshots_all = [d["VM"]["SNAPSHOTS"]].flatten.compact rescue []
176
- snapshots_all.each do |snapshot|
177
- snapshot_disk = [snapshot["SNAPSHOT"]].flatten.compact rescue []
178
- snapshot_disk.each do |snapshot|
179
- total_disk_size += snapshot["SIZE"].to_i
176
+ snapshots_all = [d["VM"]["SNAPSHOTS"]].flatten.compact rescue []
177
+ snapshots_all.each do |snapshot|
178
+ snapshot_disk = [snapshot["SNAPSHOT"]].flatten.compact rescue []
179
+ snapshot_disk.each do |snapshot|
180
+ total_disk_size += snapshot["SIZE"].to_i
181
+ end
180
182
  end
181
- end
182
183
 
183
- OpenNebulaHelper.unit_to_str(total_disk_size * 1024.0, {})
184
+ OpenNebulaHelper.unit_to_str(total_disk_size * 1024.0, {})
185
+ rescue
186
+ "-"
187
+ end
184
188
  end
185
189
 
186
190
  default :VID, :HOSTNAME, :ACTION, :START_TIME, :END_TIME, :MEMORY, :CPU, :NETRX, :NETTX, :DISK
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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 #
@@ -42,6 +42,32 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
42
42
  #
43
43
  #-----------------------------------------------------------------------
44
44
  EOT
45
+ },
46
+ :az => {
47
+ :help => <<-EOT.unindent,
48
+ #-----------------------------------------------------------------------
49
+ # Supported AZURE AUTH ATTRIBUTTES:
50
+ #
51
+ # AZ_ID = <azure classic id>
52
+ # AZ_CERT = <azure classic certificate>
53
+ #
54
+ # REGION_NAME = <the name of the azure region>
55
+ #
56
+ # CAPACITY = [
57
+ # Small = <number of small machines>,
58
+ # Medium = <number of medium machines>,
59
+ # Large = <number of large machines
60
+ # ]
61
+ #
62
+ # You can set any machine type supported by azure classic
63
+ # See your az_driver.conf for more information
64
+ #
65
+ # Optionally you can set a endpoint
66
+ #
67
+ # AZ_ENDPOINT = <endpoint address>
68
+ #
69
+ #-----------------------------------------------------------------------
70
+ EOT
45
71
  }
46
72
  }
47
73
 
@@ -80,7 +106,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
80
106
  end
81
107
 
82
108
  column :RVM, "Number of Virtual Machines running", :size=>3 do |d|
83
- d["HOST_SHARE"]["RUNNING_VMS"]
109
+ d["HOST_SHARE"]["RUNNING_VMS"] || 0
84
110
  end
85
111
 
86
112
  column :ZVM, "Number of Virtual Machine zombies", :size=>3 do |d|
@@ -88,12 +114,12 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
88
114
  end
89
115
 
90
116
  column :TCPU, "Total CPU percentage", :size=>4 do |d|
91
- d["HOST_SHARE"]["MAX_CPU"]
117
+ d["HOST_SHARE"]["MAX_CPU"] || 0
92
118
  end
93
119
 
94
120
  column :FCPU, "Free CPU percentage", :size=>4 do |d|
95
121
  d["HOST_SHARE"]["MAX_CPU"].to_i-
96
- d["HOST_SHARE"]["USED_CPU"].to_i
122
+ d["HOST_SHARE"]["USED_CPU"].to_i rescue "-"
97
123
  end
98
124
 
99
125
  column :ACPU, "Available cpu percentage (not reserved by VMs)",
@@ -106,13 +132,13 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
106
132
  column :TMEM, "Total Memory", :size=>7 do |d|
107
133
  OpenNebulaHelper.unit_to_str(
108
134
  d["HOST_SHARE"]["MAX_MEM"].to_i,
109
- options)
135
+ options) rescue "-"
110
136
  end
111
137
 
112
138
  column :FMEM, "Free Memory", :size=>7 do |d|
113
139
  OpenNebulaHelper.unit_to_str(
114
140
  d["HOST_SHARE"]["FREE_MEM"].to_i,
115
- options)
141
+ options) rescue "-"
116
142
  end
117
143
 
118
144
  column :AMEM, "Available Memory (not reserved by VMs)",
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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 #
@@ -265,6 +265,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
265
265
  puts str % ["NAME", image.name]
266
266
  puts str % ["USER", image['UNAME']]
267
267
  puts str % ["GROUP",image['GNAME']]
268
+ puts str % ["LOCK", OpenNebulaHelper.level_lock_to_str(image['LOCK/LOCKED'])]
268
269
  puts str % ["DATASTORE",image['DATASTORE']]
269
270
  puts str % ["TYPE", image.type_str]
270
271
  puts str % ["REGISTER TIME",
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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 #
@@ -150,6 +150,7 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper
150
150
  puts str % ["GROUP", app['GNAME']]
151
151
  puts str % ["MARKETPLACE", app['MARKETPLACE']]
152
152
  puts str % ["STATE", OneMarketPlaceAppHelper.state_to_str(app["STATE"])]
153
+ puts str % ["LOCK", OpenNebulaHelper.level_lock_to_str(app['LOCK/LOCKED'])]
153
154
 
154
155
  puts
155
156
 
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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 #
@@ -321,6 +321,7 @@ EOT
321
321
  puts str % ["NAME", template.name]
322
322
  puts str % ["USER", template['UNAME']]
323
323
  puts str % ["GROUP", template['GNAME']]
324
+ puts str % ["LOCK", OpenNebulaHelper.level_lock_to_str(template['LOCK/LOCKED'])]
324
325
  puts str % ["REGISTER TIME",
325
326
  OpenNebulaHelper.time_to_str(template['REGTIME'])]
326
327
  puts
@@ -1,5 +1,5 @@
1
1
  # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2017, OpenNebula Project, OpenNebula Systems #
2
+ # Copyright 2002-2018, 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 #
@@ -215,8 +215,20 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
215
215
  # Check that ONE_AUTH target can be written
216
216
  #-----------------------------------------------------------------------
217
217
  if File.file?(ONE_AUTH) && !options[:force]
218
+ puts " * Do you want to overwrite the file #{ONE_AUTH}? (Y|N): "
219
+
220
+ answer = STDIN.readline.chop
221
+
222
+ case answer
223
+ when 'Y', 'y', 'yes', 'YES', 'Yes'
224
+ puts "overwriting #{ONE_AUTH} ..."
225
+ when 'N', 'n', 'no', 'NO', 'No'
218
226
  return 0, "File #{ONE_AUTH} exists, use --force to overwrite."\
219
227
  "\n#{token_info}"
228
+ else
229
+ puts "Not valid option."
230
+ return -1
231
+ end
220
232
  end
221
233
 
222
234
  #-----------------------------------------------------------------------