diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 4c62e7332dc69d4894431c1b0a9e605e929f00a2..de6f7ce5ad7d6abdc5bf9fea21e7c504fa9f1dc9 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1108,6 +1108,14 @@ libxlDriverConfigNew(void) if (virAsprintf(&log_file, "%s/libxl-driver.log", cfg->logDir) < 0) goto error; + if (virFileMakePath(cfg->logDir) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("failed to create log dir '%s': %s"), + cfg->logDir, + virStrerror(errno, ebuf, sizeof(ebuf))); + goto error; + } + if ((cfg->logger_file = fopen(log_file, "a")) == NULL) { VIR_ERROR(_("Failed to create log file '%s': %s"), log_file, virStrerror(errno, ebuf, sizeof(ebuf))); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index b44d7719e23ad5b954f5223f325f666c0d72e958..fc97db4a487b206314e7bb6a406d47504b5e55a2 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -306,13 +306,6 @@ libxlStateInitialize(bool privileged, goto error; libxl_driver->config = cfg; - if (virFileMakePath(cfg->logDir) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("failed to create log dir '%s': %s"), - cfg->logDir, - virStrerror(errno, ebuf, sizeof(ebuf))); - goto error; - } if (virFileMakePath(cfg->stateDir) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to create state dir '%s': %s"),