Bug #35035
closedVM creation is broken with libvirt >= 8.0.0 due to VNC password length
Description
since libvirt >= 8.0.0 [1] (RHEL 8.6, RHEL9, and probably others), the VNC password must be limited to 8 chars.
Foreman uses 16 a char password and VM creation breaks:
"Failed to create a compute xxxx (Libvirt) instance xxxx: Error saving the server: Call to virDomainDefineXML failed: unsupported configuration: VNC password is 16 characters long, only 8 permitted"
The solution, for now, was to reduce SecureRandom.hex(8) to SecureRandom.hex(4) in random_password() [2], which is called by the libvirt model [3]. But that's probably not the best way :)
[1] https://github.com/libvirt/libvirt/commit/27c1d06b5bd68bdce55efff0a50a15a30cb2a96b
[2] https://github.com/theforeman/foreman/blob/develop/app/models/compute_resource.rb#L429
[3] https://github.com/theforeman/foreman/blob/develop/app/models/compute_resources/foreman/model/libvirt.rb#L176