vmware-archive/rbvmomi

Port selection of Virtual VCenter 5.5 and the rbvmomi library not flexible.

rd0-7 opened this issue · 4 comments

rd0-7 commented

This is a major pain in the neck when installing on any server grade machine . Since , port 80, 443 are very popular ports , there is invariably some service running on these .

Hence , the end-users natural inclinations is to choose alternative ports for the Vcenter API end-point .
Once , the installation (Clean Install or Fresh ) finishes the attempts to connect via "rbvmomi" keep failing.
In our particular case, we had a vagrant layer calling this through the ruby . And masking the usual HTTP 404 . Hence , even more painful.

Since , Vcenter 5.X doesn't allow reconfiguring these ports , which was discontinued after 4.x (Whyyyy ?) . And off course , the ports 80 and 443 being hard coded in the rbvmomi code :-
Following code in lib/rbvmomi/vim.rb :-
opts[:ssl] = true unless opts.member? :ssl or opts[:"no-ssl"]
opts[:insecure] ||= false
opts[:port] ||= (opts[:ssl] ? 443 : 80)
opts[:path] ||= '/sdk'

This code suggests , that I can't even pass the ports which I set at VCenter install time on the Client-Side neither I can reconfigure the port on Client side .

Because of this we lost lots of valuable , hours since the automation layer couldn't provision the needed vms.

opts[:port] ||= ...

That actually is a common Ruby pattern that says if opts[:port] is not set, set it to the part after the ||=. If opts[:port] is set, the assignment never happens. You can pass this in as an option when you connect. For example, to connect on port 8443, you would do

opts = { ..., port: 8443 }
conn = RbVmomi::VIM.connect(opts)
rd0-7 commented

Cool that means , the vagrant layer calling this "rbvmomi" should be flexible to reset the ports.

rd0-7 commented

Thanks.

Yeah, I'm guessing you can override it somewhere. If you can't find it, let me know what you are using and I'll see if I can find it for you.