conf: don't use passed in caps in post parse method

To enable the virCapsPtr parameter to the post parse method to be
eliminated, the drivers must fetch the virCapsPtr from their own
driver via the opaque parameter, or use an alternative approach
to validate the parsed data.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2019-12-09 10:15:16 +00:00
parent 2578d74aee
commit 4a4132b462
35 changed files with 301 additions and 144 deletions
+33 -1
View File
@@ -6,8 +6,10 @@
# include "viralloc.h"
# include "domain_conf.h"
# define VIR_FROM_THIS VIR_FROM_LXC
virCapsPtr testLXCCapsInit(void)
virCapsPtr
testLXCCapsInit(void)
{
virCapsPtr caps;
virCapsGuestPtr guest;
@@ -54,4 +56,34 @@ virCapsPtr testLXCCapsInit(void)
virObjectUnref(caps);
return NULL;
}
virLXCDriverPtr
testLXCDriverInit(void)
{
virLXCDriverPtr driver = g_new0(virLXCDriver, 1);
if (virMutexInit(&driver->lock) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"%s", "cannot initialize mutex");
g_free(driver);
return NULL;
}
driver->caps = testLXCCapsInit();
driver->xmlopt = lxcDomainXMLConfInit(driver);
return driver;
}
void
testLXCDriverFree(virLXCDriverPtr driver)
{
virObjectUnref(driver->xmlopt);
virObjectUnref(driver->caps);
virMutexDestroy(&driver->lock);
g_free(driver);
}
#endif