[PATCH v2 3/8] Validate remote store NVRAM

Peter Krempa pkrempa at redhat.com
Thu Apr 21 14:52:54 UTC 2022


On Fri, Apr 08, 2022 at 10:48:46 -0700, Rohit Kumar wrote:
> Remote store NVRAM feature is being enabled only
> if it supports 'blockdev' capability.
> 
> Signed-off-by: Prerna Saxena <prerna.saxena at nutanix.com>
> Signed-off-by: Florian Schmidt <flosch at nutanix.com>
> Signed-off-by: Rohit Kumar <rohit.kumar3 at nutanix.com>
> ---
>  src/qemu/qemu_validate.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
> index 96f5427678..2a961b1f50 100644
> --- a/src/qemu/qemu_validate.c
> +++ b/src/qemu/qemu_validate.c
> @@ -611,6 +611,25 @@ qemuValidateDomainDefBoot(const virDomainDef *def)
>  }

As noted in 2/8, this will need to be moved earlier.

>  
>  
> +static int
> +qemuValidateDomainDefNvram(const virDomainDef *def,
> +                           virQEMUCaps *qemuCaps)
> +{

Return early if there's nothing to validate to decrease indentation
level.

> +    if (def->os.loader && def->os.loader->nvram) {
> +        if (def->os.loader->nvram->type !=  VIR_STORAGE_TYPE_FILE &&
> +            !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("This Qemu does not support 'blockdev' capability "
> +                             "for remote store NVRAM. NVRAM type other than "
> +                             "'file' is not supported with this QEMU"));

"Remote NVRAM is not supported by this qemu".

> +            return -1;
> +        }
> +    }

Also you need to reject all the other unsupported configs here.

> +
> +    return 0;


More information about the libvir-list mailing list