opennebula-cli 4.7.80.beta → 4.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 585883a7bcb4f9ac918ccb674a77e40dc14b7883
4
- data.tar.gz: ab8c5c867a236d9a78aa65ff4679a85077cf93eb
3
+ metadata.gz: bbd995e66e10d552bf657f6b740611ca27bd7a59
4
+ data.tar.gz: 4627696981ec98c2f7e58c3f6b757ebccc361fd7
5
5
  SHA512:
6
- metadata.gz: 504217b07bc07ee8802598b4090b903f63866ffef10bd24dd76d599bacaab7b292bcad92799dfee336fa5b22b582d6b346ca784b9edb7f6e3e4fac076f8e33ca
7
- data.tar.gz: 6de0113350a2d42d773f8b14d009dec444eff62e62820d9ab08e2ecbbc943252656cc251c88855853214c4d7502a807dec3493dda6b6e68aa78d4f966a7a2a3b
6
+ metadata.gz: 0c6a6a1137b7dcba177260cf1837e3431d8494feb118ed1eb16428a272bfd8cde407fa01943c3ff67b0831d107ac516b8084e80f11d218aabf1590465c35dc96
7
+ data.tar.gz: 7f592fbda949b2e429d06d72612abb7f1b2a801067b7859841dc162b2c5168b53f770501c96e749acf2e1c41029e293974e38389e1fa0eafcd89f9dc157a1ca5
data/bin/onetemplate CHANGED
@@ -185,6 +185,8 @@ cmd=CommandParser::CmdParser.new(ARGV) do
185
185
  end
186
186
 
187
187
  number = options[:multiple] || 1
188
+ user_inputs = nil
189
+
188
190
  number.times do |i|
189
191
  exit_code=helper.perform_action(args[0], options,
190
192
  "instantiated") do |t|
@@ -194,11 +196,11 @@ cmd=CommandParser::CmdParser.new(ARGV) do
194
196
  on_hold = options[:hold] != nil
195
197
 
196
198
  extra_template = ""
199
+ t.info
197
200
 
198
201
  if args[1]
199
202
  extra_template = File.read(args[1])
200
203
  elsif options[:userdata]
201
- t.info
202
204
  if t.has_elements?('TEMPLATE/EC2')
