You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/06/06 11:08:26 UTC
Initial support for ConfServer in RHEV-M
Hi,
this patch will add support for querying ConfServer[1] for an IP address
of RHEV-M instance.
The support for this in ConfServer is not there yet, and for this case
this patch will generate a random IP address when 'CONFIG_SERVER_ADDRESS'
is set and returned value is empty.
-- Michal
[1] https://github.com/clalancette/audrey/tree/config-server
[PATCH core] Add initial support for ConfServer for RHEV-M
Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
.../lib/deltacloud/drivers/rhevm/rhevm_driver.rb | 25 +++++++++++++++++--
1 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
index a0ac64f..b0470ba 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_driver.rb
@@ -200,6 +200,15 @@ class RHEVMDriver < Deltacloud::BaseDriver
end
end
+ def confserver_ip(uuid)
+ client = RestClient::Resource::new(ENV['CONFIG_SERVER_ADDRESS'])
+ begin
+ client["/ip/0.0.1/%s" % uuid].get(:accept => 'text/plain').body.strip
+ rescue
+ nil
+ end
+ end
+
def convert_instance(client, inst)
state = convert_state(inst.status)
storage_size = inst.storage.nil? ? 1 : (inst.storage.to_i/1024/1024/1024)
@@ -209,10 +218,20 @@ class RHEVMDriver < Deltacloud::BaseDriver
:hwp_storage => "#{storage_size}"
)
# Include VNC and SPICE addresses
- if inst.ip
- public_addresses = [ inst.ip ]
+ if env['CONFIG_SERVER_ADDRESS']
+ public_addresses = [ conf_server_ip(inst.id) ].flatten
+ # FIXME: Remove this part once ConfServer will start handling RHEV-M
+ if public_addresses.empty?
+ public_addresses = [
+ "#{rand(254+1}.#{rand(254+1)}.#{rand(254+1)}.#{rand(254+1)}"
+ ]
+ end
else
- public_addresses = [ inst.macs ]
+ if inst.ip
+ public_addresses = [ inst.ip ]
+ else
+ public_addresses = [ inst.macs ]
+ end
end
Instance.new(
:id => inst.id,
--
1.7.4.1