opennebula-cli 4.8.0 → 4.9.80.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/NOTICE +1 -1
- data/bin/oneuser +29 -6
- data/bin/onevcenter +217 -0
- data/bin/onevnet +6 -3
- data/lib/command_parser.rb +12 -0
- data/lib/one_helper/oneacct_helper.rb +0 -1
- data/lib/one_helper/oneuser_helper.rb +70 -5
- data/lib/one_helper/onevm_helper.rb +32 -3
- data/lib/one_helper/onevnet_helper.rb +30 -0
- metadata +20 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 751cd526db8f21c281fd935cef7f1be0b5aec0ce
|
4
|
+
data.tar.gz: ec2aa2b08bb3f73ad0ee15262a4ac3e51d9727d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acb5b7a32bb0a16c1acc42844a4e14c57a54ef518caa0d6d1e25c55cd70dfffa5dd14d8cc0b45aeb685ff85a168527a70bb2cbdc0efe6aee48d19e3183ae4d91
|
7
|
+
data.tar.gz: 0ceb58e0181f649b89f6c858a1da819e214699b94b9cccbc201ee834196525d59409baccb4f612cc9aaf4c7162be31f8901c439ccf8068d3d1fa84bf70c5d861
|
data/NOTICE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
OpenNebula Open Source Project
|
2
2
|
--------------------------------------------------------------------------------
|
3
|
-
Copyright 2002-2014, OpenNebula Project
|
3
|
+
Copyright 2002-2014, OpenNebula Project, OpenNebula Systems (formerly C12G Labs)
|
4
4
|
--------------------------------------------------------------------------------
|
5
5
|
|
6
6
|
You can find more information about the project, release notes and
|
data/bin/oneuser
CHANGED
@@ -121,7 +121,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
121
121
|
:name => "time",
|
122
122
|
:large => "--time x",
|
123
123
|
:format => Integer,
|
124
|
-
:description => "Token duration in seconds, defaults to
|
124
|
+
:description => "Token duration in seconds, defaults to 36000 (10 h). "\
|
125
|
+
"To reset the token set time to 0." \
|
126
|
+
"To generate a non-expiring token use -1"\
|
127
|
+
" (not valid for ssh and x509 tokens). "\
|
125
128
|
}
|
126
129
|
|
127
130
|
DRIVER={
|
@@ -131,8 +134,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
131
134
|
:description => "Driver to autehnticate this user"
|
132
135
|
}
|
133
136
|
|
137
|
+
FORCE = {
|
138
|
+
:name => "force",
|
139
|
+
:large => "--force" ,
|
140
|
+
:description => "Force one_auth file rewrite"
|
141
|
+
}
|
142
|
+
|
134
143
|
create_options = [READ_FILE, SHA1, SSH, X509, KEY, CERT, DRIVER]
|
135
|
-
login_options = [SSH, X509, X509_PROXY, KEY, CERT, PROXY, TIME]
|
144
|
+
login_options = [SSH, X509, X509_PROXY, KEY, CERT, PROXY, TIME, FORCE]
|
136
145
|
|
137
146
|
########################################################################
|
138
147
|
# Formatters for arguments
|
@@ -206,7 +215,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
206
215
|
end
|
207
216
|
|
208
217
|
quota_desc = <<-EOT.unindent
|
209
|
-
Set the quota limits for the user. If a path is not provided the editor
|
218
|
+
Set the quota limits for the user. If a path is not provided the editor
|
210
219
|
will be launched to modify the current quotas.
|
211
220
|
EOT
|
212
221
|
|
@@ -311,17 +320,31 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
311
320
|
end
|
312
321
|
|
313
322
|
login_desc = <<-EOT.unindent
|
314
|
-
Creates the
|
315
|
-
|
323
|
+
Creates the login token for authentication. The token can be used
|
324
|
+
together with any authentication driver. The token will be stored in
|
325
|
+
$HOME/.one/one_auth, and can be used subsequently to authenticate with
|
326
|
+
oned through API, CLI or Sunstone.
|
327
|
+
|
328
|
+
Example, request a valid token for a generic driver (e.g. core auth, LDAP...):
|
329
|
+
oneuser login my_user --time 3600
|
330
|
+
|
331
|
+
Example, generate and set a token for SSH based authentication:
|
316
332
|
oneuser login my_user --ssh --key /tmp/id_rsa --time 72000
|
333
|
+
|
334
|
+
Example, same using X509 certificates:
|
317
335
|
oneuser login my_user --x509 --cert /tmp/my_cert.pem
|
318
336
|
--key /tmp/my_key.pk --time 72000
|
337
|
+
|
338
|
+
Example, now with a X509 proxy certificate
|
319
339
|
oneuser login my_user --x509_proxy --proxy /tmp/my_cert.pem
|
320
340
|
--time 72000
|
321
341
|
EOT
|
322
342
|
|
323
343
|
command :login, login_desc, :username, :options=>login_options do
|
324
|
-
|
344
|
+
|
345
|
+
options[:time] ||= 36000
|
346
|
+
|
347
|
+
helper.login(args[0], options)
|
325
348
|
end
|
326
349
|
|
327
350
|
key_desc = <<-EOT.unindent
|
data/bin/onevcenter
ADDED
@@ -0,0 +1,217 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# -------------------------------------------------------------------------- #
|
4
|
+
# Copyright 2002-2014, OpenNebula Project (OpenNebula.org), C12G Labs #
|
5
|
+
# #
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
7
|
+
# not use this file except in compliance with the License. You may obtain #
|
8
|
+
# a copy of the License at #
|
9
|
+
# #
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
|
+
# #
|
12
|
+
# Unless required by applicable law or agreed to in writing, software #
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS, #
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
15
|
+
# See the License for the specific language governing permissions and #
|
16
|
+
# limitations under the License. #
|
17
|
+
#--------------------------------------------------------------------------- #
|
18
|
+
|
19
|
+
ONE_LOCATION=ENV["ONE_LOCATION"]
|
20
|
+
|
21
|
+
if !ONE_LOCATION
|
22
|
+
RUBY_LIB_LOCATION="/usr/lib/one/ruby"
|
23
|
+
REMOTES_LOCATION="/var/lib/one/remotes/"
|
24
|
+
else
|
25
|
+
RUBY_LIB_LOCATION=ONE_LOCATION+"/lib/ruby"
|
26
|
+
REMOTES_LOCATION=ONE_LOCATION+"/var/remotes/"
|
27
|
+
end
|
28
|
+
|
29
|
+
$: << RUBY_LIB_LOCATION
|
30
|
+
$: << RUBY_LIB_LOCATION+"/cli"
|
31
|
+
$: << REMOTES_LOCATION+"vmm/vcenter/"
|
32
|
+
|
33
|
+
require 'command_parser'
|
34
|
+
require 'one_helper/onehost_helper'
|
35
|
+
require 'one_helper/onecluster_helper'
|
36
|
+
require 'vcenter_driver'
|
37
|
+
|
38
|
+
cmd=CommandParser::CmdParser.new(ARGV) do
|
39
|
+
|
40
|
+
usage "`onevcenter` <command> [<args>] [<options>]"
|
41
|
+
version OpenNebulaHelper::ONE_VERSION
|
42
|
+
|
43
|
+
helper = OneHostHelper.new
|
44
|
+
|
45
|
+
before_proc do
|
46
|
+
helper.set_client(options)
|
47
|
+
end
|
48
|
+
|
49
|
+
########################################################################
|
50
|
+
# Global Options
|
51
|
+
########################################################################
|
52
|
+
cmd_options=CommandParser::OPTIONS-[CommandParser::VERBOSE]
|
53
|
+
set :option, cmd_options+OpenNebulaHelper::CLIENT_OPTIONS
|
54
|
+
|
55
|
+
|
56
|
+
VCENTER = {
|
57
|
+
:name => "vcenter",
|
58
|
+
:large => "--vcenter vCenter" ,
|
59
|
+
:description => "The vCenter hostname",
|
60
|
+
:format => String
|
61
|
+
}
|
62
|
+
|
63
|
+
USER = {
|
64
|
+
:name => "vuser",
|
65
|
+
:large => "--vuser username" ,
|
66
|
+
:description => "The username to interact with vCenter",
|
67
|
+
:format => String
|
68
|
+
}
|
69
|
+
|
70
|
+
PASS = {
|
71
|
+
:name => "vpass",
|
72
|
+
:large => "--vpass password",
|
73
|
+
:description => "The password for the user",
|
74
|
+
:format => String
|
75
|
+
}
|
76
|
+
|
77
|
+
############################################################################
|
78
|
+
# Import clusters
|
79
|
+
############################################################################
|
80
|
+
hosts_desc = <<-EOT.unindent
|
81
|
+
Import vCenter clusters as OpenNebula hosts
|
82
|
+
EOT
|
83
|
+
|
84
|
+
command :hosts, hosts_desc, :options=>[ VCENTER, USER, PASS ] do
|
85
|
+
if options[:vuser].nil? ||
|
86
|
+
options[:vpass].nil? ||
|
87
|
+
options[:vcenter].nil?
|
88
|
+
STDERR.puts "vCenter connection parameters are mandatory to import"\
|
89
|
+
" host:\n"\
|
90
|
+
"\t --vcenter vCenter hostname\n"\
|
91
|
+
"\t --vuser username to login in vcenter\n"\
|
92
|
+
"\t --vpass password for the user"
|
93
|
+
exit -1
|
94
|
+
end
|
95
|
+
|
96
|
+
begin
|
97
|
+
STDOUT.print "\nConnecting to vCenter: #{options[:vcenter]}..."
|
98
|
+
|
99
|
+
vc = VCenterDriver::VIClient.new_connection(
|
100
|
+
:user => options[:vuser],
|
101
|
+
:password => options[:vpass],
|
102
|
+
:host => options[:vcenter])
|
103
|
+
|
104
|
+
STDOUT.print "done!\n\n"
|
105
|
+
|
106
|
+
STDOUT.print "Exploring vCenter resources..."
|
107
|
+
|
108
|
+
rs = vc.hierarchy
|
109
|
+
|
110
|
+
STDOUT.print "done!\n\n"
|
111
|
+
|
112
|
+
rs.each {|dc, cluster|
|
113
|
+
STDOUT.print "Do you want to process datacenter #{dc} [y/n]? "
|
114
|
+
|
115
|
+
next if STDIN.gets.strip.downcase != 'y'
|
116
|
+
|
117
|
+
if cluster.empty?
|
118
|
+
STDOUT.puts " No clusters found in #{dc}..."
|
119
|
+
next
|
120
|
+
end
|
121
|
+
|
122
|
+
cluster.each{ |c|
|
123
|
+
STDOUT.print " * Import cluster #{c} [y/n]? "
|
124
|
+
|
125
|
+
next if STDIN.gets.strip.downcase != 'y'
|
126
|
+
|
127
|
+
r, m = VCenterDriver::VCenterHost.to_one(c, vc)
|
128
|
+
|
129
|
+
if r == 0
|
130
|
+
STDOUT.puts " OpenNebula host #{c} with id #{m}"\
|
131
|
+
" successfully created."
|
132
|
+
else
|
133
|
+
STDOUT.puts " Error: #{m}"
|
134
|
+
end
|
135
|
+
|
136
|
+
STDOUT.puts
|
137
|
+
}
|
138
|
+
}
|
139
|
+
rescue Exception => e
|
140
|
+
STDOUT.puts "error: #{e.message}"
|
141
|
+
exit -1
|
142
|
+
end
|
143
|
+
|
144
|
+
exit 0
|
145
|
+
end
|
146
|
+
|
147
|
+
templates_desc = <<-EOT.unindent
|
148
|
+
Import vCenter VM Templates into OpenNebula
|
149
|
+
EOT
|
150
|
+
|
151
|
+
command :templates, templates_desc, :options=>[ VCENTER, USER, PASS ] do
|
152
|
+
if options[:vuser].nil? ||
|
153
|
+
options[:vpass].nil? ||
|
154
|
+
options[:vcenter].nil?
|
155
|
+
STDERR.puts "vCenter connection parameters are mandatory to import"\
|
156
|
+
" VM templates:\n"\
|
157
|
+
"\t --vcenter vCenter hostname\n"\
|
158
|
+
"\t --vuser username to login in vcenter\n"\
|
159
|
+
"\t --vpass password for the user"
|
160
|
+
exit -1
|
161
|
+
end
|
162
|
+
|
163
|
+
begin
|
164
|
+
STDOUT.print "\nConnecting to vCenter: #{options[:vcenter]}..."
|
165
|
+
|
166
|
+
vc = VCenterDriver::VIClient.new_connection(
|
167
|
+
:user => options[:vuser],
|
168
|
+
:password => options[:vpass],
|
169
|
+
:host => options[:vcenter])
|
170
|
+
|
171
|
+
STDOUT.print "done!\n\n"
|
172
|
+
|
173
|
+
STDOUT.print "Looking for VM Templates..."
|
174
|
+
|
175
|
+
rs = vc.vm_templates
|
176
|
+
|
177
|
+
STDOUT.print "done!\n"
|
178
|
+
|
179
|
+
rs.each {|dc, tmps|
|
180
|
+
STDOUT.print "\nDo you want to process datacenter #{dc} [y/n]? "
|
181
|
+
|
182
|
+
next if STDIN.gets.strip.downcase != 'y'
|
183
|
+
|
184
|
+
if tmps.empty?
|
185
|
+
STDOUT.print " No VM Templates found in #{dc}...\n\n"
|
186
|
+
next
|
187
|
+
end
|
188
|
+
|
189
|
+
tmps.each{ |t|
|
190
|
+
STDOUT.print "\n * VM Template found:\n"\
|
191
|
+
" - Name : #{t[:name]}\n"\
|
192
|
+
" - UUID : #{t[:uuid]}\n"\
|
193
|
+
" - Cluster: #{t[:host]}\n"\
|
194
|
+
" Import this VM template [y/n]? "
|
195
|
+
|
196
|
+
next if STDIN.gets.strip.downcase != 'y'
|
197
|
+
|
198
|
+
one_t = ::OpenNebula::Template.new(
|
199
|
+
::OpenNebula::Template.build_xml, vc.one)
|
200
|
+
|
201
|
+
rc = one_t.allocate(t[:one])
|
202
|
+
|
203
|
+
if ::OpenNebula.is_error?(rc)
|
204
|
+
STDOUT.puts " Error creating template: #{rc.message}\n"
|
205
|
+
else
|
206
|
+
STDOUT.puts " OpenNebula template #{one_t.id} created!\n"
|
207
|
+
end
|
208
|
+
}
|
209
|
+
}
|
210
|
+
rescue Exception => e
|
211
|
+
STDOUT.puts "error: #{e.message}"
|
212
|
+
exit -1
|
213
|
+
end
|
214
|
+
|
215
|
+
exit 0
|
216
|
+
end
|
217
|
+
end
|
data/bin/onevnet
CHANGED
@@ -112,9 +112,8 @@ 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,
|
116
|
-
|
117
|
-
OneVNetHelper::IP6_ULA ] do
|
115
|
+
command :addar, addar_desc, :vnetid,
|
116
|
+
:options => STD_OPTIONS + OneVNetHelper::ADDAR_OPTIONS do
|
118
117
|
helper.perform_action(args[0],options,"lease added") do |vn|
|
119
118
|
ar = "AR = [ "
|
120
119
|
|
@@ -143,6 +142,10 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
|
143
142
|
ar << ", MAC = " << options[:mac] if options[:mac]
|
144
143
|
ar << ", GLOBAL_PREFIX = " << options[:ip6_global] if options[:ip6_global]
|
145
144
|
ar << ", ULA_PREFIX = " << options[:ip6_ula] if options[:ip6_ula]
|
145
|
+
ar << ", GATEWAY = " << options[:gateway] if options[:gateway]
|
146
|
+
ar << ", MASK = " << options[:netmask] if options[:netmask]
|
147
|
+
ar << ", VLAN = YES" if options[:vlan]
|
148
|
+
ar << ", VLAN_ID = " << options[:vlanid] if options[:vlanid]
|
146
149
|
|
147
150
|
ar << "]"
|
148
151
|
|
data/lib/command_parser.rb
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
#--------------------------------------------------------------------------- #
|
16
16
|
|
17
17
|
require 'optparse'
|
18
|
+
require 'optparse/time'
|
18
19
|
require 'pp'
|
19
20
|
|
20
21
|
class String
|
@@ -28,6 +29,17 @@ class String
|
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
32
|
+
if RUBY_VERSION > '1.8.7'
|
33
|
+
OptionParser.accept(Time) do |s,|
|
34
|
+
begin
|
35
|
+
(Time.strptime(s, "%m/%d/%Y %H:%M:%S")) if s
|
36
|
+
rescue
|
37
|
+
raise OptionParser::InvalidArgument, s
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
|
31
43
|
module CommandParser
|
32
44
|
OPTIONS = [
|
33
45
|
VERBOSE={
|
@@ -17,7 +17,17 @@
|
|
17
17
|
require 'one_helper'
|
18
18
|
require 'one_helper/onequota_helper'
|
19
19
|
|
20
|
+
# Interface for OpenNebula generated tokens.
|
21
|
+
class TokenAuth
|
22
|
+
def login_token(username, expire)
|
23
|
+
return OpenNebulaHelper::OneHelper.get_password
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
20
27
|
class OneUserHelper < OpenNebulaHelper::OneHelper
|
28
|
+
|
29
|
+
ONE_AUTH = ENV['HOME']+'/.one/one_auth'
|
30
|
+
|
21
31
|
def self.rname
|
22
32
|
"USER"
|
23
33
|
end
|
@@ -90,7 +100,14 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
|
|
90
100
|
return 0, auth.password
|
91
101
|
end
|
92
102
|
|
93
|
-
|
103
|
+
############################################################################
|
104
|
+
# Generates a token and stores it in ONE_AUTH path as defined in this class
|
105
|
+
############################################################################
|
106
|
+
def login(username, options)
|
107
|
+
|
108
|
+
#-----------------------------------------------------------------------
|
109
|
+
# Init the associated Authentication class to generate the token.
|
110
|
+
#-----------------------------------------------------------------------
|
94
111
|
case options[:driver]
|
95
112
|
when OpenNebula::User::SSH_AUTH
|
96
113
|
require 'opennebula/ssh_auth'
|
@@ -102,6 +119,7 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
|
|
102
119
|
rescue Exception => e
|
103
120
|
return -1, e.message
|
104
121
|
end
|
122
|
+
|
105
123
|
when OpenNebula::User::X509_AUTH
|
106
124
|
require 'opennebula/x509_auth'
|
107
125
|
|
@@ -116,6 +134,7 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
|
|
116
134
|
rescue Exception => e
|
117
135
|
return -1, e.message
|
118
136
|
end
|
137
|
+
|
119
138
|
when OpenNebula::User::X509_PROXY_AUTH
|
120
139
|
require 'opennebula/x509_auth'
|
121
140
|
|
@@ -134,15 +153,47 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
|
|
134
153
|
rescue => e
|
135
154
|
return -1, e.message
|
136
155
|
end
|
156
|
+
|
137
157
|
else
|
138
|
-
|
158
|
+
auth = TokenAuth.new() #oned generated token
|
139
159
|
end
|
140
160
|
|
141
|
-
|
161
|
+
#-----------------------------------------------------------------------
|
162
|
+
# Authenticate with oned using the token/passwd and set/generate the
|
163
|
+
# authentication token for the user
|
164
|
+
#-----------------------------------------------------------------------
|
165
|
+
token = auth.login_token(username, options[:time])
|
166
|
+
login_client = OpenNebula::Client.new("#{username}:#{token}")
|
142
167
|
|
143
|
-
|
168
|
+
user = OpenNebula::User.new(User.build_xml, login_client)
|
144
169
|
|
145
|
-
|
170
|
+
token_oned = user.login(username, token, options[:time])
|
171
|
+
|
172
|
+
return -1, token_oned.message if OpenNebula.is_error?(token_oned)
|
173
|
+
|
174
|
+
#-----------------------------------------------------------------------
|
175
|
+
# Check that ONE_AUTH target can be written
|
176
|
+
#-----------------------------------------------------------------------
|
177
|
+
if File.file?(ONE_AUTH) && !options[:force]
|
178
|
+
return 0, "File #{ONE_AUTH} exists, use --force to overwrite."\
|
179
|
+
"\nAuthentication Token is:\n#{username}:#{token_oned}"
|
180
|
+
end
|
181
|
+
|
182
|
+
#-----------------------------------------------------------------------
|
183
|
+
# Store the token in ONE_AUTH.
|
184
|
+
#-----------------------------------------------------------------------
|
185
|
+
begin
|
186
|
+
FileUtils.mkdir_p(File.dirname(ONE_AUTH))
|
187
|
+
rescue Errno::EEXIST
|
188
|
+
end
|
189
|
+
|
190
|
+
file = File.open(ONE_AUTH, "w")
|
191
|
+
file.write("#{username}:#{token_oned}")
|
192
|
+
file.close
|
193
|
+
|
194
|
+
File.chmod(0600, ONE_AUTH)
|
195
|
+
|
196
|
+
return 0, ''
|
146
197
|
end
|
147
198
|
|
148
199
|
def format_pool(options)
|
@@ -299,6 +350,20 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
|
|
299
350
|
puts str % ["PASSWORD", user['PASSWORD']]
|
300
351
|
puts str % ["AUTH_DRIVER", user['AUTH_DRIVER']]
|
301
352
|
|
353
|
+
if !user['LOGIN_TOKEN/TOKEN'].nil?
|
354
|
+
puts str % ["LOGIN_TOKEN", user['LOGIN_TOKEN/TOKEN']]
|
355
|
+
|
356
|
+
etime = user['LOGIN_TOKEN/EXPIRATION_TIME']
|
357
|
+
|
358
|
+
validity_str = case etime
|
359
|
+
when nil then ""
|
360
|
+
when "-1" then "forever"
|
361
|
+
else "not after #{Time.at(etime.to_i)}"
|
362
|
+
end
|
363
|
+
|
364
|
+
puts str % ["TOKEN VALIDITY", validity_str ]
|
365
|
+
end
|
366
|
+
|
302
367
|
puts str % ["ENABLED",
|
303
368
|
OpenNebulaHelper.boolean_to_str(user['ENABLED'])]
|
304
369
|
|
@@ -15,7 +15,6 @@
|
|
15
15
|
#--------------------------------------------------------------------------- #
|
16
16
|
|
17
17
|
require 'one_helper'
|
18
|
-
require 'optparse/time'
|
19
18
|
|
20
19
|
class OneVMHelper < OpenNebulaHelper::OneHelper
|
21
20
|
MULTIPLE={
|
@@ -404,11 +403,41 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
|
|
404
403
|
end if !options[:all]
|
405
404
|
end
|
406
405
|
|
407
|
-
if vm.has_elements?("/VM/
|
406
|
+
if vm.has_elements?("/VM/USER_TEMPLATE/HYPERVISOR")
|
407
|
+
vm_information = vm.to_hash['VM']
|
408
|
+
hybridvisor = vm_information['USER_TEMPLATE']['HYPERVISOR'].to_s
|
409
|
+
isHybrid = %w{vcenter ec2 azure softlayer}.include? hybridvisor
|
410
|
+
|
411
|
+
if isHybrid
|
412
|
+
vm_tmplt = vm_information['TEMPLATE']
|
413
|
+
nic = {"NETWORK" => "-",
|
414
|
+
"IP" => "-",
|
415
|
+
"MAC"=> "-",
|
416
|
+
"VLAN"=>"no",
|
417
|
+
"BRIDGE"=>"-"}
|
418
|
+
|
419
|
+
case hybridvisor
|
420
|
+
when "vcenter"
|
421
|
+
nic.IP = vm_tmplt['GUEST_IP'] if vm_tmplt['GUEST_IP']
|
422
|
+
when "ec2"
|
423
|
+
nic.IP = vm_tmplt['IP_ADDRESS'] if vm_tmplt['IP_ADDRESS']
|
424
|
+
when "azure"
|
425
|
+
nic.IP = vm_tmplt['IPADDRESS'] if vm_tmplt['IPADDRESS']
|
426
|
+
when "softlayer"
|
427
|
+
nic.IP = vm_tmplt['PRIMARYIPADDRESS'] if vm_tmplt['PRIMARYIPADDRESS']
|
428
|
+
else
|
429
|
+
isHybrid = false
|
430
|
+
end
|
431
|
+
|
432
|
+
vm_nics = [nic]
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
if vm.has_elements?("/VM/TEMPLATE/NIC") || vm_nics
|
408
437
|
puts
|
409
438
|
CLIHelper.print_header(str_h1 % "VM NICS",false)
|
410
439
|
|
411
|
-
vm_nics = [vm.to_hash['VM']['TEMPLATE']['NIC']].flatten
|
440
|
+
vm_nics = [vm.to_hash['VM']['TEMPLATE']['NIC']].flatten if !vm_nics
|
412
441
|
|
413
442
|
nic_default = {"NETWORK" => "-",
|
414
443
|
"IP" => "-",
|
@@ -82,6 +82,36 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
|
82
82
|
# :description => "Number of addresses to reserve"
|
83
83
|
# }
|
84
84
|
|
85
|
+
GATEWAY = [
|
86
|
+
:name => "gateway",
|
87
|
+
:large => "--gateway ip",
|
88
|
+
:format => String,
|
89
|
+
:description=> "IP of the gateway"
|
90
|
+
]
|
91
|
+
|
92
|
+
NETMASK = [
|
93
|
+
:name => "netmask",
|
94
|
+
:large => "--netmask mask",
|
95
|
+
:format => String,
|
96
|
+
:description=> "Netmask in dot notation"
|
97
|
+
]
|
98
|
+
|
99
|
+
VLAN = [
|
100
|
+
:name => "vlan",
|
101
|
+
:large => "--vlan",
|
102
|
+
:description=> "Use network isolation"
|
103
|
+
]
|
104
|
+
|
105
|
+
VLAN_ID = [
|
106
|
+
:name => "vlanid",
|
107
|
+
:large => "--vlanid id",
|
108
|
+
:format => String,
|
109
|
+
:description=> "VLAN ID assigned"
|
110
|
+
]
|
111
|
+
|
112
|
+
ADDAR_OPTIONS = [
|
113
|
+
SIZE, MAC, IP, IP6_GLOBAL, IP6_ULA, GATEWAY, NETMASK, VLAN, VLAN_ID ]
|
114
|
+
|
85
115
|
def self.rname
|
86
116
|
"VNET"
|
87
117
|
end
|
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.
|
4
|
+
version: 4.9.80.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenNebula
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opennebula
|
@@ -16,34 +16,37 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: 4.9.80.beta
|
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.
|
26
|
+
version: 4.9.80.beta
|
27
27
|
description: Commands used to talk to OpenNebula
|
28
28
|
email: contact@opennebula.org
|
29
29
|
executables:
|
30
|
-
- oneacct
|
31
30
|
- oneacl
|
32
|
-
- onecluster
|
33
|
-
- onedatastore
|
34
|
-
- oneflow
|
35
|
-
- oneflow-template
|
36
|
-
- onegroup
|
37
31
|
- onehost
|
32
|
+
- oneflow-template
|
33
|
+
- onevnet
|
38
34
|
- oneimage
|
35
|
+
- onevcenter
|
36
|
+
- onedatastore
|
37
|
+
- onevm
|
38
|
+
- onegroup
|
39
|
+
- onecluster
|
39
40
|
- onetemplate
|
41
|
+
- oneflow
|
40
42
|
- oneuser
|
41
|
-
- onevm
|
42
|
-
- onevnet
|
43
43
|
- onezone
|
44
|
+
- oneacct
|
44
45
|
extensions: []
|
45
46
|
extra_rdoc_files: []
|
46
47
|
files:
|
48
|
+
- LICENSE
|
49
|
+
- NOTICE
|
47
50
|
- bin/oneacct
|
48
51
|
- bin/oneacl
|
49
52
|
- bin/onecluster
|
@@ -55,6 +58,7 @@ files:
|
|
55
58
|
- bin/oneimage
|
56
59
|
- bin/onetemplate
|
57
60
|
- bin/oneuser
|
61
|
+
- bin/onevcenter
|
58
62
|
- bin/onevm
|
59
63
|
- bin/onevnet
|
60
64
|
- bin/onezone
|
@@ -74,8 +78,6 @@ files:
|
|
74
78
|
- lib/one_helper/onevm_helper.rb
|
75
79
|
- lib/one_helper/onevnet_helper.rb
|
76
80
|
- lib/one_helper/onezone_helper.rb
|
77
|
-
- NOTICE
|
78
|
-
- LICENSE
|
79
81
|
homepage: http://opennebula.org
|
80
82
|
licenses: []
|
81
83
|
metadata: {}
|
@@ -85,17 +87,17 @@ require_paths:
|
|
85
87
|
- lib
|
86
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
87
89
|
requirements:
|
88
|
-
- -
|
90
|
+
- - ">="
|
89
91
|
- !ruby/object:Gem::Version
|
90
92
|
version: '0'
|
91
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
94
|
requirements:
|
93
|
-
- -
|
95
|
+
- - ">"
|
94
96
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
97
|
+
version: 1.3.1
|
96
98
|
requirements: []
|
97
99
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.
|
100
|
+
rubygems_version: 2.2.2
|
99
101
|
signing_key:
|
100
102
|
specification_version: 4
|
101
103
|
summary: OpenNebula Command Line Interface
|