From: "Brian C. Lane" <bcl@xxxxxxxxxx> Before noloader this was handled by loader. It detects a specific virtio path (org.fedoraproject.anaconda.log.0) and restarts rsyslogd to pass logs to the host via virtio. If the path doesn't exist this has no effect. This also switches to using systemctl to restart rsyslogd since HUP no longer works as of v5. --- anaconda | 1 + pyanaconda/anaconda_log.py | 30 +++++++++++++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/anaconda b/anaconda index 273d2a0..6a673b1 100755 --- a/anaconda +++ b/anaconda @@ -611,6 +611,7 @@ if __name__ == "__main__": import logging from pyanaconda import anaconda_log anaconda_log.init() + anaconda_log.logger.setupVirtio() log = logging.getLogger("anaconda") stdoutLog = logging.getLogger("anaconda.stdout") diff --git a/pyanaconda/anaconda_log.py b/pyanaconda/anaconda_log.py index 235fc54..f9d884e 100644 --- a/pyanaconda/anaconda_log.py +++ b/pyanaconda/anaconda_log.py @@ -112,6 +112,9 @@ class AnacondaSyslogHandler(SysLogHandler): record.msg = original_msg class AnacondaLog: + SYSLOG_CFGFILE = "/etc/rsyslog.conf" + VIRTIO_PORT = "/dev/virtio-ports/org.fedoraproject.anaconda.log.0" + def __init__ (self): self.tty_loglevel = DEFAULT_TTY_LEVEL self.remote_syslog = None @@ -202,22 +205,35 @@ class AnacondaLog: self.anaconda_logger.warning("%s" % warnings.formatwarning( message, category, filename, lineno, line)) + def restartSyslog(self): + os.system("systemctl restart rsyslog.service") + def updateRemote(self, remote_syslog): """Updates the location of remote rsyslogd to forward to. - Requires updating rsyslogd config and sending SIGHUP to the daemon. + Requires updating rsyslogd config and restarting rsyslog """ - PIDFILE = "/var/run/syslogd.pid" - CFGFILE = "/etc/rsyslog.conf" TEMPLATE = "*.* @@%s\n" self.remote_syslog = remote_syslog - with open(CFGFILE, 'a') as cfgfile: + with open(self.SYSLOG_CFGFILE, 'a') as cfgfile: forward_line = TEMPLATE % remote_syslog cfgfile.write(forward_line) - with open(PIDFILE, 'r') as pidfile: - pid = int(pidfile.read()) - os.kill(pid, signal.SIGHUP) + self.restartSyslog() + + def setupVirtio(self): + """Setup virtio rsyslog logging. + """ + TEMPLATE = "*.* %s\n" + + if not os.path.exists(self.VIRTIO_PORT) \ + or not os.access(self.VIRTIO_PORT, os.W_OK): + return + + with open(self.SYSLOG_CFGFILE, 'a') as cfgfile: + cfgfile.write(TEMPLATE % (self.VIRTIO_PORT,)) + self.restartSyslog() + logger = None def init(): -- 1.7.7.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list