[libvirt] [PATCH v5 14/16] qemu: Complete PCI command checks to controller def validate

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


On 01/06/2018 12:47 AM, John Ferlan wrote:
> Move the qemuCaps checks over to qemuDomainControllerDefValidatePCI.
> 
> This requires two test updates in order to set the correct capability
> bit for an xml2xml test as well as setting up the similar capability
> for the pseries memlocktest.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/qemu/qemu_command.c | 70 +------------------------------------------
>  src/qemu/qemu_domain.c  | 80 +++++++++++++++++++++++++++++++++++++++++++++++--
>  tests/qemumemlocktest.c | 14 +++++++++
>  tests/qemuxml2xmltest.c |  5 +++-
>  4 files changed, 97 insertions(+), 72 deletions(-)
> 
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index 0dbc73399..7a138f921 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -2726,23 +2726,11 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
>  
>          switch ((virDomainControllerModelPCI) def->model) {
>          case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
> -            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) {
> -                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -                               _("the pci-bridge controller "
> -                                 "is not supported in this QEMU binary"));
> -                goto error;
> -            }
>              virBufferAsprintf(&buf, "%s,chassis_nr=%d,id=%s",
>                                modelName, pciopts->chassisNr,
>                                def->info.alias);
>              break;
>          case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
> -            if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PXB)) {
> -                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> -                               _("the pxb controller "
> -                                 "is not supported in this QEMU binary"));
> -                goto error;
> -            }
>              virBufferAsprintf(&buf, "%s,bus_nr=%d,id=%s",
>                                modelName, pciopts->busNr,
>                                def->info.alias);

I'm worried that we cannot do this. As I say in one of of comments to
previous patches - TOCTOU problem. What if somebody downgrades qemu
between define & start times? In this light, I no longer think we can do
03/16, can we?

Michal




More information about the libvir-list mailing list