fog / fog-xenserver

Module for the 'fog' gem to support XENSERVER
MIT License
16 stars 22 forks source link

No support for xenserver_redirect_to_master #72

Open zozoh94 opened 6 years ago

zozoh94 commented 6 years ago

Foreman-xen project seems to use the argument xenserver_redirect_to_master with the compute class :

def client
    @client ||= ::Fog::Compute.new(
      :provider                     => 'XenServer',
      :xenserver_url                => url,
      :xenserver_username           => user,
      :xenserver_password           => password,
      :xenserver_redirect_to_master => true
    )
end

but the code of your project seems to not support it. Can you confirm that ? Did you consider to implement it ?

Thank you

plribeiro3000 commented 6 years ago

Yeah, redirect_to_master is not supported.

The supported options are:

      requires :xenserver_username
      requires :xenserver_password
      requires :xenserver_url
      recognizes :xenserver_defaults
      recognizes :xenserver_timeout
      recognizes :xenserver_use_ssl
      recognizes :xenserver_verify_mode
      recognizes :xenserver_port

See them here

Looking back before extraction, it used to have support for it: https://github.com/fog/fog/blob/78e5a649602cfe1e783fe15f679589462c7cb1ab/lib/fog/xenserver/compute.rb#L14

But i could not confirm it was being used at all. It does seem it was a dead option thus it was removed.

Could you confirm if this options is something supported by XenServer or just a force redirect being made by fog?

plribeiro3000 commented 6 years ago

Ok. I've found it: It used to do it here:

          if @redirect_to_master == false
            @connection  = Fog::XenServer::Connection.new(@host, @timeout)
          elsif @redirect_to_master == true
            host_master  = @connection.find_pool_master(@username, @password)
            if host_master && host_master!= @host
              @host = host_master
              @connection  = Fog::XenServer::Connection.new(@host, @timeout)
            end
          end

This was added to fog but never to fog-xenserver. See fog/fog#3356.

Would you be able to open a PR adding it?

plribeiro3000 commented 6 years ago

By the way, i'm kind of glad it never touched fog-xenserver. We can make it better now. If i'm not mistaken, You can connect to a slave node but can't execute any commands so i guess whether we should always connect to the master node instead.

Yeah, the more i think, the more it seems wrong to have a configuration for it. If you connect to a slave node you wont be able to use fog at all so we should always force the connection to master.

WDYT?

zozoh94 commented 6 years ago

Yes, I think too, the redirection should always be enabled to improve the resilience ! I will do a PR...

plribeiro3000 commented 6 years ago

Awesome! Thank you @zozoh94 !