From nobody Sun Feb 8 18:28:31 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1575933383; cv=none; d=zohomail.com; s=zohoarc; b=GmNUjd9RV0hTCZNgO5QHB4JSMdKAiy0EUebLlDJM5JWivkcQUyJRUHxwQnFqkM779qfZWVu6MYb70LXKxFgLGfOH/4cVC9z+0Mohko/lPqtL16zx/Bboj7B3KupfFUe8/hJ63hLe43yCIx0tZ131Gw6PptuLOJeTcEBk4z8kJbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575933383; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rUJGsXyr7a9z4+jP7Yzthj8eQtFzwlIwWjreey6+i/I=; b=IgRyc2C7+gqAyWXcfkrOaN4Awm9Z8X9GzM3o4+oAFnu6O8eV32NmCUfhB3u+IhHd363VPw3xQlnoS9ZfD/oh82n9EiPMoPnIZe6FpSRLUFFV70zga4mciqB3QhSxx53E7hc5pCiJeuQsHuvRK2Q8Wd1ab0fy8a5jtjKE5eTXQeE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1575933383945181.9291911387653; Mon, 9 Dec 2019 15:16:23 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-164-8hVanUinMai2eOOUA5FTDg-1; Mon, 09 Dec 2019 18:16:21 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 888208024D3; Mon, 9 Dec 2019 23:16:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C6011001938; Mon, 9 Dec 2019 23:16:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1767C8355C; Mon, 9 Dec 2019 23:16:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xB9NG3ua008422 for ; Mon, 9 Dec 2019 18:16:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9B29D2166B2C; Mon, 9 Dec 2019 23:16:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 967CE2166B29 for ; Mon, 9 Dec 2019 23:16:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C6EB90B969 for ; Mon, 9 Dec 2019 23:16:03 +0000 (UTC) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-110-DtXkbYWpPNeVsbOZjcpC3Q-1; Mon, 09 Dec 2019 18:16:01 -0500 Received: by mail-qk1-f171.google.com with SMTP id r14so6631742qke.13; Mon, 09 Dec 2019 15:16:01 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:fe5:8243:c780:f073:3beb]) by smtp.gmail.com with ESMTPSA id e130sm352436qkb.72.2019.12.09.15.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 15:16:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575933382; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rUJGsXyr7a9z4+jP7Yzthj8eQtFzwlIwWjreey6+i/I=; b=P5S2X6X2LnqVy3eOhw3NNltPtA0xTmct/0K6iocyvo5t9TEnjzYsI40aUfLLinZhaWWFIs /hhH338Vely/UeORO9ziaGkt5jKAhL3qayq2TsOCod4HJAJ7e8ZbJ4pzn1bQwlPrcS3P6m cPtVq60i0UHzKgPCm1d3iQRRIY3UC4g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HrHbBUWIcm7zsjdYnFn1C4DvDpKe0zUWBX1bC+IXuf0=; b=ob8IOtba0Hky+PHVu6eN+o6kbI+myx8b5Zkx3ECiYWx3HLlB2rNQIDRmK0hSa4IIRI cj26BHPyqMlL0n5ggoG+AVAnxQn88iM6azteCMkz1SzP8tgA8+d4cAHjl55bZ6+rwAZQ 8AElQvIdHsJgVnMwuSkPlMOxszMhuA1xb/xPYBB8DbnRVLAA/0jQKrok0kJbMZCeynHf kNgDgvdHmfApAlilS6tgbYB6hlcI0JsH7X53QTf9od+/cgwhK8A2ld+1PGjPuQ74j5Sl 5MPcXC2UTbelQwg9H5tdXn6b8sCbdcbzVCjx3cJ8fn9VdMRoKqdZJYdC5xw8JSAqVgrS hqhA== X-Gm-Message-State: APjAAAU/fnKPBMy5W6EyljxDcksAdvvl9YU879vRwcJeYdVeYKha0Z/w aS7oJ7E8UMchHFpWbdYmW2AjgUmWdec= X-Google-Smtp-Source: APXvYqwRcyHCBBRggkAMpv2meqz6YSjHtNzq7M9/nIjgbgWrkzGIDx0sbnKQFKSFPrbmDh2Xzk5DJQ== X-Received: by 2002:a37:a98e:: with SMTP id s136mr2984690qke.253.1575933360837; Mon, 09 Dec 2019 15:16:00 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Mon, 9 Dec 2019 20:15:16 -0300 Message-Id: <20191209231531.2423222-12-danielhb413@gmail.com> In-Reply-To: <20191209231531.2423222-1-danielhb413@gmail.com> References: <20191209231531.2423222-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: DtXkbYWpPNeVsbOZjcpC3Q-1 X-MC-Unique: 8hVanUinMai2eOOUA5FTDg-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xB9NG3ua008422 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v1 11/26] qemu_command: move qemuBuildHubDevStr caps validation to qemu_domain X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Move QEMU caps validation of QEMU_CAPS_USB_HUB to a new function in qemu_domain.c, qemuDomainDeviceDefValidateHub(). This function is called by qemuDomainDeviceDefValidate() to validate the sound device in domain define time. qemuxml2xmltest.c was adjusted to add the now required caps for domain definition. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 13 ------------- src/qemu/qemu_domain.c | 26 +++++++++++++++++++++++++- tests/qemuxml2xmltest.c | 2 +- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3b4fae740c..0fa7f4693e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4736,19 +4736,6 @@ qemuBuildHubDevStr(const virDomainDef *def, { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; =20 - if (dev->type !=3D VIR_DOMAIN_HUB_TYPE_USB) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("hub type %s not supported"), - virDomainHubTypeToString(dev->type)); - return NULL; - } - - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_HUB)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("usb-hub not supported by QEMU binary")); - return NULL; - } - virBufferAddLit(&buf, "usb-hub"); virBufferAsprintf(&buf, ",id=3D%s", dev->info.alias); if (qemuBuildDeviceAddressStr(&buf, def, &dev->info, qemuCaps) < 0) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ee9de98df1..fe24e736e8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5299,6 +5299,27 @@ qemuDomainDeviceDefValidateSound(virDomainSoundDefPt= r sound, } =20 =20 +static int +qemuDomainDeviceDefValidateHub(virDomainHubDefPtr hub, + virQEMUCapsPtr qemuCaps) +{ + if (hub->type !=3D VIR_DOMAIN_HUB_TYPE_USB) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("hub type %s not supported"), + virDomainHubTypeToString(hub->type)); + return -1; + } + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_USB_HUB)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("usb-hub not supported by QEMU binary")); + return -1; + } + + return 0; +} + + static int qemuDomainDefValidate(const virDomainDef *def, void *opaque) @@ -7748,8 +7769,11 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef= *dev, ret =3D qemuDomainDeviceDefValidateSound(dev->data.sound, qemuCaps= ); break; =20 - case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_HUB: + ret =3D qemuDomainDeviceDefValidateHub(dev->data.hub, qemuCaps); + break; + + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_SHMEM: case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_PANIC: diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index f3fec5ee19..0145970774 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -520,7 +520,7 @@ mymain(void) DO_TEST("ppc64-usb-controller-legacy", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE, QEMU_CAPS_PIIX3_USB_UHCI); - DO_TEST("usb-port-missing", NONE); + DO_TEST("usb-port-missing", QEMU_CAPS_USB_HUB); DO_TEST("usb-redir", NONE); DO_TEST("usb-redir-filter", NONE); DO_TEST("usb-redir-filter-version", NONE); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list