mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 11:01:19 +00:00
nwfilter: Replace virNWFilterSaveDef with virNWFilterSaveConfig
Essentially virNWFilterSaveDef executed in a different order the same sequence of calls, so let's just make one point of reference. Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
324fd3a33c
commit
119a6b3071
@ -2931,43 +2931,6 @@ virNWFilterTriggerVMFilterRebuild(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
virNWFilterSaveDef(const char *configDir,
|
|
||||||
virNWFilterDefPtr def)
|
|
||||||
{
|
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
|
||||||
char *xml;
|
|
||||||
int ret = -1;
|
|
||||||
char *configFile = NULL;
|
|
||||||
|
|
||||||
if (virFileMakePath(configDir) < 0) {
|
|
||||||
virReportSystemError(errno,
|
|
||||||
_("cannot create config directory %s"),
|
|
||||||
configDir);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(configFile = virFileBuildPath(configDir, def->name, ".xml")))
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
if (!(xml = virNWFilterDefFormat(def))) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
"%s", _("failed to generate XML"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
virUUIDFormat(def->uuid, uuidstr);
|
|
||||||
ret = virXMLSaveFile(configFile,
|
|
||||||
virXMLPickShellSafeComment(def->name, uuidstr),
|
|
||||||
"nwfilter-edit", xml);
|
|
||||||
VIR_FREE(xml);
|
|
||||||
|
|
||||||
error:
|
|
||||||
VIR_FREE(configFile);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterDeleteDef(const char *configDir,
|
virNWFilterDeleteDef(const char *configDir,
|
||||||
virNWFilterDefPtr def)
|
virNWFilterDefPtr def)
|
||||||
|
@ -569,10 +569,6 @@ virNWFilterDefFree(virNWFilterDefPtr def);
|
|||||||
int
|
int
|
||||||
virNWFilterTriggerVMFilterRebuild(void);
|
virNWFilterTriggerVMFilterRebuild(void);
|
||||||
|
|
||||||
int
|
|
||||||
virNWFilterSaveDef(const char *configDir,
|
|
||||||
virNWFilterDefPtr def);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
virNWFilterDeleteDef(const char *configDir,
|
virNWFilterDeleteDef(const char *configDir,
|
||||||
virNWFilterDefPtr def);
|
virNWFilterDefPtr def);
|
||||||
|
@ -740,7 +740,7 @@ virNWFilterRuleIsProtocolEthernet;
|
|||||||
virNWFilterRuleIsProtocolIPv4;
|
virNWFilterRuleIsProtocolIPv4;
|
||||||
virNWFilterRuleIsProtocolIPv6;
|
virNWFilterRuleIsProtocolIPv6;
|
||||||
virNWFilterRuleProtocolTypeToString;
|
virNWFilterRuleProtocolTypeToString;
|
||||||
virNWFilterSaveDef;
|
virNWFilterSaveConfig;
|
||||||
virNWFilterTriggerVMFilterRebuild;
|
virNWFilterTriggerVMFilterRebuild;
|
||||||
virNWFilterUnlockFilterUpdates;
|
virNWFilterUnlockFilterUpdates;
|
||||||
virNWFilterUnRegisterCallbackDriver;
|
virNWFilterUnRegisterCallbackDriver;
|
||||||
|
@ -510,7 +510,7 @@ nwfilterDefineXML(virConnectPtr conn,
|
|||||||
def = NULL;
|
def = NULL;
|
||||||
objdef = virNWFilterObjGetDef(obj);
|
objdef = virNWFilterObjGetDef(obj);
|
||||||
|
|
||||||
if (virNWFilterSaveDef(driver->configDir, objdef) < 0) {
|
if (virNWFilterSaveConfig(driver->configDir, objdef) < 0) {
|
||||||
virNWFilterObjListRemove(driver->nwfilters, obj);
|
virNWFilterObjListRemove(driver->nwfilters, obj);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user