203
205
  t.add_element(
204
206
  'TEMPLATE/EC2',
@@ -218,6 +220,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do
218
220
  extra_template = res.last
219
221
  end
220
222
 
223
+ user_inputs = helper.get_user_inputs(t.to_hash) unless user_inputs
224
+
225
+ extra_template << "\n" << user_inputs
226
+
221
227
  res = t.instantiate(name, on_hold, extra_template)
222
228
 
223
229
  if !OpenNebula.is_error?(res)
data/bin/onevnet CHANGED
@@ -112,9 +112,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
112
112
  Adds an address range to the Virtual Network
113
113
  EOT
114
114
 
115
- command :addar, addar_desc, :vnetid, :options=>STD_OPTIONS + [OneVNetHelper::AR_SIZE,
116
- OneVNetHelper::AR_MAC, OneVNetHelper::AR_IP, OneVNetHelper::AR_IP6_GLOBAL,
117
- OneVNetHelper::AR_IP6_ULA ] do
115
+ command :addar, addar_desc, :vnetid, :options=>STD_OPTIONS + [OneVNetHelper::SIZE,
116
+ OneVNetHelper::MAC, OneVNetHelper::IP, OneVNetHelper::IP6_GLOBAL,
117
+ OneVNetHelper::IP6_ULA ] do
118
118
  helper.perform_action(args[0],options,"lease added") do |vn|
119
119
  ar = "AR = [ "
120
120
 
@@ -150,6 +150,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do
150
150
  end
151
151
  end
152
152
 
153
+ addleases_desc = <<-EOT.unindent
154
+ (DEPRECATED, use addar) Adds a lease to the Virtual Network
155
+ EOT
156
+
157
+ command :addleases, addleases_desc, :vnetid, :ip, [:mac, nil] do
158
+ helper.perform_action(args[0],options,"lease added") do |vn|
159
+ vn.addleases(args[1], args[2])
160
+ end
161
+ end
162
+
153
163
  rmar_desc = <<-EOT.unindent
154
164
  Removes an address range from the Virtual Network
155
165
  EOT
@@ -160,6 +170,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do
160
170
  end
161
171
  end
162
172
 
173
+ rmleases_desc = <<-EOT.unindent
174
+ (DEPRECATED, use rmar) Removes a lease from the Virtual Network
175
+ EOT
176
+
177
+ command :rmleases, rmleases_desc, :vnetid, :ip do
178
+ helper.perform_action(args[0],options,"lease removed") do |vn|
179
+ vn.rmleases(args[1])
180
+ end
181
+ end
182
+
163
183
  free_desc = <<-EOT.unindent
164
184
  Frees a reserved address range from the Virtual Network
165
185
  EOT
@@ -177,7 +197,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
177
197
  command :hold, hold_desc, :vnetid, :ip,
178
198
  :options=>STD_OPTIONS + [OneVNetHelper::AR] do
179
199
  helper.perform_action(args[0],options,"lease on hold") do |vn|
180
- ar = options[:ar_id] || -1
200
+ ar = options[:address_range] || -1
181
201
 
182
202
  vn.hold(args[1], ar)
183
203
  end
@@ -190,7 +210,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
190
210
  command :release, release_desc, :vnetid, :ip,
191
211
  :options=>STD_OPTIONS + [OneVNetHelper::AR] do
192
212
  helper.perform_action(args[0],options,"lease released") do |vn|
193
- ar = options[:ar_id] || -1
213
+ ar = options[:address_range] || -1
194
214
 
195
215
  vn.release(args[1], ar)
196
216
  end
@@ -204,27 +224,27 @@ cmd=CommandParser::CmdParser.new(ARGV) do
204
224
  EOT
205
225
 
206
226
  command :reserve, reserve_desc, :vnetid, [:vnetid, nil],
207
- :options=>STD_OPTIONS + [OneVNetHelper::AR, OneVNetHelper::R_NAME,
208
- OneVNetHelper::R_SIZE, OneVNetHelper::AR_MAC, OneVNetHelper::AR_IP] do
227
+ :options=>STD_OPTIONS + [OneVNetHelper::AR, OneVNetHelper::NAME,
228
+ OneVNetHelper::SIZE, OneVNetHelper::MAC, OneVNetHelper::IP] do
209
229
  helper.perform_action(args[0],options,"reservation made") do |vn|
210
- rsize = options[:rsize] || -1
211
- rname = options[:rname] || -1
230
+ size = options[:size] || -1
231
+ name = options[:name] || -1
212
232
 
213
233
  addr = nil
214
234
  addr = options[:mac] if options[:mac]
215
235
  addr = options[:ip] if options[:ip]
216
236
 
217
- if rsize == -1
237
+ if size == -1
218
238
  STDERR.puts "Specify a size (-s size) for the reservation"
219
239
  exit -1
220
240
  end
221
241
 
222
- if rname == -1 && args[1].nil?
242
+ if name == -1 && args[1].nil?
223
243
  STDERR.puts "Specify a name (-n name) for the reservation"
224
244
  exit -1
225
245
  end
226
246
 
227
- vn.reserve(rname, rsize, options[:ar_id], addr, args[1])
247
+ vn.reserve(name, size, options[:address_range], addr, args[1])
228
248
  end
229
249
  end
230
250
 
@@ -83,6 +83,48 @@ EOT
83
83
  table
84
84
  end
85
85
 
86
+ def get_user_inputs(template)
87
+ user_inputs = template['VMTEMPLATE']['TEMPLATE']['USER_INPUTS']
88
+
89
+ return "" if !user_inputs
90
+
91
+ answers = ""
92
+
93
+ puts "There are some parameters that require user input."
94
+
95
+ user_inputs.each do |key, val|
96
+ input_cfg = val.split('|')
97
+
98
+ if input_cfg.length != 3
99
+ STDERR.puts "Malformed user input. It should have 3 parts separated by '|':"
100
+ STDERR.puts " #{key}: #{val}"
101
+ exit(-1)
102
+ end
103
+
104
+ optional, type, description = input_cfg
105
+ optional.strip!
106
+ type.strip!
107
+ description.strip!
108
+
109
+ print " * (#{key}) #{description}: "
110
+
111
+ case type
112
+ when 'text'
113
+ answer = STDIN.readline.chop
114
+ when 'password'
115
+ answer = OpenNebulaHelper::OneHelper.get_password
116
+ else
117
+ STDERR.puts "user input types can only be text or password:"
118
+ STDERR.puts " #{key}: #{val}"
119
+ exit(-1)
120
+ end
121
+ answers << "#{key} = \""
122
+ answers << answer.gsub('"', "\\\"") << "\"\n"
123
+ end
124
+
125
+ answers
126
+ end
127
+
86
128
  private
87
129
 
88
130
  def factory(id=nil)
@@ -126,6 +126,19 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
126
126
  def format_pool(options)
127
127
  config_file = self.class.table_conf
128
128
 
129
+ # Get cluster names to use later in list
130
+ cluster_pool = OpenNebula::ClusterPool.new(@client)
131
+ rc = cluster_pool.info
132
+
133
+ cluster_names = {}
134
+ cluster_names["-1"] = "default"
135
+
136
+ if !OpenNebula.is_error?(rc)
137
+ cluster_pool.each do |c|
138
+ cluster_names[c["ID"]] = c["NAME"]
139
+ end
140
+ end
141
+
129
142
  table = CLIHelper::ShowTable.new(config_file, self) do
130
143
  column :ID, "ONE identifier for Virtual Machine", :size=>6 do |d|
131
144
  d["ID"]
@@ -171,6 +184,23 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
171
184
  end
172
185
  end
173
186
 
187
+ column :CLUSTER, "Cluster where the VM is running", :left,
188
+ :size=> 10 do |d|
189
+ if d["HISTORY_RECORDS"]["HISTORY"]
190
+ history = [d["HISTORY_RECORDS"]["HISTORY"]].flatten
191
+ cluster_id = history.last["CID"]
192
+ cluster = cluster_names[cluster_id]
193
+
194
+ if !cluster
195
+ cluster_id
196
+ else
197
+ cluster
198
+ end
199
+ else
200
+ "NONE"
201
+ end
202
+ end
203
+
174
204
  column :TIME, "Time since the VM was submitted", :size=>10 do |d|
175
205
  stime = d["STIME"].to_i
176
206
  etime = d["ETIME"]=="0" ? Time.now.to_i : d["ETIME"].to_i
@@ -236,6 +266,28 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
236
266
  str_h1="%-80s"
237
267
  str="%-20s: %-20s"
238
268
 
269
+ cluster = nil
270
+
271
+ if %w{ACTIVE SUSPENDED POWEROFF}.include? vm.state_str
272
+ cluster_id = vm['/VM/HISTORY_RECORDS/HISTORY[last()]/CID']
273
+ else
274
+ cluster_id = nil
275
+ end
276
+
277
+ if cluster_id
278
+ if cluster_id == "-1"
279
+ cluster = "default"
280
+ else
281
+ clu = OpenNebula::Cluster.new(OpenNebula::Cluster.build_xml(cluster_id), @client)
282
+ rc = clu.info
283
+ if OpenNebula.is_error?(rc)
284
+ cluster = "ERROR"
285
+ else
286
+ cluster = clu["NAME"]
287
+ end
288
+ end
289
+ end
290
+
239
291
  CLIHelper.print_header(
240
292
  str_h1 % "VIRTUAL MACHINE #{vm['ID']} INFORMATION")
241
293
  puts str % ["ID", vm.id.to_s]
@@ -248,9 +300,8 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
248
300
  puts str % ["HOST",
249
301
  vm['/VM/HISTORY_RECORDS/HISTORY[last()]/HOSTNAME']] if
250
302
  %w{ACTIVE SUSPENDED POWEROFF}.include? vm.state_str
251
- puts str % ["CLUSTER ID",
252
- vm['/VM/HISTORY_RECORDS/HISTORY[last()]/CID'] ] if
253
- %w{ACTIVE SUSPENDED POWEROFF}.include? vm.state_str
303
+ puts str % ["CLUSTER ID", cluster_id ] if cluster_id
304
+ puts str % ["CLUSTER", cluster ] if cluster
254
305
  puts str % ["START TIME",
255
306
  OpenNebulaHelper.time_to_str(vm['/VM/STIME'])]
256
307
  puts str % ["END TIME",
@@ -19,68 +19,68 @@ require 'one_helper/onevm_helper'
19
19
 
20
20
  class OneVNetHelper < OpenNebulaHelper::OneHelper
21
21
  AR = {
22
- :name => "ar_id",
22
+ :name => "address_range",
23
23
  :short => "-a ar_id",
24
24
  :large => "--address_range ar_id",
25
25
  :format => Integer,
26
26
  :description => "ID of the address range"
27
27
  }
28
28
 
29
- AR_MAC = {
29
+ MAC = {
30
30
  :name => "mac",
31
31
  :short => "-m mac",
32
- :large => "--address_range_mac mac",
32
+ :large => "--mac mac",
33
33
  :format => String,
34
34
  :description => "First MAC address in : notation"
35
35
  }
36
36
 
37
- AR_IP = {
37
+ IP = {
38
38
  :name => "ip",
39
39
  :short => "-i ip",
40
- :large => "--address_range_ip ip",
40
+ :large => "--ip ip",
41
41
  :format => String,
42
42
  :description => "First IP address in . notation"
43
43
  }
44
44
 
45
- AR_SIZE = {
45
+ SIZE = {
46
46
  :name => "size",
47
47
  :short => "-s size",
48
- :large => "--address_range_size size",
48
+ :large => "--size size",
49
49
  :format => String,
50
- :description => "Number of addresses in the range"
50
+ :description => "Number of addresses"
51
51
  }
52
52
 
53
- AR_IP6_GLOBAL = {
53
+ IP6_GLOBAL = {
54
54
  :name => "ip6_global",
55
55
  :short => "-g ip6_pref",
56
- :large => "--address_range_ip6g ip6_pref",
56
+ :large => "--ip6_global ip6_pref",
57
57
  :format => String,
58
58
  :description => "IP6 global prefix"
59
59
  }
60
60
 
61
- AR_IP6_ULA = {
61
+ IP6_ULA = {
62
62
  :name => "ip6_ula",
63
63
  :short => "-u ip6_pref",
64
- :large => "--address_range_ip6u ip6_pref",
64
+ :large => "--ip6_ula ip6_pref",
65
65
  :format => String,
66
66
  :description => "IP6 ula prefix"
67
67
  }
68
68
 
69
- R_NAME = {
70
- :name => "rname",
69
+ NAME = {
70
+ :name => "name",
71
71
  :short => "-n reservation name",
72
72
  :large => "--name reservation name",
73
73
  :format => String,
74
74
  :description => "Name of the address reservation"
75
75
  }
76
76
 
77
- R_SIZE = {
78
- :name => "rsize",
79
- :short => "-s reservation size",
80
- :large => "--size reservation size",
81
- :format => String,
82
- :description => "Number of addresses to reserve"
83
- }
77
+ # R_SIZE = {
78
+ # :name => "rsize",
79
+ # :short => "-s reservation size",
80
+ # :large => "--size reservation size",
81
+ # :format => String,
82
+ # :description => "Number of addresses to reserve"
83
+ # }
84
84
 
85
85
  def self.rname
86
86
  "VNET"
@@ -99,7 +99,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
99
99
  end
100
100
 
101
101
  column :USER, "Username of the Virtual Network owner", :left,
102
- :size=>12 do |d|
102
+ :size=>15 do |d|
103
103
  helper.user_name(d, options)
104
104
  end
105
105
 
@@ -109,7 +109,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
109
109
  end
110
110
 
111
111
  column :NAME, "Name of the Virtual Network", :left,
112
- :size=>15 do |d|
112
+ :size=>19 do |d|
113
113
  d["NAME"]
114
114
  end
115
115
 
@@ -117,10 +117,6 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
117
117
  OpenNebulaHelper.cluster_str(d["CLUSTER"])
118
118
  end
119
119
 
120
- column :SIZE, "Size of the Virtual Network", :size=>5 do |d|
121
- d["SIZE"]
122
- end
123
-
124
120
  column :BRIDGE, "Bridge associated to the Virtual Network", :left,
125
121
  :size=>8 do |d|
126
122
  d["BRIDGE"]
@@ -131,7 +127,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
131
127
  d["USED_LEASES"]
132
128
  end
133
129
 
134
- default :ID, :USER, :GROUP, :NAME, :CLUSTER, :TYPE, :BRIDGE, :LEASES
130
+ default :ID, :USER, :GROUP, :NAME, :CLUSTER, :BRIDGE, :LEASES
135
131
  end
136
132
 
137
133
  table
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.80.beta
4
+ version: 4.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-17 00:00:00.000000000 Z
11
+ date: 2014-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -16,36 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.7.80.beta
19
+ version: 4.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.7.80.beta
26
+ version: 4.8.0
27
27
  description: Commands used to talk to OpenNebula
28
28
  email: contact@opennebula.org
29
29
  executables:
30
+ - oneacct
30
31
  - oneacl
31
- - onehost
32
- - oneflow-template
33
- - onevnet
34
- - oneimage
32
+ - onecluster
35
33
  - onedatastore
36
- - onevm
34
+ - oneflow
35
+ - oneflow-template
37
36
  - onegroup
38
- - onecluster
37
+ - onehost
38
+ - oneimage
39
39
  - onetemplate
40
- - oneflow
41
40
  - oneuser
41
+ - onevm
42
+ - onevnet
42
43
  - onezone
43
- - oneacct
44
44
  extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
- - LICENSE
48
- - NOTICE
49
47
  - bin/oneacct
50
48
  - bin/oneacl
51
49
  - bin/onecluster
@@ -76,6 +74,8 @@ files:
76
74
  - lib/one_helper/onevm_helper.rb
77
75
  - lib/one_helper/onevnet_helper.rb
78
76
  - lib/one_helper/onezone_helper.rb
77
+ - NOTICE
78
+ - LICENSE
79
79
  homepage: http://opennebula.org
80
80
  licenses: []
81
81
  metadata: {}
@@ -85,17 +85,17 @@ require_paths:
85
85
  - lib
86
86
  required_ruby_version: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ">="
88
+ - - '>='
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0'
91
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">"
93
+ - - '>='
94
94
  - !ruby/object:Gem::Version
95
- version: 1.3.1
95
+ version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.2.2
98
+ rubygems_version: 2.0.14
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: OpenNebula Command Line Interface