Signed-off-by: K Shiva Kiran <shiva_kr@xxxxxxxxxx> --- src/nwfilter/nwfilter_driver.c | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 09719edd75..3a28532ca2 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -812,6 +812,65 @@ nwfilterBindingDelete(virNWFilterBindingPtr binding) } +static int +nwfilterSetMetadata(virNWFilterPtr nwfilter, + int type, + const char *metadata, + const char *key, + const char *uri, + unsigned int flags) +{ + virNWFilterObj *obj = NULL; + virNWFilterDef *def = NULL; + int ret = -1; + + virCheckFlags(0, -1); + + if (!(obj = nwfilterObjFromNWFilter(nwfilter->uuid))) + return -1; + + def = virNWFilterObjGetDef(obj); + + if (virNWFilterSetMetadataEnsureACL(nwfilter->conn, def) < 0) + goto cleanup; + + ret = virNWFilterObjSetMetadata(obj, type, metadata, key, uri, + driver->configDir); + + cleanup: + virNWFilterObjUnlock(obj); + return ret; +} + + +static char * +nwfilterGetMetadata(virNWFilterPtr nwfilter, + int type, + const char *uri, + unsigned int flags) +{ + virNWFilterObj *obj = NULL; + virNWFilterDef *def = NULL; + char *ret = NULL; + + virCheckFlags(0, NULL); + + if (!(obj = nwfilterObjFromNWFilter(nwfilter->uuid))) + return NULL; + + def = virNWFilterObjGetDef(obj); + + if (virNWFilterGetMetadataEnsureACL(nwfilter->conn, def) < 0) + goto cleanup; + + ret = virNWFilterObjGetMetadata(obj, type, uri); + + cleanup: + virNWFilterObjUnlock(obj); + return ret; +} + + static virNWFilterDriver nwfilterDriver = { .name = "nwfilter", .connectNumOfNWFilters = nwfilterConnectNumOfNWFilters, /* 0.8.0 */ @@ -828,6 +887,8 @@ static virNWFilterDriver nwfilterDriver = { .nwfilterBindingGetXMLDesc = nwfilterBindingGetXMLDesc, /* 4.5.0 */ .nwfilterBindingCreateXML = nwfilterBindingCreateXML, /* 4.5.0 */ .nwfilterBindingDelete = nwfilterBindingDelete, /* 4.5.0 */ + .nwfilterGetMetadata = nwfilterGetMetadata, /* 9.8.0 */ + .nwfilterSetMetadata = nwfilterSetMetadata, /* 9.8.0 */ }; -- 2.42.0