mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-19 11:22:55 +09:00
Merge branch 'master' into feature-3782
This commit is contained in:
commit
bdb1e591da
46 files changed
+921
-182
No files matched your search
@@ -167,6 +167,11 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
|
||||
NUM_THREADS = 15
|
||||
def sync(host_ids, options)
|
||||
if `id -u`.to_i == 0 || `id -G`.split.collect{|e| e.to_i}.include?(0)
|
||||
STDERR.puts("Cannot run 'onehost sync' as root")
|
||||
exit -1
|
||||
end
|
||||
|
||||
begin
|
||||
current_version = File.read(REMOTES_LOCATION+'/VERSION').strip
|
||||
rescue
|
||||
|
||||
@@ -303,11 +303,11 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
d['AR_ID']
|
||||
end
|
||||
|
||||
column :OWNER, "", :left, :size=>10 do |d|
|
||||
column :OWNER, "", :left, :size=>15 do |d|
|
||||
if d['VM']
|
||||
"VM : #{d['VM']}"
|
||||
"V:#{d['VM']}"
|
||||
elsif d['VNET']
|
||||
"NET: #{d['VNET']}"
|
||||
"N:#{d['VNET']}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -319,7 +319,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
d["IP"]||"-"
|
||||
end
|
||||
|
||||
column :IP6_GLOBAL, "", :donottruncate, :size=>31 do |d|
|
||||
column :IP6_GLOBAL, "", :donottruncate, :size=>26 do |d|
|
||||
d["IP6_GLOBAL"]||"-"
|
||||
end
|
||||
end.show(leases, {})
|
||||
|
||||
+4
-74
@@ -216,84 +216,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
end
|
||||
|
||||
vms_desc = <<-EOT.unindent
|
||||
Import vCenter running Virtual Machines into OpenNebula
|
||||
Deprecated action in onevcenter, please use onehost importvm instead
|
||||
EOT
|
||||
|
||||
command :vms, vms_desc, :options=>[ VCENTER, USER, PASS ] do
|
||||
if options[:vuser].nil? ||
|
||||
options[:vpass].nil? ||
|
||||
options[:vcenter].nil?
|
||||
STDERR.puts "vCenter connection parameters are mandatory to import"\
|
||||
" VM templates:\n"\
|
||||
"\t --vcenter vCenter hostname\n"\
|
||||
"\t --vuser username to login in vcenter\n"\
|
||||
"\t --vpass password for the user"
|
||||
exit -1
|
||||
end
|
||||
STDERR.puts "Deprecated action in onevcenter, please use onehost "\
|
||||
"importvm instead"
|
||||
|
||||
begin
|
||||
STDOUT.print "\nConnecting to vCenter: #{options[:vcenter]}..."
|
||||
|
||||
vc = VCenterDriver::VIClient.new_connection(
|
||||
:user => options[:vuser],
|
||||
:password => options[:vpass],
|
||||
:host => options[:vcenter])
|
||||
|
||||
STDOUT.print "done!\n\n"
|
||||
|
||||
STDOUT.print "Looking for running Virtual Machines..."
|
||||
|
||||
rs = vc.running_vms
|
||||
|
||||
STDOUT.print "done!\n"
|
||||
|
||||
rs.each {|dc, tmps|
|
||||
STDOUT.print "\nDo you want to process datacenter #{dc} [y/n]? "
|
||||
|
||||
next if STDIN.gets.strip.downcase != 'y'
|
||||
|
||||
if tmps.empty?
|
||||
STDOUT.print " No new running Virtual Machines found in"\
|
||||
" #{dc}...\n\n"
|
||||
next
|
||||
end
|
||||
|
||||
tmps.each{ |v|
|
||||
STDOUT.print "\n * Running Virtual Machine found:\n"\
|
||||
" - Name : #{v[:name]}\n"\
|
||||
" - UUID : #{v[:uuid]}\n"\
|
||||
" - Cluster: #{v[:host]}\n"\
|
||||
" Import this Virtual Machine [y/n]? "
|
||||
|
||||
next if STDIN.gets.strip.downcase != 'y'
|
||||
|
||||
one_v = ::OpenNebula::VirtualMachine.new(
|
||||
::OpenNebula::VirtualMachine.build_xml, vc.one)
|
||||
|
||||
rc = one_v.allocate(v[:one])
|
||||
|
||||
if ::OpenNebula.is_error?(rc)
|
||||
STDOUT.puts " Error creating Virtual Machine: "\
|
||||
"#{rc.message}\n"
|
||||
end
|
||||
|
||||
rc = one_v.deploy v[:host_id]
|
||||
|
||||
if ::OpenNebula.is_error?(rc)
|
||||
STDOUT.puts " Error creating Virtual Machine: "\
|
||||
"#{rc.message}\n"
|
||||
else
|
||||
STDOUT.puts " OpenNebula VM #{one_v.id} "\
|
||||
"created!\n"
|
||||
end
|
||||
}
|
||||
}
|
||||
rescue Exception => e
|
||||
STDOUT.puts "error: #{e.message}"
|
||||
exit -1
|
||||
end
|
||||
|
||||
exit 0
|
||||
exit -1
|
||||
end
|
||||
|
||||
network_desc = <<-EOT.unindent
|
||||
|
||||
Reference in new issue
Block a user