On Fri, 2019-02-08 at 17:12 -0500, Cole Robinson wrote:
[...]
> @@ -10858,6 +10866,15 @@ virDomainFSDefParseXML(virDomainXMLOptionPtr xmlopt,
>          def->accessmode = VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH;
>      }
>  
> +    model = virXMLPropString(node, "model");
> +    if (model) {
> +        if ((def->model = virDomainFSModelTypeFromString(model)) < 0) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                           _("unknown model '%s'"), model);
> +            goto error;
> +        }
> +    }

If we wanted to be super-duper safe, we could do

  if (model) {
      if ((def->model = virDomainFSModelTypeFromString(model)) < 0 ||
          def->model == VIR_DOMAIN_FS_MODEL_DEFAULT) {
          virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                         _("unknown model '%s'"), model);
          goto error;
      }
  }

to prevent people from using

  <filesystem model='default'>
    ...
  </filesystem>

and same for disks and other devices for which we're introducing
the concept of model just now. But it's probably okay even if we
don't want to go the extra mile.

Either way,

  Reviewed-by: Andrea Bolognani <[email protected]>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to