From nobody Sat May 4 09:29:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1576629396; cv=none; d=zohomail.com; s=zohoarc; b=LqXdvTtBjE8N8VoxJ49Tbkj0MW5Ih0ccG3ynZob+E4neuCtW6r6hlkwzBUnKfuAbz+Gc1d1Sb5uH8gfEW7e/sNf+YYjYgPnZRLBYd1xE+C0ZqESKIeJbHy7bNKXrBgG189CCUdFiCYdDotm+YD+CrwENJmP3yzE6yzEUhCSOcI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576629396; 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=TBfNWGfh8VezPR4X0nKI4jc43+A6xtkaclWsz441AZI=; b=Q0ZZfDgE5kSEnSxjQXSGlTcyn/WkETdMYoP27ihyBUmRfMSEKTojsDECaafbc056vq1GjVCodU0vFYMLX35iLeLZ9KOL8iybBWKblWRcscbCqQQtqdf+u4rb/LEiJmmW9qGQPWchlI6xCxfAS8g+jpYJBWV4p1g31FyZDXPV0Y8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576629396594756.1580122146815; Tue, 17 Dec 2019 16:36:36 -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-407-spgck_n2NZqn-2b6GyxxJA-1; Tue, 17 Dec 2019 19:36:31 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DCCC3DB20; Wed, 18 Dec 2019 00:36:24 +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 25C161A7E3; Wed, 18 Dec 2019 00:36:23 +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 9FF6F104872; Wed, 18 Dec 2019 00:36:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBI0aHr7013584 for ; Tue, 17 Dec 2019 19:36:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7189920316DF; Wed, 18 Dec 2019 00:36:17 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C40B2026D67 for ; Wed, 18 Dec 2019 00:36:15 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 83732185B0AC for ; Wed, 18 Dec 2019 00:36:15 +0000 (UTC) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-249-8gDDYHLINuWJAv41z_Vqig-1; Tue, 17 Dec 2019 19:36:13 -0500 Received: by mail-qv1-f54.google.com with SMTP id t9so45167qvh.13; Tue, 17 Dec 2019 16:36:13 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:2f19:a73a:b6c3:c24a:90f3]) by smtp.gmail.com with ESMTPSA id m21sm96138qka.117.2019.12.17.16.36.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 16:36:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576629395; 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=TBfNWGfh8VezPR4X0nKI4jc43+A6xtkaclWsz441AZI=; b=ZAytz0qi+sAK/PGz4SN9NMyQxkoiTNFderoKfNP8dCdbQir38vqK/vuiBpvN+aGjnH4WHt gwGNN7ewRsTCofJ8rzcUrMw2xHekfhOi22oG6rOwHRP/JznwrpEjz6AZz/xir8Sn9gMLvF Co28xvwiVEtx/KD888urey8BOAh6/lU= 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=N1coR6a6vhMcV/ojphm1vwV2ozHCOmM6LGVsWLaPLBY=; b=ee3DnEvvaAdffm/0NEEYYu3oonmYduDD9i/Wk5LmfS3mIjnP+3j/iYcwDG8VD6xpDM 994yuPxS5HZyIOd/qMI35Qgx5PvdUjJ6Qs/L1ubtzoRSDxBvnVIRvclKHnLR4GmPl+WD 7Rh/cX9A4Xy54tReCwM/CZfz1bYPO/2K+Plp5npWl/N5bhXbE98bDXHxvrNp+ljiCrnz Fq8d/rC7hRkgMlUHvB2dYgIbkwt0T/sq8GcU9p45zstZVlTKzc4v/7iqZrahBNQKZcWr iRObw+htzhbHOlaQ9+RL8scYmOdXeN+qPN46LzcbW+Gb+E/IZ9EQE+NycsfrN2Emklij NRZw== X-Gm-Message-State: APjAAAUhULbQ6FnalzmkQF8qQh3rZpcANUlFOuYH8jK6KiS7TxfWiWJk /YbYrc6HM/UFi28VDRHZuaqgYxGd X-Google-Smtp-Source: APXvYqwRJJQDS8kHLsx+pahzpK2y5vGF2obPw8FnDPIK4fydbb6QhyErNC+/ut8h7dAGC+TYvoEsJw== X-Received: by 2002:a0c:ac4e:: with SMTP id m14mr505035qvb.37.1576629373130; Tue, 17 Dec 2019 16:36:13 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 21:36:00 -0300 Message-Id: <20191218003603.4047144-2-danielhb413@gmail.com> In-Reply-To: <20191218003603.4047144-1-danielhb413@gmail.com> References: <20191218003603.4047144-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: 8gDDYHLINuWJAv41z_Vqig-1 X-MC-Unique: spgck_n2NZqn-2b6GyxxJA-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBI0aHr7013584 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v2 1/4] qemu: command: move NVDIMM validation to qemu_domain.c 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.23 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 the NVDIMM validation from qemuBuildMachineCommandLine() to a new function in qemu_domain.c, qemuDomainDeviceDefValidateMemory(), which is called by qemuDomainDeviceDefValidate(). This allows NVDIMM validation to occur in domain define time. It also increments memory hotplug validation, which can be seen by the failures in the hotplug tests in qemuxml2xmltest.c that needed to be adjusted after the move. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 5 ----- src/qemu/qemu_domain.c | 18 +++++++++++++++++- tests/qemuxml2xmltest.c | 12 ++++++------ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 836057a4ff..3267b0d4b5 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6977,11 +6977,6 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, =20 for (i =3D 0; i < def->nmems; i++) { if (def->mems[i]->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("nvdimm isn't supported by this QEMU bina= ry")); - return -1; - } virBufferAddLit(&buf, ",nvdimm=3Don"); break; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 20a9629760..83964db595 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5637,6 +5637,19 @@ qemuDomainDeviceDefValidateSound(virDomainSoundDefPt= r sound, return 0; } =20 +static int +qemuDomainDeviceDefValidateMemory(virDomainMemoryDefPtr mem, + virQEMUCapsPtr qemuCaps) +{ + if (mem->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("nvdimm isn't supported by this QEMU binary")); + return -1; + } + + return 0; +} =20 static int qemuDomainDefValidate(const virDomainDef *def, @@ -8365,9 +8378,12 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef= *dev, ret =3D qemuDomainDeviceDefValidateSound(dev->data.sound, qemuCaps= ); break; =20 + case VIR_DOMAIN_DEVICE_MEMORY: + ret =3D qemuDomainDeviceDefValidateMemory(dev->data.memory, qemuCa= ps); + break; + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_SHMEM: - case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_PANIC: case VIR_DOMAIN_DEVICE_NONE: case VIR_DOMAIN_DEVICE_LAST: diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 55bbd924fb..60ae68c58c 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1221,12 +1221,12 @@ mymain(void) DO_TEST("memory-hotplug", NONE); DO_TEST("memory-hotplug-nonuma", NONE); DO_TEST("memory-hotplug-dimm", NONE); - DO_TEST("memory-hotplug-nvdimm", NONE); - DO_TEST("memory-hotplug-nvdimm-access", NONE); - DO_TEST("memory-hotplug-nvdimm-label", NONE); - DO_TEST("memory-hotplug-nvdimm-align", NONE); - DO_TEST("memory-hotplug-nvdimm-pmem", NONE); - DO_TEST("memory-hotplug-nvdimm-readonly", NONE); + DO_TEST("memory-hotplug-nvdimm", QEMU_CAPS_DEVICE_NVDIMM); + DO_TEST("memory-hotplug-nvdimm-access", QEMU_CAPS_DEVICE_NVDIMM); + DO_TEST("memory-hotplug-nvdimm-label", QEMU_CAPS_DEVICE_NVDIMM); + DO_TEST("memory-hotplug-nvdimm-align", QEMU_CAPS_DEVICE_NVDIMM); + DO_TEST("memory-hotplug-nvdimm-pmem", QEMU_CAPS_DEVICE_NVDIMM); + DO_TEST("memory-hotplug-nvdimm-readonly", QEMU_CAPS_DEVICE_NVDIMM); DO_TEST("net-udp", NONE); =20 DO_TEST("video-virtio-gpu-device", QEMU_CAPS_DEVICE_VIRTIO_GPU); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:29:08 2024 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=1576629394; cv=none; d=zohomail.com; s=zohoarc; b=HvpUn5bSoWM2HXy2CkBSuk4cqm9eaZ9zm351qFZTGhlYDNk2VoDgG2+T/eyGNu+y52QBqYUb1TpcS+4M4QI7Kfk7oTDTWjUHOt3SrwgsjLFou7/I2zp/garpUCCJwd7X0C/us/sz7nOBTrEUCM+Nnj0gW5oGbaTLGQXm39n4WhM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576629394; 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=UED/Pc+w0XOUpesys39/ZoSGk8kpqPX1hV1LVItzlcU=; b=bRtKRrvOpzCZX+WgN5dxTZU2dnWvFmjwvjo+yonvpjkXTf34wWZwgES62ysbBb7m1YHmmoALTC7WzhA+oE17Ak2O1bo4NCZOIbPi4b9mRApjUlwM77uQUP94Te5ramFSlWsjdvMfmTNDcVFT7Uz6Z4+9hn2hfN4DZAfDNmDRvXo= 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 1576629394304654.7544509925619; Tue, 17 Dec 2019 16:36:34 -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-150-8cLgMuXYN-6lWbpFTrTgJA-1; Tue, 17 Dec 2019 19:36:31 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5589107ACC7; Wed, 18 Dec 2019 00:36:24 +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 BE39A5D9E1; Wed, 18 Dec 2019 00:36:24 +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 E943B104908; Wed, 18 Dec 2019 00:36:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBI0aMPQ013614 for ; Tue, 17 Dec 2019 19:36:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1A14610E4D16; Wed, 18 Dec 2019 00:36:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 151D410E4D15 for ; Wed, 18 Dec 2019 00:36:20 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 06D8880207B for ; Wed, 18 Dec 2019 00:36:20 +0000 (UTC) Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-18-_5A3KPvROaSkCklf8iQHtA-1; Tue, 17 Dec 2019 19:36:15 -0500 Received: by mail-qt1-f171.google.com with SMTP id l12so481731qtq.12; Tue, 17 Dec 2019 16:36:15 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:2f19:a73a:b6c3:c24a:90f3]) by smtp.gmail.com with ESMTPSA id m21sm96138qka.117.2019.12.17.16.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 16:36:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576629392; 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=UED/Pc+w0XOUpesys39/ZoSGk8kpqPX1hV1LVItzlcU=; b=Oh7HZGCoFRD7w9A3WMGB0DKn/1BhQkvfvEzeP4zq8MHN1G1tiFUk8U8FmD8KEWzy/c6+Qh j3BeEW+9HKWX7Ly3jTgHKou6GQEbxy+9ps475WF7D3uPc3JLNuSeOMKXpRi8EbPSi8IDT8 ggjx68rhcx+SrOEIz9/51F0uwk0IcUo= 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=BwivIQMBcKlV4h6s++02SbLgp7GNmkn6wR2wcONeelM=; b=gLXQZrR+pK3Ek7Cl6s/+BKtCOpMxv8L+yU7P4WIQJVc3BOr8gsy+PZwf9NlUc5AbG4 mwl27TF7ISpKnwCGRaH0rGW1d3yD9w9wGij6EaEiQoi3imbZE+vEIOCqN4ERYQhdtXAk nIZBQz5LeblXN/NK7vpgMb5JJtof91B4lEgxCv7u4WUK/m4RJtpE5Ml5araqNBPJyR4e aLdk+dC1W243i9YkzWk7AU/QtKi1tdrZGeZtG7X+OVm5zM3FDTLGhAtYBa5GqzZ/Us11 IWb1ycarLYkFL+n3dUfy5PsaLyVUtlsbE54Y0HWcSnRUOQVmLJPkX1zS4GY8owvTSL9I 21Tg== X-Gm-Message-State: APjAAAVim5CV3k280VL7c5eV2G8lQLcThUi5Pno4cLx6CD/HRXZMfD5W MfRji7O36Hl4vOErqrnY8h5OhH3A X-Google-Smtp-Source: APXvYqwvZwcOU/jUntmhK5BJF8Hx4HqfWzP0tAxvzUBTKvETmpR7l+tH5NsWDcZChCX/0T9zPxaing== X-Received: by 2002:ac8:1415:: with SMTP id k21mr680539qtj.80.1576629374703; Tue, 17 Dec 2019 16:36:14 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 21:36:01 -0300 Message-Id: <20191218003603.4047144-3-danielhb413@gmail.com> In-Reply-To: <20191218003603.4047144-1-danielhb413@gmail.com> References: <20191218003603.4047144-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: _5A3KPvROaSkCklf8iQHtA-1 X-MC-Unique: 8cLgMuXYN-6lWbpFTrTgJA-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBI0aMPQ013614 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v2 2/4] qemu: command: move qemuBuildGraphicsEGLHeadlessCommandLine validation to qemu_domain.c 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.79 on 10.5.11.14 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 EGL Headless validation from qemuBuildGraphicsEGLHeadlessCommandLine() to qemuDomainDeviceDefValidateGraphics(). This function is called by qemuDomainDefValidate(), validating the graphics parameters in domain define time. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 10 +--------- src/qemu/qemu_domain.c | 8 ++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 3267b0d4b5..b3f069d5d4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7733,7 +7733,6 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfig= Ptr cfg, static int qemuBuildGraphicsEGLHeadlessCommandLine(virQEMUDriverConfigPtr cfg G_GNUC_= UNUSED, virCommandPtr cmd, - virQEMUCapsPtr qemuCaps, virDomainGraphicsDefPtr graphics) { g_auto(virBuffer) opt =3D VIR_BUFFER_INITIALIZER; @@ -7741,13 +7740,6 @@ qemuBuildGraphicsEGLHeadlessCommandLine(virQEMUDrive= rConfigPtr cfg G_GNUC_UNUSED virBufferAddLit(&opt, "egl-headless"); =20 if (graphics->data.egl_headless.rendernode) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_EGL_HEADLESS_RENDERNODE)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support OpenGL rendernode " - "with egl-headless graphics type")); - return -1; - } - virBufferAddLit(&opt, ",rendernode=3D"); virQEMUBuildBufferEscapeComma(&opt, graphics->data.egl_headless.renderno= de); @@ -7792,7 +7784,7 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr c= fg, break; case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS: if (qemuBuildGraphicsEGLHeadlessCommandLine(cfg, cmd, - qemuCaps, graphics= ) < 0) + graphics) < 0) return -1; =20 break; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 83964db595..fe353e5bc1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7941,6 +7941,14 @@ qemuDomainDeviceDefValidateGraphics(const virDomainG= raphicsDef *graphics, break; =20 case VIR_DOMAIN_GRAPHICS_TYPE_EGL_HEADLESS: + if (graphics->data.egl_headless.rendernode && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_EGL_HEADLESS_RENDERNODE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support OpenGL rendernode " + "with egl-headless graphics type")); + return -1; + } + break; case VIR_DOMAIN_GRAPHICS_TYPE_RDP: case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP: --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:29:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1576629395; cv=none; d=zohomail.com; s=zohoarc; b=Tmw7WGNGtSYnp4AtDyj1imtRdb7C6i2ToZyYqKFFgaF2D6QxyYEEkeO0dvZwgo0GvJOm6N3YKZYkNS2Ni1K2ItQzRhuDpgLjAxxiMvmhF8gVz8SEsH2876eGzafnR6jJ6mR4VC87XD7nvnhk171PXn/6VL//wIlG+40EkVZ+BFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576629395; 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=kHqzV+yXD21yaUBOYqezyLnMc9QQMu6nsuon0QIJg44=; b=OiBcnsafGtuzB88VNocaKj2JeEqBOS6K2cgpXaEKB4n30wCy/mLUmExl5tW41kCnIiZYjImV+MMvL2JzDFS+Iew1kh+WtQQM6meBWkkaLvvj2hNuvoVhYsXeqy3746q7L8LpufjPJ+jMGL8r6JKArfztnVRNefbzpgrJf53LDQk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576629395109481.34795674532563; Tue, 17 Dec 2019 16:36:35 -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-261-8DE9NAETO0OUy8RRPUp50A-1; Tue, 17 Dec 2019 19:36:31 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB1401005502; Wed, 18 Dec 2019 00:36:24 +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 85F9BA4B60; Wed, 18 Dec 2019 00:36:24 +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 3D2BD104905; Wed, 18 Dec 2019 00:36:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBI0aKaL013603 for ; Tue, 17 Dec 2019 19:36:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2A87120316E0; Wed, 18 Dec 2019 00:36:20 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2539A2026D67 for ; Wed, 18 Dec 2019 00:36:20 +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 0AF11801586 for ; Wed, 18 Dec 2019 00:36:20 +0000 (UTC) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-416-XuK9CRueOWazsfuPaetxNA-1; Tue, 17 Dec 2019 19:36:16 -0500 Received: by mail-qk1-f169.google.com with SMTP id c16so72758qko.6; Tue, 17 Dec 2019 16:36:16 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:2f19:a73a:b6c3:c24a:90f3]) by smtp.gmail.com with ESMTPSA id m21sm96138qka.117.2019.12.17.16.36.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 16:36:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576629393; 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=kHqzV+yXD21yaUBOYqezyLnMc9QQMu6nsuon0QIJg44=; b=BrZPRiMQsPjUyKj7T/gFxsjxiP/XoMPBK1Mmn/FY/Nl5mRzIpYmuFtbRenqtRbiRCoTlGY G1eHyzu+N97A9/x8yOIJmZZsPYSRPlxetv7WCLIGgavtJUhyPkNDnqqgFHSaT5+uHhzECW qrpvgd+FxSLo0SRhVr0gAjMPlayHbgQ= 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=uIyLXNe/F4ZEjyR+n6Mbh8+SzdQKRU9ZmMCKfmQNXXU=; b=cELzIx+p5ktXyN5P5bbjXbGirkQKSQMXsKtTG4iKulXMIoTJsNMkcayMTtPnaHu+hA UV4aed4dI/vJw46PgC/dUidy8wXAe0i2PbmyByR3X+Hqp/emaMwRCiADdNRfJgNQXbOs B2btM9rNL6mrZ8OdKQ3twO5WBhl1d6A/uLEmJtMWl41QOX7fDP+Ci9tp+FO5n8PNvdUA UFYApy7QJ0/T3vn5OY3ACpsj/cXZOOQA9A/1LoHQeamgnLwnan71sGGPgf25/y251n0h mEKA+YDafefeOXrwJc+xceOkbOPPiODvjd/21b1Ro0B7oJO7mmt4c4zyIcZh7Jc2m4Aj iGkA== X-Gm-Message-State: APjAAAXbv1cbTvUwNjUBjXZBSVmJwzs6vP1Yc3xdvVwnOrP5J9rAG9ZQ ueHlcKrOMPxTXGJBf//eddgwT1KJ X-Google-Smtp-Source: APXvYqz7EW3CCgx0tmcQFkotZXRkYHl5vvECRSv/1j1F0ZR6NB45eyhLNDI/F4Y9oKdoLZi+KyxSTw== X-Received: by 2002:a37:bc04:: with SMTP id m4mr921687qkf.224.1576629376209; Tue, 17 Dec 2019 16:36:16 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 21:36:02 -0300 Message-Id: <20191218003603.4047144-4-danielhb413@gmail.com> In-Reply-To: <20191218003603.4047144-1-danielhb413@gmail.com> References: <20191218003603.4047144-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: XuK9CRueOWazsfuPaetxNA-1 X-MC-Unique: 8DE9NAETO0OUy8RRPUp50A-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBI0aKaL013603 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v2 3/4] qemu: move qemuBuildSmartcardCommandLine validation to qemu_domain.c 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.79 on 10.5.11.13 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 smartcard validation being done by qemuBuildSmartcardCommandLine() to the existing qemuDomainSmartcardDefValidate() function. This function is called by qemuDomainDeviceDefValidate(), allowing smartcard validation in domain define time. Tests were adapted to consider the new caps being needed in this earlier stage. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 24 ------------------------ src/qemu/qemu_domain.c | 33 +++++++++++++++++++++++++++++++++ tests/qemuxml2xmltest.c | 16 +++++++++------- 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b3f069d5d4..67f7caf9c6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8275,24 +8275,10 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logM= anager, =20 switch (smartcard->type) { case VIR_DOMAIN_SMARTCARD_TYPE_HOST: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks smartcard host " - "mode support")); - return -1; - } - virBufferAddLit(&opt, "ccid-card-emulated,backend=3Dnss-emulated"); break; =20 case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks smartcard host " - "mode support")); - return -1; - } - virBufferAddLit(&opt, "ccid-card-emulated,backend=3Dcertificates"); for (i =3D 0; i < VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES; i++) { virBufferAsprintf(&opt, ",cert%zu=3D", i + 1); @@ -8308,13 +8294,6 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logMa= nager, break; =20 case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_PASSTHRU)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU binary lacks smartcard " - "passthrough mode support")); - return -1; - } - if (!(devstr =3D qemuBuildChrChardevStr(logManager, secManager, cmd, cfg, def, smartcard->data.passthru, @@ -8330,9 +8309,6 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logMan= ager, break; =20 default: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected smartcard type %d"), - smartcard->type); return -1; } =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index fe353e5bc1..f6683d11e0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6156,6 +6156,39 @@ static int qemuDomainSmartcardDefValidate(const virDomainSmartcardDef *def, virQEMUCapsPtr qemuCaps) { + switch (def->type) { + case VIR_DOMAIN_SMARTCARD_TYPE_HOST: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks smartcard host " + "mode support")); + return -1; + } + break; + + case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks smartcard host " + "mode support")); + return -1; + } + break; + + case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCID_PASSTHRU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks smartcard " + "passthrough mode support")); + return -1; + } + break; + + default: + virReportEnumRangeError(virDomainSmartcardType, def->type); + return -1; + } + if (def->type =3D=3D VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH && qemuDomainChrSourceDefValidate(def->data.passthru, qemuCaps) < 0) return -1; diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 60ae68c58c..64321bcb80 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1332,12 +1332,13 @@ mymain(void) DO_TEST("cpu-check-default-partial2", NONE); DO_TEST("vmcoreinfo", NONE); =20 - DO_TEST("smartcard-host", NONE); - DO_TEST("smartcard-host-certificates", NONE); - DO_TEST("smartcard-host-certificates-database", NONE); - DO_TEST("smartcard-passthrough-tcp", NONE); - DO_TEST("smartcard-passthrough-spicevmc", NONE); - DO_TEST("smartcard-controller", NONE); + DO_TEST("smartcard-host", QEMU_CAPS_CCID_EMULATED); + DO_TEST("smartcard-host-certificates", QEMU_CAPS_CCID_EMULATED); + DO_TEST("smartcard-host-certificates-database", + QEMU_CAPS_CCID_EMULATED); + DO_TEST("smartcard-passthrough-tcp", QEMU_CAPS_CCID_PASSTHRU); + DO_TEST("smartcard-passthrough-spicevmc", QEMU_CAPS_CCID_PASSTHRU); + DO_TEST("smartcard-controller", QEMU_CAPS_CCID_EMULATED); =20 DO_TEST("pseries-cpu-compat-power9", QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE); @@ -1352,7 +1353,8 @@ mymain(void) QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4, - QEMU_CAPS_VNC); + QEMU_CAPS_VNC, + QEMU_CAPS_CCID_EMULATED); DO_TEST("input-virtio-ccw", QEMU_CAPS_CCW, QEMU_CAPS_VIRTIO_KEYBOARD, --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 09:29:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1576629405; cv=none; d=zohomail.com; s=zohoarc; b=hDnvwPnNyHNE6mHxIvVDFOxQwzBotjItuhgxsB0NFn2loyaKssqiM2mpr9CgxPvtpwEENOpOMF/X0Umme72auwD3DtWxcuuLPWlKxSI7gleppB5V9yQrQzZ0hCiloSm8o8F4E4dwPfHYfP5yqLu62U9AvLM3j568SaAl/3BfT74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576629405; 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=SmLAtDCyoRvLKlXC7wIPxuaWmePl8DIPF94MQC7qsjY=; b=SVngTYeiPW1SmgLNfaQTsMdCCk+Jo87rLfd2GNlCBAh9kYgWGo111QCSYZZH5nTkUBv8wwoMZJ+vkmNN2b10FU7NbqTUvTUYg6V9X/7pXYqlKb55epIpKKA3innXGFSxhnYuFCUhILDVQlXML6XZPKu2kFbpvSAkqb9u5sVdfEA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1576629405594879.0311870839488; Tue, 17 Dec 2019 16:36:45 -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-313-WT7ZhSCiOXOy7HkZNujYmw-1; Tue, 17 Dec 2019 19:36:42 -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 10207DBBC; Wed, 18 Dec 2019 00:36:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D491B10016E8; Wed, 18 Dec 2019 00:36:36 +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 8F58B1809567; Wed, 18 Dec 2019 00:36:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBI0aMIh013618 for ; Tue, 17 Dec 2019 19:36:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 638FC10E4D18; Wed, 18 Dec 2019 00:36:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E67810E4D15 for ; Wed, 18 Dec 2019 00:36:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 3D21D8F837F for ; Wed, 18 Dec 2019 00:36:22 +0000 (UTC) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-381-rcssnwIDNJydrRx-SdjpFg-1; Tue, 17 Dec 2019 19:36:18 -0500 Received: by mail-qt1-f193.google.com with SMTP id q20so526639qtp.3; Tue, 17 Dec 2019 16:36:18 -0800 (PST) Received: from rekt.ibmuc.com ([2804:431:c7c6:2f19:a73a:b6c3:c24a:90f3]) by smtp.gmail.com with ESMTPSA id m21sm96138qka.117.2019.12.17.16.36.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2019 16:36:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576629404; 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=SmLAtDCyoRvLKlXC7wIPxuaWmePl8DIPF94MQC7qsjY=; b=Wfcjbml79riGk0UwHdxdPfcuHiEVNCQlcvO8vNbNIPMQUuO095fYSIFO995LonTO1Dq1Tr K5X85qsG6Evrb4uL2GlYpfHGC0TMBuHdgJJZ7F+41YT4bVXXHOHgphSlIIr5TGnQ9G8seS xydhM2mFKc0i0kyePHpGTxkN5kl6tlQ= 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=epwUSpfqA2Zr5978dwMP1MGENLl9OgxJRE2NTaVAMjo=; b=jZZmh7gFrQYQA3BYX99UUpEisKGRq9iDtsWDwY9hSEtPcP+h1yvnJlwmsTUf0TfM3T j/P9dnzkeTE787Rvj1B6HmXMRCkuq4Mu+vCJQ3s4fV1o8/2T/dyUj+aVbtLB6yMmldwY HA/UKN5Ww2C+j346Ee3KkApOg+Gqj6BTEdsH7UfQjLTfR/+dOLECn8mkR/elL/n35ywz dSzB2CKEuIHlkqTjCj1j70Vy2dROtF3VHhX16+tcCp/kKKHNuhTgduqtVWtz2n+OecT0 +AfZak89EyywYhPn9XXJZ95c2fRNA4yV1KF2PWbjdqWGqI3JYkcsIjU37cUTIofy5tka +RoQ== X-Gm-Message-State: APjAAAU1x+tHfPb4iI0BmXh3A+TG3LkxrvmTOZfhz8/4U1v5DQ4MO5tH 9k21bSrZNtCZDubYPmAz/a2f6N/g X-Google-Smtp-Source: APXvYqxudiOc15iTsb3oYN2ZL17+qHDDnpu6HX2wgy/MPtM3XMuh1ruuy88vHhT4U67rKNB+8HsVfA== X-Received: by 2002:ac8:708f:: with SMTP id y15mr653624qto.185.1576629377762; Tue, 17 Dec 2019 16:36:17 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Date: Tue, 17 Dec 2019 21:36:03 -0300 Message-Id: <20191218003603.4047144-5-danielhb413@gmail.com> In-Reply-To: <20191218003603.4047144-1-danielhb413@gmail.com> References: <20191218003603.4047144-1-danielhb413@gmail.com> MIME-Version: 1.0 X-MC-Unique: rcssnwIDNJydrRx-SdjpFg-1 X-MC-Unique: WT7ZhSCiOXOy7HkZNujYmw-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBI0aMIh013618 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza , crobinso@redhat.com Subject: [libvirt] [PATCH v2 4/4] qemu: command: move validation of vmcoreinfo to qemu_domain.c 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 the validation of vmcoreinfo from qemuBuildVMCoreInfoCommandLine() to qemuDomainDefValidateFeatures(), allowing for validation at domain define time. qemuxml2xmltest.c was changed to account for this caps being now validated at this earlier stage. Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 12 ++---------- src/qemu/qemu_domain.c | 11 ++++++++++- tests/qemuxml2xmltest.c | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 67f7caf9c6..44cc647359 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9217,21 +9217,13 @@ qemuBuildSEVCommandLine(virDomainObjPtr vm, virComm= andPtr cmd, =20 static int qemuBuildVMCoreInfoCommandLine(virCommandPtr cmd, - const virDomainDef *def, - virQEMUCapsPtr qemuCaps) + const virDomainDef *def) { virTristateSwitch vmci =3D def->features[VIR_DOMAIN_FEATURE_VMCOREINFO= ]; =20 if (vmci !=3D VIR_TRISTATE_SWITCH_ON) return 0; =20 - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMCOREINFO)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("vmcoreinfo is not available " - "with this QEMU binary")); - return -1; - } - virCommandAddArgList(cmd, "-device", "vmcoreinfo", NULL); return 0; } @@ -9933,7 +9925,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, if (qemuBuildNVRAMCommandLine(cmd, def) < 0) return NULL; =20 - if (qemuBuildVMCoreInfoCommandLine(cmd, def, qemuCaps) < 0) + if (qemuBuildVMCoreInfoCommandLine(cmd, def) < 0) return NULL; =20 if (qemuBuildSEVCommandLine(vm, cmd, def->sev) < 0) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f6683d11e0..2dbe6f6454 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5149,6 +5149,16 @@ qemuDomainDefValidateFeatures(const virDomainDef *de= f, } break; =20 + case VIR_DOMAIN_FEATURE_VMCOREINFO: + if (def->features[i] =3D=3D VIR_TRISTATE_SWITCH_ON && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMCOREINFO)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("vmcoreinfo is not available " + "with this QEMU binary")); + return -1; + } + break; + case VIR_DOMAIN_FEATURE_ACPI: case VIR_DOMAIN_FEATURE_APIC: case VIR_DOMAIN_FEATURE_PAE: @@ -5159,7 +5169,6 @@ qemuDomainDefValidateFeatures(const virDomainDef *def, case VIR_DOMAIN_FEATURE_PVSPINLOCK: case VIR_DOMAIN_FEATURE_CAPABILITIES: case VIR_DOMAIN_FEATURE_PMU: - case VIR_DOMAIN_FEATURE_VMCOREINFO: case VIR_DOMAIN_FEATURE_MSRS: case VIR_DOMAIN_FEATURE_LAST: break; diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 64321bcb80..5ab00e5552 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1330,7 +1330,7 @@ mymain(void) DO_TEST("cpu-check-default-none2", NONE); DO_TEST("cpu-check-default-partial", NONE); DO_TEST("cpu-check-default-partial2", NONE); - DO_TEST("vmcoreinfo", NONE); + DO_TEST("vmcoreinfo", QEMU_CAPS_DEVICE_VMCOREINFO); =20 DO_TEST("smartcard-host", QEMU_CAPS_CCID_EMULATED); DO_TEST("smartcard-host-certificates", QEMU_CAPS_CCID_EMULATED); --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list