[PATCH v2 3/8] Validate remote store NVRAM
Ani Sinha
ani at anisinha.ca
Sat Apr 9 14:49:13 UTC 2022
On Fri, Apr 8, 2022 at 11:19 PM Rohit Kumar <rohit.kumar3 at nutanix.com> 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>
Please add negative unit tests to check the validation along with this
patch. Prefix the patch with "qemu:".
> ---
> 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)
> }
>
>
> +static int
> +qemuValidateDomainDefNvram(const virDomainDef *def,
> + virQEMUCaps *qemuCaps)
> +{
> + 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"));
> + return -1;
> + }
> + }
> +
> + return 0;
> +}
> +
> +
> /**
> * qemuValidateDefGetVcpuHotplugGranularity:
> * @def: domain definition
> @@ -1185,6 +1204,9 @@ qemuValidateDomainDef(const virDomainDef *def,
> if (qemuValidateDomainDefBoot(def) < 0)
> return -1;
>
> + if (qemuValidateDomainDefNvram(def, qemuCaps) < 0)
> + return -1;
> +
> if (qemuValidateDomainVCpuTopology(def, qemuCaps) < 0)
> return -1;
>
> --
> 2.25.1
>
More information about the libvir-list
mailing list