[libvirt PATCHv4 09/15] qemu: validate virtiofs filesystems

Peter Krempa pkrempa at redhat.com
Wed Feb 26 09:05:36 UTC 2020


On Wed, Feb 26, 2020 at 09:44:14 +0100, Ján Tomko wrote:
> On Wed, Feb 26, 2020 at 09:15:17AM +0100, Michal Privoznik wrote:
> > On 2/26/20 8:33 AM, Peter Krempa wrote:
> > > On Thu, Feb 20, 2020 at 15:32:46 +0100, Ján Tomko wrote:
> > > > Reject unsupported configurations.
> > > > 
> > > > Signed-off-by: Ján Tomko <jtomko at redhat.com>
> > > > ---
> > > >  src/qemu/qemu_domain.c | 61 +++++++++++++++++++++++++++++++++++++++---
> > > >  1 file changed, 58 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> > > > index c3fc3fed1c..7cb283123d 100644
> > > > --- a/src/qemu/qemu_domain.c
> > > > +++ b/src/qemu/qemu_domain.c
> > > > @@ -8266,10 +8266,44 @@ qemuDomainDeviceDefValidateIOMMU(const virDomainIOMMUDef *iommu,
> > > >      return 0;
> > > >  }
> > > > +static int
> > > > +qemuDomainDefValidateVirtioFSSharedMemory(const virDomainDef *def)
> > > > +{
> > > > +    size_t numa_nodes = virDomainNumaGetNodeCount(def->numa);
> > > > +    size_t i;
> > > > +
> > > > +    for (i = 0; i < numa_nodes; i++) {
> > > 
> > > This won't catch guests with no numa configured ...
> > > 
> 
> Consider this squashed in:
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 090720fd76..f992e3fc6e 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -8276,6 +8276,12 @@ qemuDomainDefValidateVirtioFSSharedMemory(const virDomainDef *def)
>      size_t numa_nodes = virDomainNumaGetNodeCount(def->numa);
>      size_t i;
> 
> +    if (numa_nodes == 0) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                       _("virtiofs requires one or more NUMA nodes"));
> +        return -1;
> +    }
> +
>      for (i = 0; i < numa_nodes; i++) {
>          virDomainMemoryAccess node_access =
>              virDomainNumaGetNodeMemoryAccessMode(def->numa, i);

We have a similar requirement for either cpu or memory hotplug so:

Reviewed-by: Peter Krempa <pkrempa at redhat.com>

Ideally guests instantiated via virt-install should already come with ne
numa node, but that's for another time.




More information about the libvir-list mailing list