diff --git a/libvirt/tests/src/daemon/conf_file/sysconfig_libvirt_guests/libvirt_guests.py b/libvirt/tests/src/daemon/conf_file/sysconfig_libvirt_guests/libvirt_guests.py index 75092a35eb2..5f7013c8d1b 100644 --- a/libvirt/tests/src/daemon/conf_file/sysconfig_libvirt_guests/libvirt_guests.py +++ b/libvirt/tests/src/daemon/conf_file/sysconfig_libvirt_guests/libvirt_guests.py @@ -39,10 +39,9 @@ def get_log(): :returns: the appended data tailed from /var/log/messages """ - tailed_log_file = os.path.join(data_dir.get_tmp_dir(), 'tail_log') - tailed_messages = aexpect.Tail(command='tail -f /var/log/messages', - output_func=utils_misc.log_line, - output_params=(tailed_log_file)) + tailed_messages = aexpect.Tail(command='tail -f /var/log/messages') + logging.debug("Tail of log messages are logged in %s", + tailed_messages.output_filename) return tailed_messages def chk_on_shutdown(status_error, on_shutdown, parallel_shutdown, output): @@ -265,8 +264,11 @@ def cleanup_nfs_backend_guest(vmxml_backup): config = utils_config.LibvirtGuestsConfig() libvirt_guests_service = service.Factory.create_service("libvirt-guests") - if not libvirt_guests_service.status(): - libvirt_guests_service.start() + if (not libvirt_guests_service.status() + and libvirt_guests_service.start() == 0): + process.run("journalctl -u libvirt-guests", ignore_status=True) + test.error("libvirt-guests service failed to start. Please check logs") + vms = [main_vm] if main_vm.is_alive: @@ -319,7 +321,9 @@ def cleanup_nfs_backend_guest(vmxml_backup): # Even though libvirt-guests was designed to operate guests when # host shutdown. The purpose can also be fulfilled by restart the # libvirt-guests service. - libvirt_guests_service.restart() + if not libvirt_guests_service.restart() == 0: + process.run("journalctl -u libvirt-guests", ignore_status=True) + test.error("libvirt-guests failed to restart. Please check logs.") time.sleep(30) output = tail_messages.get_output() logging.debug("Get messages in /var/log/messages: %s" % output)