[libvirt] [PATCH v3 06/12] qemu: Introduce qemuDomainDeviceDefValidateControllerPCI
John Ferlan
jferlan at redhat.com
Sat Dec 9 16:07:17 UTC 2017
On 12/08/2017 10:38 AM, Ján Tomko wrote:
> On Wed, Dec 06, 2017 at 08:14:02PM -0500, John Ferlan wrote:
>> Move PCI validation checks out of qemu_command into the proper
>> qemu_domain validation helper.
>>
>> Since there's a lot to move, we'll start slow by replicating the
>> pcie-root and pci-root avoidance from qemuBuildSkipController and
>> the first switch found in qemuBuildControllerDevStr.
>>
>> Signed-off-by: John Ferlan <jferlan at redhat.com>
>> ---
>> src/qemu/qemu_command.c | 20 --------------------
>> src/qemu/qemu_domain.c | 49
>> ++++++++++++++++++++++++++++++++++++++++++++++++-
>> 2 files changed, 48 insertions(+), 21 deletions(-)
>>
>> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
>> index 428db1193..ceb03a0cd 100644
>> --- a/src/qemu/qemu_domain.c
>> +++ b/src/qemu/qemu_domain.c
>> @@ -4010,6 +4010,50 @@ qemuDomainDeviceDefValidateControllerSCSI(const
>> virDomainControllerDef *controll
>>
>>
>> static int
>> +qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef
>> *controller,
>> + const virDomainDef *def)
>> +{
>> + virDomainControllerModelPCI model = controller->model;
>> +
>> + /* skip pcie-root */
>> + if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
>
> We already checked that the controller type is PCI in the caller.
>
Oh right, hence my distaste for cut-n-paste code ;-)
John
>> + controller->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT)
>> + return 0;
>> +
>> + /* Skip pci-root, except for pSeries guests (which actually
>> + * support more than one PCI Host Bridge per guest) */
>> + if (!qemuDomainIsPSeries(def) &&
>> + controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
>
> Same here.
>
>> + controller->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT)
>> + return 0;
>> +
>
> Jan
More information about the libvir-list
mailing list