Add the bhyveDomainDefValidate() validation which currently checks whether the requested NVRAM is supported.
Signed-off-by: Roman Bogorodskiy <bogorods...@gmail.com> --- src/bhyve/bhyve_domain.c | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index ca5176885a..3e18a462e4 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -267,11 +267,54 @@ bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev, return 0; } + +static int +bhyveDomainDefValidate(const virDomainDef *def, + void *opaque G_GNUC_UNUSED, + void *parseOpaque G_GNUC_UNUSED) +{ + virStorageSource *src = NULL; + + if (!def->os.loader) + return 0; + + if (!(src = def->os.loader->nvram)) + return 0; + + if (src->type != VIR_STORAGE_TYPE_FILE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", + _("only 'file' type is supported with NVRAM")); + return -1; + } + + if (src->sliceStorage) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("slices are not supported with NVRAM")); + return -1; + } + + if (src->pr) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("persistent reservations are not supported with NVRAM")); + return -1; + } + + if (src->backingStore) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("backingStore is not supported with NVRAM")); + return -1; + } + + return 0; +} + virDomainDefParserConfig virBhyveDriverDomainDefParserConfig = { .devicesPostParseCallback = bhyveDomainDeviceDefPostParse, .domainPostParseCallback = bhyveDomainDefPostParse, .assignAddressesCallback = bhyveDomainDefAssignAddresses, .deviceValidateCallback = bhyveDomainDeviceDefValidate, + .domainValidateCallback = bhyveDomainDefValidate, .features = VIR_DOMAIN_DEF_FEATURE_FW_AUTOSELECT, }; -- 2.49.0