[libvirt] [PATCH v5 11/16] qemu: Move PCI command modelName check to controller def validate

Michal Privoznik mprivozn at redhat.com
Sun Jan 28 08:48:15 UTC 2018


On 01/06/2018 12:47 AM, John Ferlan wrote:
> Move the various modelName == NAME_NONE from the command line
> generation into domain controller validation.  Also rather than
> have multiple cases with the same check, let's make the code
> more generic, but also note that it was the modelName option
> that caused the failure. We also have to be sure not to check
> the PCI models that we don't care about.
> 
> For the remaining checks in command line building, we can use
> the field name in the error message to be more specific about
> what causes the failure.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/qemu/qemu_command.c | 36 ++++++------------------------------
>  src/qemu/qemu_domain.c  | 12 ++++++++++++
>  2 files changed, 18 insertions(+), 30 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 0175daee3..58f6bee3a 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -2723,9 +2723,7 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
>  
>          switch ((virDomainControllerModelPCI) def->model) {
>          case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
> -            if (pciopts->modelName
> -                == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE ||
> -                pciopts->chassisNr == -1) {
> +            if (pciopts->chassisNr == -1) {
>                  virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                                 _("autogenerated pci-bridge options not set"));

I don't quite understand why break this check and move just one part of
it into DefValidate and leave the other here.

EDIT: Ah, you're doing that in one of the next patches. ACK then.

Michal




More information about the libvir-list mailing list