After permanently changing jails hostname, the PBI control server does not get started anymore.
Hi, i was playing around with the hostnames of the PBI-jails by adding "hostname=...." to the jails /etc/rc.conf. Soon after i found that all the jails i touched were not controllable via the web-interface anymore. I got the famous "HTTP Error 502: Bad Gateway" log message.
After some digging around i realized that the PBI-control-server just was not running for these jails.
This is confirmed by executing "service ix-plugins forcerestart". No instance gets started for all jails with a custom hostname.
I was looking into this and found the obvious problem.
The "ix-plugins" service tries to lookup the jid of the plugin-jail via its jail-name - which fails. "jail_get_jid()" in /etc/rc.freenas is looking at the output of "jls", which prints the hostname instead of the jail-name.
After fixing this, all PBI-control-server got started successfully
I attached the patch below.