Re: [libvirt PATCHv2 07/10] qemu: validate virtiofs filesystems

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

 



On Thu, Jan 23, 2020 at 18:46:08 +0100, Ján Tomko wrote:
> Reject unsupported configurations.
> 
> Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
> ---
>  src/qemu/qemu_domain.c | 33 +++++++++++++++++++++++++++++++--
>  1 file changed, 31 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index eb8e82b545..4db0075b89 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -8276,8 +8276,37 @@ qemuDomainDeviceDefValidateFS(virDomainFSDefPtr fs,
>          return -1;
>  
>      case VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS:
> -        /* TODO: vhost-user-fs-pci */
> -        return 0;
> +        if (!fs->binary) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("missing virtiofs binary"));

"missing virtiofs binary path" perhaps?

Also the schema documents that the path is optional and the
documentation never mentions that the path must be provided. I also
didn't find any filling of a default, thus one of these is wrong.

> +            return -1;
> +        }
> +        if (fs->accessmode != VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("virtiofs only supports passthrough accessmode"));
> +            return -1;
> +        }
> +        if (fs->wrpolicy != VIR_DOMAIN_FS_WRPOLICY_DEFAULT) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("virtiofs does not support wrpolicy"));
> +            return -1;
> +        }
> +        if (fs->model != VIR_DOMAIN_FS_MODEL_DEFAULT) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("virtiofs does not support model"));
> +            return -1;
> +        }
> +        if (fs->format != VIR_STORAGE_FILE_NONE) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("virtiofs does not support format"));
> +            return -1;
> +        }

The schema should also reject this.

> +        if (def->mem.access != VIR_DOMAIN_MEMORY_ACCESS_SHARED) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                           _("virtiofs requires shared memory"));
> +            return -1;
> +        }
> +        break;
>  
>      case VIR_DOMAIN_FS_DRIVER_TYPE_LAST:
>      default:

Except for the issue with the path to the virtiofs binary this patch
looks okay.





[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