Re: [PATCH 08/26] qemu: Tweak index number checking

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

 



On 06/02/2017 12:07 PM, Andrea Bolognani wrote:
> Moving the check and rewriting it this way doesn't alter
> the current behavior, but will allow us to special-case
> pci-root down the line.

But this function should never be called for a controller with
model='pci-root'?



> ---
>  src/qemu/qemu_command.c | 26 ++++++++++++++++++++------
>  1 file changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index a0403bf..082ffa9 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -2828,6 +2828,26 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
>      case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
>          switch ((virDomainControllerModelPCI) def->model) {
>          case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
> +        case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS:
> +            if (def->idx == 0) {
> +                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                               _("index for pci controllers of model '%s' must be > 0"),
> +                               virDomainControllerModelPCITypeToString(def->model));
> +                goto error;
> +            }
> +            break;
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
> +            break;
> +        }
> +        switch ((virDomainControllerModelPCI) def->model) {
> +        case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
>              if (def->opts.pciopts.modelName
>                  == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE ||
>                  def->opts.pciopts.chassisNr == -1) {
> @@ -3086,12 +3106,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
>                             _("wrong function called"));
>              goto error;
>          }
> -        if (def->idx == 0) {
> -            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> -                           _("index for pci controllers of model '%s' must be > 0"),
> -                           virDomainControllerModelPCITypeToString(def->model));
> -            goto error;
> -        }
>          break;
>  
>      case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
> 

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



[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