On 03/27/2017 03:41 AM, Martin Kletzander wrote:
On Sun, Mar 26, 2017 at 08:49:28PM -0400, Laine Stump wrote:
> This is the maximum for many reasons, for starters because index ==
> bus number, and a controller's bus number is 8 bits.
>
> This incidentally resolves:
https://bugzilla.redhat.com/1329090
> ---
> src/conf/domain_conf.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 6bbc6a2..2139ab0 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -4846,6 +4846,24 @@ virDomainNetDefValidate(const virDomainNetDef
> *net)
>
>
> static int
> +virDomainControllerDefValidate(const virDomainControllerDef *controller)
> +{
> + if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
> + if (controller->idx > 255) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("PCI controller index %d too high, or
> too many "
The first line might be enough, maybe adding the max value there.
Okay, I adjusted it.
> + "PCI controllers. A maximum of 256 PCI "
> + "controllers is allowed, and the maximum
> value "
> + "of the index attribute is 255"),
> + controller->idx);
> + return -1;
> + }
> + }
> + return 0;
> +}
> +
> +
> +static int
> virDomainDeviceDefValidateInternal(const virDomainDeviceDef *dev,
> const virDomainDef *def)
> {
> @@ -4867,6 +4885,7 @@ virDomainDeviceDefValidateInternal(const
> virDomainDeviceDef *dev,
> case VIR_DOMAIN_DEVICE_HOSTDEV:
> case VIR_DOMAIN_DEVICE_WATCHDOG:
> case VIR_DOMAIN_DEVICE_CONTROLLER:
> + return virDomainControllerDefValidate(dev->data.controller);
Do you really mean to fall-through from hostdev, watchdog and so on? ;)
No, it was just late in the day, I was on a roll and didn't pay
attention. I moved this up above the other NOP cases. I'm just attaching
the patch here. Is that good enough for an ACK, or do you want a full
re-send?
> case VIR_DOMAIN_DEVICE_GRAPHICS:
> case VIR_DOMAIN_DEVICE_HUB:
> case VIR_DOMAIN_DEVICE_SMARTCARD:
> --
> 2.9.3
>
> --
> libvir-list mailing list
> libvir-list(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/libvir-list