fog / fog-vsphere

Fog for vSphere
MIT License
36 stars 63 forks source link

Please allow run-time configuration of :vsphere_debug #124

Open Zugschlus opened 6 years ago

Zugschlus commented 6 years ago

Hi,

recently, the result of a "create VM" operation in The Foreman has changed, which has resulted in a The Foreman forum entry.

Finding out whether it was foreman changing things or the Vsphere world has suddenly changed its behavior would be tremendously easier if there were a possbility to intercept the API request that gets sent to Vsphere, to find whether Foreman via fog via fog-vsphere actually requests a Paravirtual or an LSILogic SCSI controller or issues an invalid requests which might cause Vsphere to fall back to a default which might happen to be LSILogic.

Obtaining those logs from inside Vsphere seems to be next to impossible. I had the VMware experts at a customer site showing me a support rejection from VMware support since The Foreman is not a VMware certified application allowed to access the Vsphere API and VMware only supports certified applications talking to their sacred API.

So it would be really good to have a possibility to beef up fog-vsphere's logging to see what actually gets sent to Vsphere. Thanks for considering this.

Greetings Marc

timogoebel commented 6 years ago

@Zugschlus: Sorry for the long turnaround here. It's possible to activate a debug mode in rbvmomi (the library used for connections with vsphere) through fog-vsphere:

client = ::Fog::Compute.new(
  :provider                     => 'vsphere',
  :vsphere_username             => '',
  :vsphere_password             => '',
  :vsphere_server               => '',
  :vsphere_expected_pubkey_hash => '',
  :vsphere_debug => true
)

This prints debug info to STDERR. In Foreman's case you should see the logs in the apache error log I think. You can add that line in Foreman's codebase here.

I hope, this helps.

Zugschlus commented 6 years ago

Hi Timo, thanks for the hint. It was a bit too late though, I used a socat - tcpdump - socat chain to snoop on foreman talking to the vCenter and was actually able to identify the issue with the obtained data. Next time, I'm going to try this approach. The current issue now mutates into the request for a possibility to set :vsphere_debug in some run-time configuration file so that it is not necessary to peddle around in Foreman's code.