Re: [PATCH v2 3/8] Validate remote store NVRAM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Apr 8, 2022 at 11:19 PM Rohit Kumar <rohit.kumar3@xxxxxxxxxxx> wrote:
>
> Remote store NVRAM feature is being enabled only
> if it supports 'blockdev' capability.
>
> Signed-off-by: Prerna Saxena <prerna.saxena@xxxxxxxxxxx>
> Signed-off-by: Florian Schmidt <flosch@xxxxxxxxxxx>
> Signed-off-by: Rohit Kumar <rohit.kumar3@xxxxxxxxxxx>

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
>




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux