mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-23 13:15:14 +09:00
F #4913: VIClient new_from_hostname no longer needed
This commit is contained in:
1 parent
fa515050a3
commit
2d2dbf3204
7 files changed
+24
-27
No files matched your search
@@ -69,27 +69,6 @@ class VIClient
|
||||
self.new(connection)
|
||||
end
|
||||
|
||||
def self.new_from_hostname(hostname)
|
||||
client = OpenNebula::Client.new
|
||||
host_pool = OpenNebula::HostPool.new(client)
|
||||
rc = host_pool.info
|
||||
if OpenNebula.is_error?(rc)
|
||||
puts "Error getting oned configuration : #{rc.message}"
|
||||
exit -1
|
||||
end
|
||||
|
||||
host_id = host_pool.select do |host_element|
|
||||
host_element.name == hostname
|
||||
end.first.id rescue nil
|
||||
|
||||
if host_id
|
||||
new_from_host(host_id)
|
||||
else
|
||||
puts "Could not find host_id for host: #{hostname}"
|
||||
exit -1
|
||||
end
|
||||
end
|
||||
|
||||
def self.decrypt(msg, token)
|
||||
begin
|
||||
cipher = OpenSSL::Cipher.new("aes-256-cbc")
|
||||
|
||||
@@ -37,7 +37,10 @@ vc_cluster_name = ARGV[-1]
|
||||
|
||||
begin
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_hostname(vc_cluster_name)
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
||||
vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client)
|
||||
|
||||
|
||||
@@ -35,7 +35,10 @@ vc_cluster_name = ARGV[3]
|
||||
|
||||
begin
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_hostname(vc_cluster_name)
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
||||
vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client)
|
||||
|
||||
|
||||
@@ -35,7 +35,10 @@ vc_cluster_name = ARGV[1]
|
||||
|
||||
begin
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_hostname(vc_cluster_name)
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
||||
vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client)
|
||||
|
||||
|
||||
@@ -35,7 +35,10 @@ vc_cluster_name = ARGV[3]
|
||||
|
||||
begin
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_hostname(vc_cluster_name)
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
||||
vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client)
|
||||
|
||||
|
||||
@@ -35,7 +35,10 @@ vc_cluster_name = ARGV[3]
|
||||
|
||||
begin
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_hostname(vc_cluster_name)
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
||||
vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client)
|
||||
|
||||
|
||||
@@ -35,7 +35,10 @@ vc_cluster_name = ARGV[3]
|
||||
|
||||
begin
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_hostname(vc_cluster_name)
|
||||
host = VCenterDriver::VIHelper.find_by_name(OpenNebula::HostPool, vc_cluster_name)
|
||||
host_id = host['ID']
|
||||
|
||||
vi_client = VCenterDriver::VIClient.new_from_host(host_id)
|
||||
|
||||
vm = VCenterDriver::VirtualMachine.new_from_ref(vm_ref, vi_client)
|
||||
|
||||
|
||||
Reference in new issue
Block a user