mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-24 04:12:20 +00:00
nwfilter: Move creation of configDir to driver initialization
Rather than "wait" for the first config file to be created, force creation of the configDir during driver state initialization. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
119a6b3071
commit
245f1d8521
@ -2778,13 +2778,6 @@ virNWFilterSaveXML(const char *configDir,
|
|||||||
if (!(configFile = virFileBuildPath(configDir, def->name, ".xml")))
|
if (!(configFile = virFileBuildPath(configDir, def->name, ".xml")))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virFileMakePath(configDir) < 0) {
|
|
||||||
virReportSystemError(errno,
|
|
||||||
_("cannot create config directory '%s'"),
|
|
||||||
configDir);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
virUUIDFormat(def->uuid, uuidstr);
|
virUUIDFormat(def->uuid, uuidstr);
|
||||||
ret = virXMLSaveFile(configFile,
|
ret = virXMLSaveFile(configFile,
|
||||||
virXMLPickShellSafeComment(def->name, uuidstr),
|
virXMLPickShellSafeComment(def->name, uuidstr),
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include "nwfilter_driver.h"
|
#include "nwfilter_driver.h"
|
||||||
#include "nwfilter_gentech_driver.h"
|
#include "nwfilter_gentech_driver.h"
|
||||||
#include "configmake.h"
|
#include "configmake.h"
|
||||||
|
#include "virfile.h"
|
||||||
#include "virstring.h"
|
#include "virstring.h"
|
||||||
#include "viraccessapicheck.h"
|
#include "viraccessapicheck.h"
|
||||||
|
|
||||||
@ -237,6 +238,12 @@ nwfilterStateInitialize(bool privileged,
|
|||||||
|
|
||||||
VIR_FREE(base);
|
VIR_FREE(base);
|
||||||
|
|
||||||
|
if (virFileMakePathWithMode(driver->configDir, S_IRWXU) < 0) {
|
||||||
|
virReportSystemError(errno, _("cannot create config directory '%s'"),
|
||||||
|
driver->configDir);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(driver->nwfilters = virNWFilterObjListNew()))
|
if (!(driver->nwfilters = virNWFilterObjListNew()))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user