Bug #33270
closedlibvirt VMs showing "unknown power state" and no Console access
Description
After upgrading from Foreman 2.3 to 2.4.1, all VMs managed by libvirt are showing "unknown power state". The button for Console access has also gone missing.
Foreman log indicates an issue with an undefined method:
Backtrace for 'undefined method `allocation' for nil:NilClass' error (ActionView::Template::Error): undefined method `allocation' for nil:NilClass
4ccdca18 | /usr/share/foreman/app/views/compute_resources_vms/show/_libvirt.html.erb:46:in `block in app_views_compute_resources_vms_show_libvirt_html_erb___1095817749888559541_69835413092660'
Also if I select a VM by going to Compute Resources and selecting the VM after selecting its host, I am greeted with the message:
Oops, we're sorry but something went wrong undefined method `allocation' for nil:NilClass
I attach the foreman-rake errors:fetch_log for that here.
Files
Updated by Lukas Zapletal almost 3 years ago
- Category set to Compute resources - libvirt
- Triaged changed from No to Yes
Looks like a regression on fog-libvirt between 0.7 and 0.8 or newer:
I have a suspicion on https://github.com/fog/fog-libvirt/pull/75
Can you show me the full backtrace? You can reach me as lzap on our IRC.
Updated by Lukas Zapletal almost 3 years ago
I see the attachment now, well it did not help. Not sure what is wrong at the moment.
Updated by Ian Shore almost 3 years ago
- File production.log.txt production.log.txt added
- Category deleted (
Compute resources - libvirt)
I set debug logging on, restarted httpd, then viewed a VM from the Hosts page. I attach the resulting log file, and hope it is of some use.
Updated by Lukas Zapletal almost 3 years ago
Thanks, but the root cause is buried down the stack somewhere in the fog/fog-libvirt library. Libvirt call "volumes" returns list of associated data volumes but it appears to return an array with nil value in it.
Can you tell me how do I reproduce this bug? What's special about these VMs that libvirt fog library returns nil? Can you share libvirt XML of the VM that triggers the error?
Updated by Ian Shore over 2 years ago
- File test1.xml.txt test1.xml.txt added
All the VM hosts display the same "Unknown power state" message. We have 7 VM servers and 25 VMs, built on iSCSi LUNs managed by a NetApp server. I attach the XML dump from the VM mentioned in the previous log file.
Thanks for your help in this.
Updated by Lukas Zapletal over 2 years ago
- Status changed from New to Rejected
I have some bad news for you, for-libvirt only supports file-based storage domain (the default one - directory with files). I am not sure how you created this VM, but this could not be through Foreman/fog library.
I filed a patch into the library to skip volumes which are not file-based to prevent the nil pointer exception, but that's all I can do for you.
Updated by Ian Shore over 2 years ago
Okay, thanks. I'll give it a try tomorrow. Most of the VMs were built before we ever started using Foreman, and we continue to build them the same way, outside of Foreman.