Re: [libvirt] [PATCH v5 02/12] qemu: Create new qemuDomainDeviceDefValidateControllerPCI()

2018-03-02 Thread Laine Stump
On 03/02/2018 10:13 AM, Andrea Bolognani wrote:
> The esisting function is renamed and called from the new one, so

Forgot to mention this before:

  s/esisting/existing/

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v5 02/12] qemu: Create new qemuDomainDeviceDefValidateControllerPCI()

2018-03-02 Thread Laine Stump
On 03/02/2018 10:13 AM, Andrea Bolognani wrote:
> The esisting function is renamed and called from the new one, so
> that even while we're in the process of implementing new checks
> all the existing ones will be performed.
>
> Signed-off-by: Andrea Bolognani 
> ---
>  src/qemu/qemu_domain.c | 29 ++---
>  1 file changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 8b4efc82de..a45a676520 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -4268,9 +4268,9 @@ qemuDomainDeviceDefValidateControllerSCSI(const 
> virDomainControllerDef *controll
>  
>  
>  static int
> -qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef 
> *controller,
> - const virDomainDef *def,
> - virQEMUCapsPtr qemuCaps)
> +qemuDomainDeviceDefValidateControllerPCIOld(const virDomainControllerDef 
> *controller,
> +const virDomainDef *def,
> +virQEMUCapsPtr qemuCaps)
>  {
>  virDomainControllerModelPCI model = controller->model;
>  const virDomainPCIControllerOpts *pciopts;
> @@ -4547,6 +4547,29 @@ qemuDomainDeviceDefValidateControllerPCI(const 
> virDomainControllerDef *controlle
>  }
>  
>  
> +static int
> +qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont,
> + const virDomainDef *def,
> + virQEMUCapsPtr qemuCaps)
> +
> +{
> +const virDomainPCIControllerOpts *pciopts = &cont->opts.pciopts;
> +const char *model = virDomainControllerModelPCITypeToString(cont->model);
> +const char *modelName = 
> virDomainControllerPCIModelNameTypeToString(pciopts->modelName);
> +
> +if (!model) {
> +virReportEnumRangeError(virDomainControllerModelPCI, cont->model);
> +return -1;
> +}
> +if (!modelName) {
> +virReportEnumRangeError(virDomainControllerPCIModelName, 
> pciopts->modelName);
> +return -1;
> +}
> +
> +return qemuDomainDeviceDefValidateControllerPCIOld(cont, def, qemuCaps);
> +}
> +
> +
>  static int
>  qemuDomainDeviceDefValidateControllerSATA(const virDomainControllerDef 
> *controller,
>const virDomainDef *def,


Sure. Seems as reasonable a way as any to add the new and remove the old
without ending up with confusing diffs.


Reviewed-by: Laine Stump 


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list