mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: remove pointless qemuDomainLogContextMode
Since its introduction in4d1b771fbb
it has only been used to differentiate between START and non-START. Last use of QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH was removed by: commitf709377301
qemu: Fix qemuDomainObjTaint with virtlogd QEMU_DOMAIN_LOG_CONTEXT_MODE_STOP is unused since: commitcf3ea0769c
qemu: process: Append the "shutting down" message using the new APIs Now, the only caller passes QEMU_DOMAIN_LOG_CONTEXT_MODE_START. Assume that's always the case and remove the 'mode' argument. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
cb3bc96e67
commit
2bad705ebb
@ -7118,8 +7118,7 @@ void qemuDomainObjCheckNetTaint(virQEMUDriver *driver,
|
|||||||
|
|
||||||
|
|
||||||
qemuDomainLogContext *qemuDomainLogContextNew(virQEMUDriver *driver,
|
qemuDomainLogContext *qemuDomainLogContextNew(virQEMUDriver *driver,
|
||||||
virDomainObj *vm,
|
virDomainObj *vm)
|
||||||
qemuDomainLogContextMode mode)
|
|
||||||
{
|
{
|
||||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||||
qemuDomainLogContext *ctxt = QEMU_DOMAIN_LOG_CONTEXT(g_object_new(QEMU_TYPE_DOMAIN_LOG_CONTEXT, NULL));
|
qemuDomainLogContext *ctxt = QEMU_DOMAIN_LOG_CONTEXT(g_object_new(QEMU_TYPE_DOMAIN_LOG_CONTEXT, NULL));
|
||||||
@ -7160,15 +7159,13 @@ qemuDomainLogContext *qemuDomainLogContextNew(virQEMUDriver *driver,
|
|||||||
/* For unprivileged startup we must truncate the file since
|
/* For unprivileged startup we must truncate the file since
|
||||||
* we can't rely on logrotate. We don't use O_TRUNC since
|
* we can't rely on logrotate. We don't use O_TRUNC since
|
||||||
* it is better for SELinux policy if we truncate afterwards */
|
* it is better for SELinux policy if we truncate afterwards */
|
||||||
if (mode == QEMU_DOMAIN_LOG_CONTEXT_MODE_START &&
|
if (!driver->privileged &&
|
||||||
!driver->privileged &&
|
|
||||||
ftruncate(ctxt->writefd, 0) < 0) {
|
ftruncate(ctxt->writefd, 0) < 0) {
|
||||||
virReportSystemError(errno, _("failed to truncate %1$s"),
|
virReportSystemError(errno, _("failed to truncate %1$s"),
|
||||||
ctxt->path);
|
ctxt->path);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == QEMU_DOMAIN_LOG_CONTEXT_MODE_START) {
|
|
||||||
if ((ctxt->readfd = open(ctxt->path, O_RDONLY)) < 0) {
|
if ((ctxt->readfd = open(ctxt->path, O_RDONLY)) < 0) {
|
||||||
virReportSystemError(errno, _("failed to open logfile %1$s"),
|
virReportSystemError(errno, _("failed to open logfile %1$s"),
|
||||||
ctxt->path);
|
ctxt->path);
|
||||||
@ -7179,7 +7176,6 @@ qemuDomainLogContext *qemuDomainLogContextNew(virQEMUDriver *driver,
|
|||||||
ctxt->path);
|
ctxt->path);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ((ctxt->pos = lseek(ctxt->writefd, 0, SEEK_END)) < 0) {
|
if ((ctxt->pos = lseek(ctxt->writefd, 0, SEEK_END)) < 0) {
|
||||||
virReportSystemError(errno, _("failed to seek in log file %1$s"),
|
virReportSystemError(errno, _("failed to seek in log file %1$s"),
|
||||||
|
@ -652,15 +652,8 @@ void qemuDomainObjCheckNetTaint(virQEMUDriver *driver,
|
|||||||
virDomainNetDef *net,
|
virDomainNetDef *net,
|
||||||
qemuDomainLogContext *logCtxt);
|
qemuDomainLogContext *logCtxt);
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
QEMU_DOMAIN_LOG_CONTEXT_MODE_START,
|
|
||||||
QEMU_DOMAIN_LOG_CONTEXT_MODE_ATTACH,
|
|
||||||
QEMU_DOMAIN_LOG_CONTEXT_MODE_STOP,
|
|
||||||
} qemuDomainLogContextMode;
|
|
||||||
|
|
||||||
qemuDomainLogContext *qemuDomainLogContextNew(virQEMUDriver *driver,
|
qemuDomainLogContext *qemuDomainLogContextNew(virQEMUDriver *driver,
|
||||||
virDomainObj *vm,
|
virDomainObj *vm);
|
||||||
qemuDomainLogContextMode mode);
|
|
||||||
int qemuDomainLogContextWrite(qemuDomainLogContext *ctxt,
|
int qemuDomainLogContextWrite(qemuDomainLogContext *ctxt,
|
||||||
const char *fmt, ...) G_GNUC_PRINTF(2, 3);
|
const char *fmt, ...) G_GNUC_PRINTF(2, 3);
|
||||||
ssize_t qemuDomainLogContextRead(qemuDomainLogContext *ctxt,
|
ssize_t qemuDomainLogContextRead(qemuDomainLogContext *ctxt,
|
||||||
|
@ -7612,8 +7612,7 @@ qemuProcessLaunch(virConnectPtr conn,
|
|||||||
hookData.cfg = cfg;
|
hookData.cfg = cfg;
|
||||||
|
|
||||||
VIR_DEBUG("Creating domain log file");
|
VIR_DEBUG("Creating domain log file");
|
||||||
if (!(logCtxt = qemuDomainLogContextNew(driver, vm,
|
if (!(logCtxt = qemuDomainLogContextNew(driver, vm))) {
|
||||||
QEMU_DOMAIN_LOG_CONTEXT_MODE_START))) {
|
|
||||||
virLastErrorPrefixMessage("%s", _("can't connect to virtlogd"));
|
virLastErrorPrefixMessage("%s", _("can't connect to virtlogd"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user