From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004009; cv=none; d=zohomail.com; s=zohoarc; b=d4kwGVEW/XHTlHHzBUGwFja3p6GAR+sqjWvXhlPK5O+dk5UUbUg/1Ka3Yhw1ejyL4POzGZ3+9ENBV7d7IIdhASJWlcIWjCCIm/KOF6I4tiAcBpwgwM21xI7KS2PmQT4m/JlNx19lxD0mCCxKQU0GOO7J/w7SxP22fiuuEBZs0HA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004009; h=Content-Type:Content-Transfer-Encoding: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=NB2m9s3/7qisLpLb1JeHlkx25FVIV+hHJkXqwmqapA8=; b=FJVdSFCuI1mB3FmwqEK/dx63xvAc1NiLJcpePL5OW2OFC7gGsgP6w0ZO+/MddtQCFjiwVPsi3lmZMX0/cAxaSv6A1CzBjdpIPUhbfe1pSszxHgwdkcVwrSmQvH3HCqq7SRgR0sZv5tcTauPkFafxxcr6nqViwjQl6zHfEC22Wv0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618004009098117.95038580605899; Fri, 9 Apr 2021 14:33:29 -0700 (PDT) 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-291-bYA3yJvGOyuFcTNhdmRsrA-1; Fri, 09 Apr 2021 17:33:24 -0400 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 E521D814337; Fri, 9 Apr 2021 21:33:18 +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 542F31007604; Fri, 9 Apr 2021 21:33:17 +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 5E7271806D10; Fri, 9 Apr 2021 21:33:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXC9A032603 for ; Fri, 9 Apr 2021 17:33:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 086355D6AD; Fri, 9 Apr 2021 21:33:12 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF02F5D6A1 for ; Fri, 9 Apr 2021 21:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004007; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=NB2m9s3/7qisLpLb1JeHlkx25FVIV+hHJkXqwmqapA8=; b=SApeVhE6ss4KZ8Elh7hKxufkGx+RLHcmfR+5eXc2sd0QeD5mJOIKGTQ+aEemjVXJgTGxPN K9EHqUUSjy9RHtWouvzDjhWITG88NFi44vvkRx5utb/O7BbdOrj5VNMfTlxDtQGawsYhJb JEfSRNqqvxpfZyso2XdfEzqpLySl/ew= X-MC-Unique: bYA3yJvGOyuFcTNhdmRsrA-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 01/11] nodedev: don't log error in nodeDeviceFindAddressByName() Date: Fri, 9 Apr 2021 16:32:56 -0500 Message-Id: <20210409213306.3971286-2-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The calling function will log the error. Just return NULL if a device cannot be found. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index c11b8d89ab..cb90401d0a 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -630,11 +630,8 @@ nodeDeviceFindAddressByName(const char *name) char *addr =3D NULL; virNodeDeviceObjPtr dev =3D virNodeDeviceObjListFindByName(driver->dev= s, name); =20 - if (!dev) { - virReportError(VIR_ERR_NO_NODE_DEVICE, - _("could not find device '%s'"), name); + if (!dev) return NULL; - } =20 def =3D virNodeDeviceObjGetDef(dev); for (caps =3D def->caps; caps !=3D NULL; caps =3D caps->next) { --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004023; cv=none; d=zohomail.com; s=zohoarc; b=Qxlpuv2oURLNayQAxuUjjeC3XahpLTY/bN3fLv24H+aCEYtAafmitoGni5DL66hRIOjDomC5oJMXglmiTnL5NiOIPo9ug0h7gTFJUAojE7XiZnYr962TQunJwVkruGvuLhVJYA3ebKlgR/xa+EwKo2zoDUBUbjS4kh2klalE+es= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004023; h=Content-Type:Content-Transfer-Encoding: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=/vB8rM04CY7pSE/sR8B42T9OBiwLoDRTU51XEHdwILY=; b=UM9GKFmIA2Z5vKRWF498jh90C4Bm11jJ/Sdf6P3dohtvhxsFXxv71vBtUxsDr2fvTC70s+AMMdvJ6q6Oe7U+sOWIOoNogP98v7przu+1b9myBdV39zIygNOhLeG4JVzSRYTUDBZH6qudkY7GjxgSnMq/zQBnj2sqF495SHCyTTw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618004023286873.1257675740512; Fri, 9 Apr 2021 14:33:43 -0700 (PDT) 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-435-ZtmNPFl1MC6qrrYB5Kz7Vw-1; Fri, 09 Apr 2021 17:33:39 -0400 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 0DDC91922979; Fri, 9 Apr 2021 21:33:34 +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 DD0E61B5F8; Fri, 9 Apr 2021 21:33:33 +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 9F35744A5B; Fri, 9 Apr 2021 21:33:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXCnZ032608 for ; Fri, 9 Apr 2021 17:33:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 521645D6AD; Fri, 9 Apr 2021 21:33:12 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2447A5D6A1 for ; Fri, 9 Apr 2021 21:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004022; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=/vB8rM04CY7pSE/sR8B42T9OBiwLoDRTU51XEHdwILY=; b=V2alXhBHmqQeS8sK6VVBzREeA0sHPcWU54/3Ht7MREJxDZsu4lHyL+XcHJDOHhmnqUXSse hv732zZ0eDMYO8HZgbfQAkmLZOWOSWUdKcK1YybxOffFAjmJFYPK3E4/wLI83M0X27NTL4 2yEgUqBA13chbxmP5dNxzg1U/iwzWaI= X-MC-Unique: ZtmNPFl1MC6qrrYB5Kz7Vw-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 02/11] nodedev: avoid use of VIR_ERR_NO_* errors internally Date: Fri, 9 Apr 2021 16:32:57 -0500 Message-Id: <20210409213306.3971286-3-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" These errors are demoted to debug statements[1] since they're only intended to be used as return values for public APIs. This makes it difficult to debug the problem when something goes wrong since no error message is logged. Switch instead to VIR_ERR_INTERNAL_ERROR so that the error is logged as expected. [1] See the implementation of daemonErrorLogFilter() for details: https://gitlab.com/libvirt/libvirt/-/blob/e2f82a3704f680fbb37a733476d870c19= 232c23e/src/remote/remote_daemon.c#L89 Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index cb90401d0a..8578f50e93 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -709,7 +709,7 @@ nodeDeviceGetMdevctlDefineStartCommand(virNodeDeviceDef= *def, g_autofree char *parent_addr =3D nodeDeviceFindAddressByName(def->pare= nt); =20 if (!parent_addr) { - virReportError(VIR_ERR_NO_NODE_DEVICE, + virReportError(VIR_ERR_INTERNAL_ERROR, _("unable to find parent device '%s'"), def->parent= ); return NULL; } --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004027; cv=none; d=zohomail.com; s=zohoarc; b=NCJSYOT4b/6dnCVgfw7oCKmL46iePiK84PLg5CoGaoxTVwiZqPiRbx/PPNxcWiuGQtpVhXQ7gO6KE8aWsb+0yg9EKGhWNh3b9Z56e3Zew1J1IvG4KdSVkzL9T6DdmGOVxg9hqimWalvx/m6G0k1O/48Dqv5WnqCcrbN59BNx588= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004027; h=Content-Type:Content-Transfer-Encoding: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=/1UFM3Qo2ehMTOpsJRMMSPGgozXfEEyatCo5bzsLXsI=; b=dJgvIoHE6lupnBOTcnoyaU8iN6ahRzq1mP2XqWhOYNTE+qz0WUn5RsLq0QWyrEmuhlMhCjuLOQw6Y52HpoSt0GUJVFexRx0r3PwWSjcpBEac0W6f7xkOce08y+J42dordVyUNO6Stzp2e4BNso040Jc1iNmCZ6WRPOwNiGRnWKI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1618004027075319.7130238308346; Fri, 9 Apr 2021 14:33:47 -0700 (PDT) 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-146-CQ-xxdg7O5i0x53mjissLg-1; Fri, 09 Apr 2021 17:33:43 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F1571006C80; Fri, 9 Apr 2021 21:33: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 E00FB5C3E4; Fri, 9 Apr 2021 21:33: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 A43A41806D1D; Fri, 9 Apr 2021 21:33:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXCHn032613 for ; Fri, 9 Apr 2021 17:33:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9C1835D6AD; Fri, 9 Apr 2021 21:33:12 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E6B45D6A1 for ; Fri, 9 Apr 2021 21:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004026; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=/1UFM3Qo2ehMTOpsJRMMSPGgozXfEEyatCo5bzsLXsI=; b=MnN8P/D6gudbiTjt7/HGDAq60+25KGqBMShklkYSTiudZZ6TuQ52vswuuk/AbY+GQJbEOj zonMZ6FyQWqgvn1JDkXuXVvQ8KRV14tneIE+y/Ab7nCvDSmj9PqjzxlzjUb7pO/TRHq21r G1ckuwdqjbUQC8fzt7YtjGH0D9hnWqY= X-MC-Unique: CQ-xxdg7O5i0x53mjissLg-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 03/11] tests: nodedev: switch all test macros to accept a filename Date: Fri, 9 Apr 2021 16:32:58 -0500 Message-Id: <20210409213306.3971286-4-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Rather than specifying a UUID string to some test macros, just pass a filename to an xml definition. This helps work toward unifying the test macros and making it more maintainable. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctldata/mdevctl-create.argv | 2 +- tests/nodedevmdevctldata/mdevctl-stop.argv | 2 +- .../nodedevmdevctldata/mdevctl-undefine.argv | 2 +- tests/nodedevmdevctltest.c | 34 ++++++++++++------- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/tests/nodedevmdevctldata/mdevctl-create.argv b/tests/nodedevmd= evctldata/mdevctl-create.argv index 802109340c..dc0ae7be0e 100644 --- a/tests/nodedevmdevctldata/mdevctl-create.argv +++ b/tests/nodedevmdevctldata/mdevctl-create.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ start -u 8a05ad83-3472-497d-8631-8142f31460e8 +$MDEVCTL_BINARY$ start -u d069d019-36ea-4111-8f0a-8c9a70e21366 diff --git a/tests/nodedevmdevctldata/mdevctl-stop.argv b/tests/nodedevmdev= ctldata/mdevctl-stop.argv index 3dbaab671b..5bdb213a32 100644 --- a/tests/nodedevmdevctldata/mdevctl-stop.argv +++ b/tests/nodedevmdevctldata/mdevctl-stop.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ stop -u e2451f73-c95b-4124-b900-e008af37c576 +$MDEVCTL_BINARY$ stop -u d069d019-36ea-4111-8f0a-8c9a70e21366 diff --git a/tests/nodedevmdevctldata/mdevctl-undefine.argv b/tests/nodedev= mdevctldata/mdevctl-undefine.argv index 54717455f7..c2236727ef 100644 --- a/tests/nodedevmdevctldata/mdevctl-undefine.argv +++ b/tests/nodedevmdevctldata/mdevctl-undefine.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ undefine -u d76a6b78-45ed-4149-a325-005f9abc5281 +$MDEVCTL_BINARY$ undefine -u d069d019-36ea-4111-8f0a-8c9a70e21366 diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 050424116f..a95bdf6d6e 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -140,20 +140,25 @@ testMdevctlStartOrDefineHelper(const void *data) =20 typedef virCommand* (*GetStopUndefineCmdFunc)(const char *uuid, char **err= buf); struct UuidCommandTestInfo { - const char *uuid; + const char *filename; MdevctlCmd command; }; =20 static int -testMdevctlUuidCommand(const char *uuid, GetStopUndefineCmdFunc func, cons= t char *outfile) +testMdevctlUuidCommand(GetStopUndefineCmdFunc func, + const char *mdevxml, const char *outfile) { + g_autoptr(virNodeDeviceDef) def =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; const char *actualCmdline =3D NULL; int ret =3D -1; g_autoptr(virCommand) cmd =3D NULL; g_autofree char *errmsg =3D NULL; =20 - cmd =3D func(uuid, &errmsg); + if (!(def =3D virNodeDeviceDefParseFile(mdevxml, EXISTING_DEVICE, "QEM= U"))) + goto cleanup; + + cmd =3D func(def->caps->data.mdev.uuid, &errmsg); =20 if (!cmd) goto cleanup; @@ -182,6 +187,7 @@ testMdevctlUuidCommandHelper(const void *data) GetStopUndefineCmdFunc func; const char *cmd; g_autofree char *cmdlinefile =3D NULL; + g_autofree char *mdevxml =3D NULL; =20 if (info->command =3D=3D MDEVCTL_CMD_STOP) { cmd =3D "stop"; @@ -196,10 +202,12 @@ testMdevctlUuidCommandHelper(const void *data) return -1; } =20 + mdevxml =3D g_strdup_printf("%s/nodedevschemadata/%s.xml", abs_srcdir, + info->filename); cmdlinefile =3D g_strdup_printf("%s/nodedevmdevctldata/mdevctl-%s.argv= ", abs_srcdir, cmd); =20 - return testMdevctlUuidCommand(info->uuid, func, cmdlinefile); + return testMdevctlUuidCommand(func, mdevxml, cmdlinefile); } =20 static int @@ -427,14 +435,14 @@ mymain(void) } \ while (0) =20 -#define DO_TEST_STOP(uuid) \ - DO_TEST_UUID_COMMAND_FULL("mdevctl stop " uuid, uuid, MDEVCTL_CMD_STOP) +#define DO_TEST_STOP(filename) \ + DO_TEST_UUID_COMMAND_FULL("mdevctl stop " filename, filename, MDEVCTL_= CMD_STOP) =20 -#define DO_TEST_UNDEFINE(uuid) \ - DO_TEST_UUID_COMMAND_FULL("mdevctl undefine " uuid, uuid, MDEVCTL_CMD_= UNDEFINE) +#define DO_TEST_UNDEFINE(filename) \ + DO_TEST_UUID_COMMAND_FULL("mdevctl undefine " filename, filename, MDEV= CTL_CMD_UNDEFINE) =20 -#define DO_TEST_CREATE(uuid) \ - DO_TEST_UUID_COMMAND_FULL("mdevctl create " uuid, uuid, MDEVCTL_CMD_CR= EATE) +#define DO_TEST_CREATE(filename) \ + DO_TEST_UUID_COMMAND_FULL("mdevctl create " filename, filename, MDEVCT= L_CMD_CREATE) =20 #define DO_TEST_LIST_DEFINED() \ DO_TEST_FULL("mdevctl list --defined", testMdevctlListDefined, NULL) @@ -448,7 +456,7 @@ mymain(void) DO_TEST_START("mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9"); =20 /* Test mdevctl stop command, pass an arbitrary uuid */ - DO_TEST_STOP("e2451f73-c95b-4124-b900-e008af37c576"); + DO_TEST_STOP("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366"); =20 DO_TEST_LIST_DEFINED(); =20 @@ -458,9 +466,9 @@ mymain(void) DO_TEST_DEFINE("mdev_fedc4916_1ca8_49ac_b176_871d16c13076"); DO_TEST_DEFINE("mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9"); =20 - DO_TEST_UNDEFINE("d76a6b78-45ed-4149-a325-005f9abc5281"); + DO_TEST_UNDEFINE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366"); =20 - DO_TEST_CREATE("8a05ad83-3472-497d-8631-8142f31460e8"); + DO_TEST_CREATE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366"); =20 done: nodedevTestDriverFree(driver); --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004031; cv=none; d=zohomail.com; s=zohoarc; b=AEsOZNByLJF9CCLULP/8N8ADCtNH+OQo2BqNKK8ZijZ+9OK6KhEamIlG9csFfwoJBcTvhs+2A7LHhescoGmF4q34I3bQssNspJgoeoknl27EtFN19P76NEqnCnPOCzCwO5ASTklXwJElmPepgUnT53JNeHrh7Uh7SOK86ADo9PY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004031; 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=KRhQHmsfbEk+eep9litI/iRIP6nueR/4v7ifPqiP4+k=; b=AjK9/lbesUpPBwrgWW9/i3OC0Mqkw1sH6Nu2vN2aTBfTjJ8wGfhP3z+lTGv/UztjZHNbsQPEHyZ+EU+9qY76VtwIpVP7Nbk3vtFPVpvhY5iO09rF7DIT0pktb/UU6sZi37Jb9SnLQKV55DHKva5BDipUWCxKd4zVMDCqUlPQ8CQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1618004031757737.9453712587131; Fri, 9 Apr 2021 14:33:51 -0700 (PDT) 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-466-9IDLnxGgP7-moFbQXLxT8g-1; Fri, 09 Apr 2021 17:33:48 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 41CAC1084427; Fri, 9 Apr 2021 21:33:40 +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 1C95C60C05; Fri, 9 Apr 2021 21:33:40 +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 D67FA55350; Fri, 9 Apr 2021 21:33:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXDKx032618 for ; Fri, 9 Apr 2021 17:33:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0EC8F5D6AD; Fri, 9 Apr 2021 21:33:13 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B96575D6A1; Fri, 9 Apr 2021 21:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004030; 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=KRhQHmsfbEk+eep9litI/iRIP6nueR/4v7ifPqiP4+k=; b=UbeqMC5BHTRdI+XObGX6dSoRMJAgHaBoTuUmHIV+zmRJBL2xXwv8DuXcwPOfv/MasUZYcA GFt02E/7nzCBjbv2JZsE8mRx2Dcc9BOLlK0E6DSUW7SEsFek9NaAS0thVvnxHOiTjk2AnE 2IWwRei3frW4D7G+cBDEPiFlOMZUSiw= X-MC-Unique: 9IDLnxGgP7-moFbQXLxT8g-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 04/11] nodedev: driver: Swap virMdevctlStart and virMdevctlCreate Date: Fri, 9 Apr 2021 16:32:59 -0500 Message-Id: <20210409213306.3971286-5-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Erik Skultety 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Erik Skultety "start" in libvirt means - "take this object and create an instance out of it" "create" in libvirt most of the time means - "take and XML description, make an object out of it and use it to create an instance" This gets confusing with mdevctl which uses "start" for both. So, this patch proposes to use virMdevctlStart in cases where from libvirt's POV we're starting a defined device (unlike mdevctl). Analogically, use virMdevctlCreate in scenarios where XML description is passed to libvirt and a transient device is supposed to be created. Signed-off-by: Erik Skultety Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 34 ++++++------- src/node_device/node_device_driver.h | 10 ++-- ...9_36ea_4111_8f0a_8c9a70e21366-create.argv} | 0 ...9_36ea_4111_8f0a_8c9a70e21366-create.json} | 0 ...9_495e_4243_ad9f_beb3f14c23d9-create.argv} | 0 ...9_495e_4243_ad9f_beb3f14c23d9-create.json} | 0 ...6_1ca8_49ac_b176_871d16c13076-create.argv} | 0 ...6_1ca8_49ac_b176_871d16c13076-create.json} | 0 ...mdevctl-create.argv =3D> mdevctl-start.argv} | 0 tests/nodedevmdevctltest.c | 49 +++++++++---------- 10 files changed, 46 insertions(+), 47 deletions(-) rename tests/nodedevmdevctldata/{mdev_d069d019_36ea_4111_8f0a_8c9a70e21366= -start.argv =3D> mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-create.argv} (10= 0%) rename tests/nodedevmdevctldata/{mdev_d069d019_36ea_4111_8f0a_8c9a70e21366= -start.json =3D> mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-create.json} (10= 0%) rename tests/nodedevmdevctldata/{mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9= -start.argv =3D> mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-create.argv} (10= 0%) rename tests/nodedevmdevctldata/{mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9= -start.json =3D> mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-create.json} (10= 0%) rename tests/nodedevmdevctldata/{mdev_fedc4916_1ca8_49ac_b176_871d16c13076= -start.argv =3D> mdev_fedc4916_1ca8_49ac_b176_871d16c13076-create.argv} (10= 0%) rename tests/nodedevmdevctldata/{mdev_fedc4916_1ca8_49ac_b176_871d16c13076= -start.json =3D> mdev_fedc4916_1ca8_49ac_b176_871d16c13076-create.json} (10= 0%) rename tests/nodedevmdevctldata/{mdevctl-create.argv =3D> mdevctl-start.ar= gv} (100%) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 8578f50e93..3236dd7bc3 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -699,10 +699,10 @@ nodeDeviceFindAddressByName(const char *name) * arguments, so provide a common implementation that can be wrapped by a = more * specific function */ static virCommand* -nodeDeviceGetMdevctlDefineStartCommand(virNodeDeviceDef *def, - const char *subcommand, - char **uuid_out, - char **errmsg) +nodeDeviceGetMdevctlDefineCreateCommand(virNodeDeviceDef *def, + const char *subcommand, + char **uuid_out, + char **errmsg) { virCommandPtr cmd; g_autofree char *json =3D NULL; @@ -737,12 +737,12 @@ nodeDeviceGetMdevctlDefineStartCommand(virNodeDeviceD= ef *def, } =20 virCommand* -nodeDeviceGetMdevctlStartCommand(virNodeDeviceDef *def, +nodeDeviceGetMdevctlCreateCommand(virNodeDeviceDef *def, char **uuid_out, char **errmsg) { - return nodeDeviceGetMdevctlDefineStartCommand(def, "start", uuid_out, - errmsg); + return nodeDeviceGetMdevctlDefineCreateCommand(def, "start", uuid_out, + errmsg); } =20 virCommand* @@ -750,18 +750,18 @@ nodeDeviceGetMdevctlDefineCommand(virNodeDeviceDef *d= ef, char **uuid_out, char **errmsg) { - return nodeDeviceGetMdevctlDefineStartCommand(def, "define", uuid_out, - errmsg); + return nodeDeviceGetMdevctlDefineCreateCommand(def, "define", uuid_out, + errmsg); } =20 =20 =20 static int -virMdevctlStart(virNodeDeviceDefPtr def, char **uuid, char **errmsg) +virMdevctlCreate(virNodeDeviceDefPtr def, char **uuid, char **errmsg) { int status; - g_autoptr(virCommand) cmd =3D nodeDeviceGetMdevctlStartCommand(def, uu= id, - errmsg); + g_autoptr(virCommand) cmd =3D nodeDeviceGetMdevctlCreateCommand(def, u= uid, + errmsg); if (!cmd) return -1; =20 @@ -811,7 +811,7 @@ nodeDeviceCreateXMLMdev(virConnectPtr conn, return NULL; } =20 - if (virMdevctlStart(def, &uuid, &errmsg) < 0) { + if (virMdevctlCreate(def, &uuid, &errmsg) < 0) { if (errmsg) virReportError(VIR_ERR_INTERNAL_ERROR, _("Unable to start mediated device '%s': %s"), @@ -910,7 +910,7 @@ nodeDeviceGetMdevctlUndefineCommand(const char *uuid, c= har **errmsg) } =20 virCommand* -nodeDeviceGetMdevctlCreateCommand(const char *uuid, char **errmsg) +nodeDeviceGetMdevctlStartCommand(const char *uuid, char **errmsg) { virCommand *cmd =3D virCommandNewArgList(MDEVCTL, "start", @@ -953,12 +953,12 @@ virMdevctlUndefine(virNodeDeviceDef *def, char **errm= sg) =20 =20 static int -virMdevctlCreate(virNodeDeviceDef *def, char **errmsg) +virMdevctlStart(virNodeDeviceDef *def, char **errmsg) { int status; g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D nodeDeviceGetMdevctlCreateCommand(def->caps->data.mdev.uuid, e= rrmsg); + cmd =3D nodeDeviceGetMdevctlStartCommand(def->caps->data.mdev.uuid, er= rmsg); =20 if (virCommandRun(cmd, &status) < 0 || status !=3D 0) return -1; @@ -1412,7 +1412,7 @@ nodeDeviceCreate(virNodeDevice *device, if (nodeDeviceHasCapability(def, VIR_NODE_DEV_CAP_MDEV)) { g_autofree char *errmsg =3D NULL; =20 - if (virMdevctlCreate(def, &errmsg) < 0) { + if (virMdevctlStart(def, &errmsg) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unable to create mediated device: %s"), errmsg && errmsg[0] ? errmsg : "Unknown Error"); diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_de= vice_driver.h index 8a935ffed6..0e3f6dbf28 100644 --- a/src/node_device/node_device_driver.h +++ b/src/node_device/node_device_driver.h @@ -123,9 +123,9 @@ nodeConnectNodeDeviceEventDeregisterAny(virConnectPtr c= onn, int callbackID); =20 virCommandPtr -nodeDeviceGetMdevctlStartCommand(virNodeDeviceDefPtr def, - char **uuid_out, - char **errmsg); +nodeDeviceGetMdevctlCreateCommand(virNodeDeviceDefPtr def, + char **uuid_out, + char **errmsg); =20 virCommand* nodeDeviceGetMdevctlDefineCommand(virNodeDeviceDef *def, @@ -162,8 +162,8 @@ bool nodeDeviceDefCopyFromMdevctl(virNodeDeviceDef *dst, virNodeDeviceDef *src); =20 virCommand* -nodeDeviceGetMdevctlCreateCommand(const char *uuid, - char **errmsg); +nodeDeviceGetMdevctlStartCommand(const char *uuid, + char **errmsg); =20 int nodeDeviceCreate(virNodeDevice *dev, diff --git a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2= 1366-start.argv b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9= a70e21366-create.argv similarity index 100% rename from tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21= 366-start.argv rename to tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2136= 6-create.argv diff --git a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2= 1366-start.json b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9= a70e21366-create.json similarity index 100% rename from tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21= 366-start.json rename to tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2136= 6-create.json diff --git a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c= 23d9-start.argv b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb= 3f14c23d9-create.argv similarity index 100% rename from tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c2= 3d9-start.argv rename to tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d= 9-create.argv diff --git a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c= 23d9-start.json b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb= 3f14c23d9-create.json similarity index 100% rename from tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c2= 3d9-start.json rename to tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d= 9-create.json diff --git a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c1= 3076-start.argv b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871= d16c13076-create.argv similarity index 100% rename from tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13= 076-start.argv rename to tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c1307= 6-create.argv diff --git a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c1= 3076-start.json b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871= d16c13076-create.json similarity index 100% rename from tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13= 076-start.json rename to tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c1307= 6-create.json diff --git a/tests/nodedevmdevctldata/mdevctl-create.argv b/tests/nodedevmd= evctldata/mdevctl-start.argv similarity index 100% rename from tests/nodedevmdevctldata/mdevctl-create.argv rename to tests/nodedevmdevctldata/mdevctl-start.argv diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index a95bdf6d6e..427299e171 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -59,12 +59,12 @@ typedef virCommand* (*MdevctlCmdFunc)(virNodeDeviceDef = *, char **, char **); =20 =20 static int -testMdevctlStartOrDefine(const char *virt_type, - int create, - MdevctlCmdFunc mdevctl_cmd_func, - const char *mdevxml, - const char *cmdfile, - const char *jsonfile) +testMdevctlCreateOrDefine(const char *virt_type, + int create, + MdevctlCmdFunc mdevctl_cmd_func, + const char *mdevxml, + const char *cmdfile, + const char *jsonfile) { g_autoptr(virNodeDeviceDef) def =3D NULL; virNodeDeviceObjPtr obj =3D NULL; @@ -108,7 +108,7 @@ testMdevctlStartOrDefine(const char *virt_type, } =20 static int -testMdevctlStartOrDefineHelper(const void *data) +testMdevctlCreateOrDefineHelper(const void *data) { const struct startTestInfo *info =3D data; const char *cmd; @@ -117,9 +117,9 @@ testMdevctlStartOrDefineHelper(const void *data) g_autofree char *cmdlinefile =3D NULL; g_autofree char *jsonfile =3D NULL; =20 - if (info->command =3D=3D MDEVCTL_CMD_START) { - cmd =3D "start"; - func =3D nodeDeviceGetMdevctlStartCommand; + if (info->command =3D=3D MDEVCTL_CMD_CREATE) { + cmd =3D "create"; + func =3D nodeDeviceGetMdevctlCreateCommand; } else if (info->command =3D=3D MDEVCTL_CMD_DEFINE) { cmd =3D "define"; func =3D nodeDeviceGetMdevctlDefineCommand; @@ -134,8 +134,8 @@ testMdevctlStartOrDefineHelper(const void *data) jsonfile =3D g_strdup_printf("%s/nodedevmdevctldata/%s-%s.json", abs_s= rcdir, info->filename, cmd); =20 - return testMdevctlStartOrDefine(info->virt_type, info->create, func, - mdevxml, cmdlinefile, jsonfile); + return testMdevctlCreateOrDefine(info->virt_type, info->create, func, + mdevxml, cmdlinefile, jsonfile); } =20 typedef virCommand* (*GetStopUndefineCmdFunc)(const char *uuid, char **err= buf); @@ -195,9 +195,9 @@ testMdevctlUuidCommandHelper(const void *data) } else if (info->command =3D=3D MDEVCTL_CMD_UNDEFINE) { cmd =3D "undefine"; func =3D nodeDeviceGetMdevctlUndefineCommand; - }else if (info->command =3D=3D MDEVCTL_CMD_CREATE) { - cmd =3D "create"; - func =3D nodeDeviceGetMdevctlCreateCommand; + }else if (info->command =3D=3D MDEVCTL_CMD_START) { + cmd =3D "start"; + func =3D nodeDeviceGetMdevctlStartCommand; } else { return -1; } @@ -418,12 +418,12 @@ mymain(void) #define DO_TEST_CMD(desc, virt_type, create, filename, command) \ do { \ struct startTestInfo info =3D { virt_type, create, filename, comma= nd }; \ - DO_TEST_FULL(desc, testMdevctlStartOrDefineHelper, &info); \ + DO_TEST_FULL(desc, testMdevctlCreateOrDefineHelper, &info); \ } \ while (0) =20 -#define DO_TEST_START(filename) \ - DO_TEST_CMD("mdevctl start " filename, "QEMU", CREATE_DEVICE, filename= , MDEVCTL_CMD_START) +#define DO_TEST_CREATE(filename) \ + DO_TEST_CMD("mdevctl create " filename, "QEMU", CREATE_DEVICE, filenam= e, MDEVCTL_CMD_CREATE) =20 #define DO_TEST_DEFINE(filename) \ DO_TEST_CMD("mdevctl define " filename, "QEMU", CREATE_DEVICE, filenam= e, MDEVCTL_CMD_DEFINE) @@ -441,8 +441,8 @@ mymain(void) #define DO_TEST_UNDEFINE(filename) \ DO_TEST_UUID_COMMAND_FULL("mdevctl undefine " filename, filename, MDEV= CTL_CMD_UNDEFINE) =20 -#define DO_TEST_CREATE(filename) \ - DO_TEST_UUID_COMMAND_FULL("mdevctl create " filename, filename, MDEVCT= L_CMD_CREATE) +#define DO_TEST_START(filename) \ + DO_TEST_UUID_COMMAND_FULL("mdevctl start " filename, filename, MDEVCTL= _CMD_START) =20 #define DO_TEST_LIST_DEFINED() \ DO_TEST_FULL("mdevctl list --defined", testMdevctlListDefined, NULL) @@ -450,10 +450,9 @@ mymain(void) #define DO_TEST_PARSE_JSON(filename) \ DO_TEST_FULL("parse mdevctl json " filename, testMdevctlParse, filenam= e) =20 - /* Test mdevctl start commands */ - DO_TEST_START("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366"); - DO_TEST_START("mdev_fedc4916_1ca8_49ac_b176_871d16c13076"); - DO_TEST_START("mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9"); + DO_TEST_CREATE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366"); + DO_TEST_CREATE("mdev_fedc4916_1ca8_49ac_b176_871d16c13076"); + DO_TEST_CREATE("mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9"); =20 /* Test mdevctl stop command, pass an arbitrary uuid */ DO_TEST_STOP("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366"); @@ -468,7 +467,7 @@ mymain(void) =20 DO_TEST_UNDEFINE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366"); =20 - DO_TEST_CREATE("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366"); + DO_TEST_START("mdev_d069d019_36ea_4111_8f0a_8c9a70e21366"); =20 done: nodedevTestDriverFree(driver); --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004033; cv=none; d=zohomail.com; s=zohoarc; b=XqXa6UK+uuW57P555kOAZzbdFdHHSIvG6GP4JcibSU+1qll8mV2CeibFPFdR1Yqgs0KQwrnnN55ppAAxsggz6LBcC+sLGonjWwXWsKhF3xgTGn6F1b9EP3oBwaRb3XupvCuCE9fVlqambz+VfM4bL+EMNAH1OyzOLtwat1xPRdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004033; h=Content-Type:Content-Transfer-Encoding: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=ubk4Ehu29MhB8T5ypV9Rvh/2kFeJLOihIrbN2+FIhU8=; b=HnWSW+cSvQBp0hMwVJDVdXAvhk+ODjCEQIvj9+yi+GbQUxcuknF0tLWzYHb6VQzDmSVJbWLgh8nYXSPelHAd4gu/Tfm3vc9Z0CnegOiB1TRq5bneiz7nZ6pk9twrzAkscISSrgd6ofI3pX6LsoFxaX/nB53URg6VnRUx617NXz8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618004033067124.78999067409927; Fri, 9 Apr 2021 14:33:53 -0700 (PDT) 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-247-5MBdz07bN7CzHNqJINvufQ-1; Fri, 09 Apr 2021 17:33:49 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01A6D10054F6; Fri, 9 Apr 2021 21:33:43 +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 CF25F5B4BD; Fri, 9 Apr 2021 21:33:42 +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 97CE755354; Fri, 9 Apr 2021 21:33:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXDxB032623 for ; Fri, 9 Apr 2021 17:33:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 587C25D6AD; Fri, 9 Apr 2021 21:33:13 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B5145D6A1 for ; Fri, 9 Apr 2021 21:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004032; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=ubk4Ehu29MhB8T5ypV9Rvh/2kFeJLOihIrbN2+FIhU8=; b=ISHUIPh8rlVznxMuu7Sj4GTNaZor7rhwyniifTllPVcziYZuOAyqSeMaG0lQ9ZMXwHTYtV RlzRASQU2nC409CX9qkZ+lVgoDcGRe3sZ1vfZLHOZ+9iiWSDmUjPvRJLsAqd0rlPt+yw8o VSWKTWJ6thjj935FMEh19mAKHgWdPKI= X-MC-Unique: 5MBdz07bN7CzHNqJINvufQ-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 05/11] nodedev: Switch to using long options for mdevctl Date: Fri, 9 Apr 2021 16:33:00 -0500 Message-Id: <20210409213306.3971286-6-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" rather than using short opentions (e.g. "-p 0000:00:02.0"), use long options everywhere (e.g. "--parent=3D0000:00:02.0") Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 28 ++++++------------- ...19_36ea_4111_8f0a_8c9a70e21366-create.argv | 2 +- ...19_36ea_4111_8f0a_8c9a70e21366-define.argv | 2 +- ...39_495e_4243_ad9f_beb3f14c23d9-create.argv | 2 +- ...39_495e_4243_ad9f_beb3f14c23d9-define.argv | 2 +- ...16_1ca8_49ac_b176_871d16c13076-create.argv | 2 +- ...16_1ca8_49ac_b176_871d16c13076-define.argv | 2 +- tests/nodedevmdevctldata/mdevctl-start.argv | 2 +- tests/nodedevmdevctldata/mdevctl-stop.argv | 2 +- .../nodedevmdevctldata/mdevctl-undefine.argv | 2 +- 10 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 3236dd7bc3..e9147ec0f9 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -720,10 +720,9 @@ nodeDeviceGetMdevctlDefineCreateCommand(virNodeDeviceD= ef *def, return NULL; } =20 - cmd =3D virCommandNewArgList(MDEVCTL, subcommand, - "-p", parent_addr, - "--jsonfile", "/dev/stdin", - NULL); + cmd =3D virCommandNewArgList(MDEVCTL, subcommand, NULL); + virCommandAddArgPair(cmd, "--parent", parent_addr); + virCommandAddArgPair(cmd, "--jsonfile", "/dev/stdin"); =20 virCommandSetInputBuffer(cmd, json); =20 @@ -887,11 +886,8 @@ nodeDeviceCreateXML(virConnectPtr conn, virCommandPtr nodeDeviceGetMdevctlStopCommand(const char *uuid, char **errmsg) { - virCommandPtr cmd =3D virCommandNewArgList(MDEVCTL, - "stop", - "-u", - uuid, - NULL); + virCommandPtr cmd =3D virCommandNewArgList(MDEVCTL, "stop", NULL); + virCommandAddArgPair(cmd, "--uuid", uuid); virCommandSetErrorBuffer(cmd, errmsg); return cmd; =20 @@ -900,11 +896,8 @@ nodeDeviceGetMdevctlStopCommand(const char *uuid, char= **errmsg) virCommand * nodeDeviceGetMdevctlUndefineCommand(const char *uuid, char **errmsg) { - virCommand *cmd =3D virCommandNewArgList(MDEVCTL, - "undefine", - "-u", - uuid, - NULL); + virCommand *cmd =3D virCommandNewArgList(MDEVCTL, "undefine", NULL); + virCommandAddArgPair(cmd, "--uuid", uuid); virCommandSetErrorBuffer(cmd, errmsg); return cmd; } @@ -912,11 +905,8 @@ nodeDeviceGetMdevctlUndefineCommand(const char *uuid, = char **errmsg) virCommand* nodeDeviceGetMdevctlStartCommand(const char *uuid, char **errmsg) { - virCommand *cmd =3D virCommandNewArgList(MDEVCTL, - "start", - "-u", - uuid, - NULL); + virCommand *cmd =3D virCommandNewArgList(MDEVCTL, "start", NULL); + virCommandAddArgPair(cmd, "--uuid", uuid); virCommandSetErrorBuffer(cmd, errmsg); return cmd; } diff --git a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2= 1366-create.argv b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c= 9a70e21366-create.argv index 129f438e4a..90a12cdd61 100644 --- a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-cr= eate.argv +++ b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-cr= eate.argv @@ -1,2 +1,2 @@ -$MDEVCTL_BINARY$ start -p 0000:00:02.0 --jsonfile /dev/stdin \ +$MDEVCTL_BINARY$ start --parent=3D0000:00:02.0 --jsonfile=3D/dev/stdin \ --uuid=3Dd069d019-36ea-4111-8f0a-8c9a70e21366 diff --git a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2= 1366-define.argv b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c= 9a70e21366-define.argv index 118ec7a8da..2dbde45872 100644 --- a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-de= fine.argv +++ b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-de= fine.argv @@ -1,2 +1,2 @@ -$MDEVCTL_BINARY$ define -p 0000:00:02.0 --jsonfile /dev/stdin \ +$MDEVCTL_BINARY$ define --parent=3D0000:00:02.0 --jsonfile=3D/dev/stdin \ --uuid=3Dd069d019-36ea-4111-8f0a-8c9a70e21366 diff --git a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c= 23d9-create.argv b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_be= b3f14c23d9-create.argv index eb7262035e..fc392f0c39 100644 --- a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-cr= eate.argv +++ b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-cr= eate.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ start -p 0000:00:02.0 --jsonfile /dev/stdin +$MDEVCTL_BINARY$ start --parent=3D0000:00:02.0 --jsonfile=3D/dev/stdin diff --git a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c= 23d9-define.argv b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_be= b3f14c23d9-define.argv index 773e98b963..8a40b1037b 100644 --- a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-de= fine.argv +++ b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-de= fine.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ define -p 0000:00:02.0 --jsonfile /dev/stdin +$MDEVCTL_BINARY$ define --parent=3D0000:00:02.0 --jsonfile=3D/dev/stdin diff --git a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c1= 3076-create.argv b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_87= 1d16c13076-create.argv index eb7262035e..fc392f0c39 100644 --- a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-cr= eate.argv +++ b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-cr= eate.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ start -p 0000:00:02.0 --jsonfile /dev/stdin +$MDEVCTL_BINARY$ start --parent=3D0000:00:02.0 --jsonfile=3D/dev/stdin diff --git a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c1= 3076-define.argv b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_87= 1d16c13076-define.argv index 773e98b963..8a40b1037b 100644 --- a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-de= fine.argv +++ b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-de= fine.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ define -p 0000:00:02.0 --jsonfile /dev/stdin +$MDEVCTL_BINARY$ define --parent=3D0000:00:02.0 --jsonfile=3D/dev/stdin diff --git a/tests/nodedevmdevctldata/mdevctl-start.argv b/tests/nodedevmde= vctldata/mdevctl-start.argv index dc0ae7be0e..dd92de8527 100644 --- a/tests/nodedevmdevctldata/mdevctl-start.argv +++ b/tests/nodedevmdevctldata/mdevctl-start.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ start -u d069d019-36ea-4111-8f0a-8c9a70e21366 +$MDEVCTL_BINARY$ start --uuid=3Dd069d019-36ea-4111-8f0a-8c9a70e21366 diff --git a/tests/nodedevmdevctldata/mdevctl-stop.argv b/tests/nodedevmdev= ctldata/mdevctl-stop.argv index 5bdb213a32..7549b6ff74 100644 --- a/tests/nodedevmdevctldata/mdevctl-stop.argv +++ b/tests/nodedevmdevctldata/mdevctl-stop.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ stop -u d069d019-36ea-4111-8f0a-8c9a70e21366 +$MDEVCTL_BINARY$ stop --uuid=3Dd069d019-36ea-4111-8f0a-8c9a70e21366 diff --git a/tests/nodedevmdevctldata/mdevctl-undefine.argv b/tests/nodedev= mdevctldata/mdevctl-undefine.argv index c2236727ef..8d5217beba 100644 --- a/tests/nodedevmdevctldata/mdevctl-undefine.argv +++ b/tests/nodedevmdevctldata/mdevctl-undefine.argv @@ -1 +1 @@ -$MDEVCTL_BINARY$ undefine -u d069d019-36ea-4111-8f0a-8c9a70e21366 +$MDEVCTL_BINARY$ undefine --uuid=3Dd069d019-36ea-4111-8f0a-8c9a70e21366 --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004022; cv=none; d=zohomail.com; s=zohoarc; b=GKJp1qKo8LRO3S3RiFh5kxpCyQPV/2bfPBT/Eg812S0Ja/9ZH7EOEzHIRxaji6aJZ7UVFzNTSnt2Coij6RMe8sm3z+t+oTeHg1wdTEcWEgyM0YKwDnk6F+/JLkbJ14T2T1+QU9iNUaA4ccOxNf1TEpuClPwLOO8Dyq5voYCr7h0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004022; 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=a1JqsBZ5iRPcNb8hrP8HZgedc5ZzjFn5zychhgd9TT0=; b=X4T4QHlyVY7l4RPuAC+5nNBA/CZUIMzeGmoMBkq30vQhaFI8yii55bnM+Gz/LXwW43/kXQFGZtTdUkV4bEt8q8M4C57dCdNk5NKE5DlYBZZMnKZK9Gu5srGMe7WH51VvO1V0hsFZ3iA7NrsAhJbEtD2UasjBe1nHJ0i/FHW1Zkg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1618004022479981.4056914127017; Fri, 9 Apr 2021 14:33:42 -0700 (PDT) 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-420-3aam8bMIM8KsIwvpTZoq_g-1; Fri, 09 Apr 2021 17:33:39 -0400 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 B0D76801814; Fri, 9 Apr 2021 21:33:34 +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 8AAEF6F99B; Fri, 9 Apr 2021 21:33:34 +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 5241D5534D; Fri, 9 Apr 2021 21:33:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXD20032631 for ; Fri, 9 Apr 2021 17:33:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id AFC2C5D6AD; Fri, 9 Apr 2021 21:33:13 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 74BF65D6A1; Fri, 9 Apr 2021 21:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004021; 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=a1JqsBZ5iRPcNb8hrP8HZgedc5ZzjFn5zychhgd9TT0=; b=YlGhGDdB4wkr4YleP3X6E71ive+nOAwHQ8s100nRoeFRgyVYRiKhEhuzLuKv5EnfjZ/o6p CHeZhKsJQC/V4aaVUehI6K9v+U9lN4C6Qw70dcUjz++V1Ypn6FJm97VwCJb6MJG+nEvpxD F+Yp5IbGAGeJWryOro+Z9o2KGNM6S2I= X-MC-Unique: 3aam8bMIM8KsIwvpTZoq_g-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 06/11] nodedev: driver: Introduce internal mdevctl commands enum Date: Fri, 9 Apr 2021 16:33:01 -0500 Message-Id: <20210409213306.3971286-7-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Erik Skultety 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Erik Skultety This is not a 1:1 mapping to mdevctl because mdevctl doesn't support a 'create' command. It uses 'start' for both starting a defined device as well as creating a transient one. To make our code more readable in that regard and not second-guess what does a specific "start" instance mean, use "create" internally instead only to translate it to "start" just before executing mdevctl. Signed-off-by: Erik Skultety Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 7 +++++++ src/node_device/node_device_driver.h | 19 +++++++++++++++++++ tests/nodedevmdevctltest.c | 12 ++---------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index e9147ec0f9..c25558cf05 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -47,6 +47,13 @@ =20 virNodeDeviceDriverStatePtr driver; =20 + +VIR_ENUM_IMPL(virMdevctlCommand, + MDEVCTL_CMD_LAST, + "start", "stop", "define", "undefine", "create" +); + + virDrvOpenStatus nodeConnectOpen(virConnectPtr conn, virConnectAuthPtr auth G_GNUC_UNUSED, diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_de= vice_driver.h index 0e3f6dbf28..aaeed588e8 100644 --- a/src/node_device/node_device_driver.h +++ b/src/node_device/node_device_driver.h @@ -33,6 +33,25 @@ int udevNodeRegister(void); #endif =20 + +typedef enum { + MDEVCTL_CMD_START, + MDEVCTL_CMD_STOP, + MDEVCTL_CMD_DEFINE, + MDEVCTL_CMD_UNDEFINE, + + /* mdevctl actually doesn't have a 'create' command, it will be replac= ed + * with 'start' eventually in nodeDeviceGetMdevctlCommand, but this cl= ear + * separation makes our code more readable in terms of knowing when we= 're + * starting a defined device and when we're creating a transient one */ + MDEVCTL_CMD_CREATE, + + MDEVCTL_CMD_LAST, +} virMdevctlCommand; + +VIR_ENUM_DECL(virMdevctlCommand); + + void nodeDeviceLock(void); =20 diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 427299e171..8a37dd2e80 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -10,19 +10,11 @@ =20 #define VIR_FROM_THIS VIR_FROM_NODEDEV =20 -typedef enum { - MDEVCTL_CMD_START, - MDEVCTL_CMD_STOP, - MDEVCTL_CMD_DEFINE, - MDEVCTL_CMD_UNDEFINE, - MDEVCTL_CMD_CREATE, -} MdevctlCmd; - struct startTestInfo { const char *virt_type; int create; const char *filename; - MdevctlCmd command; + virMdevctlCommand command; }; =20 /* capture stdin passed to command */ @@ -141,7 +133,7 @@ testMdevctlCreateOrDefineHelper(const void *data) typedef virCommand* (*GetStopUndefineCmdFunc)(const char *uuid, char **err= buf); struct UuidCommandTestInfo { const char *filename; - MdevctlCmd command; + virMdevctlCommand command; }; =20 static int --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004036; cv=none; d=zohomail.com; s=zohoarc; b=Ya4Iid8CVJGS/hKaZ1DmcfJd7DJsfk5qmUVWjCHVVHOCAbROaondq9PjUl5YvUjhjUhuTYLFq7MDKimuTf1RotYw2jEq3uYtPXMa+V+6jmfZ+LoiSnhU27Ei7BY7eYjhIRA9xLLPdHpqOUwJdT6JdEe7kUYwnT00bRHXcR6WPfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004036; 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=d+pXcocvh5+4oVBLxRQr2CVqZ/utsyzBaE+Kc2Wg4yg=; b=L004Yu6GBbjqDDRbVrtgxlO/HScFsuU8cRmraCWptGeaYEydephU7pDqPCG2drlurRHjEF7qL2qvrbhRlNidYMjXr0INJbGB00lwH2gVFuIf2e7hwAHSaEWLQav3zCSql5h5BiAF/zHQhZ7gqHcwQDvRylFLpDFKZEjpMPet9kE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618004036712376.0280115273674; Fri, 9 Apr 2021 14:33:56 -0700 (PDT) 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-195-Ja0b9NC4O0ynHEsdSvvD0g-1; Fri, 09 Apr 2021 17:33:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF15C8190BE; Fri, 9 Apr 2021 21:33:45 +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 9E2F95D6D3; Fri, 9 Apr 2021 21:33:45 +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 65FDE1806D20; Fri, 9 Apr 2021 21:33:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXERQ032641 for ; Fri, 9 Apr 2021 17:33:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 14A695D6AD; Fri, 9 Apr 2021 21:33:14 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CCC795D6A1; Fri, 9 Apr 2021 21:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004034; 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=d+pXcocvh5+4oVBLxRQr2CVqZ/utsyzBaE+Kc2Wg4yg=; b=BCZVPTsPmnJe3NLNlvlOk4zoufv+/Pg9/MrWilfitUe43g8iWF5LEwO1uFFzbuEQ0x5bnM R28odiMUj/W+aFnjkPXIu2HHmbx9wVKsq83Yh7+7pKe8KY9K24XaPeZtxnJmX/yLcCyXNZ /vKdPfRJpgR6EGeh0QdJL+OUKuJOB5g= X-MC-Unique: Ja0b9NC4O0ynHEsdSvvD0g-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 07/11] nodedev: driver: Create a generic mdevctl command translator Date: Fri, 9 Apr 2021 16:33:02 -0500 Message-Id: <20210409213306.3971286-8-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Erik Skultety 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.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Erik Skultety Currently there are dedicated wrappers to construct mdevctl command. These are mostly fine except for the one that translates both "start" and "define" commands, only because mdevctl takes the same set of arguments. Instead, keep the wrappers, but let them call a single global translator that handles all the mdevctl command differences and commonalities. Signed-off-by: Erik Skultety Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 125 ++++++++++++++++----------- src/node_device/node_device_driver.h | 6 +- tests/nodedevmdevctltest.c | 4 +- 3 files changed, 79 insertions(+), 56 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index c25558cf05..0fddfdde86 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -702,42 +702,75 @@ nodeDeviceFindAddressByName(const char *name) } =20 =20 -/* the mdevctl 'start' and 'define' commands accept almost the exact same - * arguments, so provide a common implementation that can be wrapped by a = more - * specific function */ -static virCommand* -nodeDeviceGetMdevctlDefineCreateCommand(virNodeDeviceDef *def, - const char *subcommand, - char **uuid_out, - char **errmsg) +static virCommand * +nodeDeviceGetMdevctlCommand(virNodeDeviceDefPtr def, + virMdevctlCommand cmd_type, + char **outbuf, + char **errbuf) { - virCommandPtr cmd; - g_autofree char *json =3D NULL; - g_autofree char *parent_addr =3D nodeDeviceFindAddressByName(def->pare= nt); - - if (!parent_addr) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unable to find parent device '%s'"), def->parent= ); - return NULL; + g_autofree char *parent_addr =3D NULL; + virCommand *cmd =3D NULL; + const char *subcommand =3D virMdevctlCommandTypeToString(cmd_type); + g_autofree char *inbuf =3D NULL; + + switch (cmd_type) { + case MDEVCTL_CMD_CREATE: + /* now is the time to make sure "create" is replaced with "start" = on + * mdevctl cmdline */ + cmd =3D virCommandNewArgList(MDEVCTL, "start", NULL); + break; + case MDEVCTL_CMD_STOP: + case MDEVCTL_CMD_START: + case MDEVCTL_CMD_DEFINE: + case MDEVCTL_CMD_UNDEFINE: + cmd =3D virCommandNewArgList(MDEVCTL, subcommand, NULL); + break; + case MDEVCTL_CMD_LAST: + default: + /* SHOULD NEVER HAPPEN */ + break; } =20 - if (nodeDeviceDefToMdevctlConfig(def, &json) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("couldn't convert node device def to mdevctl JSON= ")); - return NULL; - } + switch (cmd_type) { + case MDEVCTL_CMD_CREATE: + case MDEVCTL_CMD_DEFINE: + parent_addr =3D nodeDeviceFindAddressByName(def->parent); =20 - cmd =3D virCommandNewArgList(MDEVCTL, subcommand, NULL); - virCommandAddArgPair(cmd, "--parent", parent_addr); - virCommandAddArgPair(cmd, "--jsonfile", "/dev/stdin"); + if (!parent_addr) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unable to find parent device '%s'"), def->pa= rent); + return NULL; + } + + if (nodeDeviceDefToMdevctlConfig(def, &inbuf) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("couldn't convert node device def to mdevctl = JSON")); + return NULL; + } =20 - virCommandSetInputBuffer(cmd, json); + virCommandAddArgPair(cmd, "--parent", parent_addr); + virCommandAddArgPair(cmd, "--jsonfile", "/dev/stdin"); + + virCommandSetInputBuffer(cmd, inbuf); + virCommandSetOutputBuffer(cmd, outbuf); + break; + + case MDEVCTL_CMD_UNDEFINE: + case MDEVCTL_CMD_STOP: + case MDEVCTL_CMD_START: + /* No special handling here, we only need to pass UUID with these = */ + break; + case MDEVCTL_CMD_LAST: + default: + /* SHOULD NEVER HAPPEN */ + break; + } =20 + /* Fill in UUID for commands that need it */ if (def->caps->data.mdev.uuid) virCommandAddArgPair(cmd, "--uuid", def->caps->data.mdev.uuid); =20 - virCommandSetOutputBuffer(cmd, uuid_out); - virCommandSetErrorBuffer(cmd, errmsg); + virCommandSetErrorBuffer(cmd, errbuf); =20 return cmd; } @@ -747,8 +780,7 @@ nodeDeviceGetMdevctlCreateCommand(virNodeDeviceDef *def, char **uuid_out, char **errmsg) { - return nodeDeviceGetMdevctlDefineCreateCommand(def, "start", uuid_out, - errmsg); + return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_CREATE, uuid_out, = errmsg); } =20 virCommand* @@ -756,8 +788,7 @@ nodeDeviceGetMdevctlDefineCommand(virNodeDeviceDef *def, char **uuid_out, char **errmsg) { - return nodeDeviceGetMdevctlDefineCreateCommand(def, "define", uuid_out, - errmsg); + return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_DEFINE, uuid_out, = errmsg); } =20 =20 @@ -891,31 +922,24 @@ nodeDeviceCreateXML(virConnectPtr conn, =20 =20 virCommandPtr -nodeDeviceGetMdevctlStopCommand(const char *uuid, char **errmsg) +nodeDeviceGetMdevctlStopCommand(virNodeDeviceDefPtr def, + char **errmsg) { - virCommandPtr cmd =3D virCommandNewArgList(MDEVCTL, "stop", NULL); - virCommandAddArgPair(cmd, "--uuid", uuid); - virCommandSetErrorBuffer(cmd, errmsg); - return cmd; - + return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_STOP, NULL, errmsg= ); } =20 virCommand * -nodeDeviceGetMdevctlUndefineCommand(const char *uuid, char **errmsg) +nodeDeviceGetMdevctlUndefineCommand(virNodeDeviceDefPtr def, + char **errmsg) { - virCommand *cmd =3D virCommandNewArgList(MDEVCTL, "undefine", NULL); - virCommandAddArgPair(cmd, "--uuid", uuid); - virCommandSetErrorBuffer(cmd, errmsg); - return cmd; + return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_UNDEFINE, NULL, er= rmsg); } =20 virCommand* -nodeDeviceGetMdevctlStartCommand(const char *uuid, char **errmsg) +nodeDeviceGetMdevctlStartCommand(virNodeDeviceDef *def, + char **errmsg) { - virCommand *cmd =3D virCommandNewArgList(MDEVCTL, "start", NULL); - virCommandAddArgPair(cmd, "--uuid", uuid); - virCommandSetErrorBuffer(cmd, errmsg); - return cmd; + return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_START, NULL, errms= g); } =20 static int @@ -924,7 +948,7 @@ virMdevctlStop(virNodeDeviceDefPtr def, char **errmsg) int status; g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D nodeDeviceGetMdevctlStopCommand(def->caps->data.mdev.uuid, err= msg); + cmd =3D nodeDeviceGetMdevctlStopCommand(def, errmsg); =20 if (virCommandRun(cmd, &status) < 0 || status !=3D 0) return -1; @@ -939,8 +963,7 @@ virMdevctlUndefine(virNodeDeviceDef *def, char **errmsg) int status; g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D nodeDeviceGetMdevctlUndefineCommand(def->caps->data.mdev.uuid, - errmsg); + cmd =3D nodeDeviceGetMdevctlUndefineCommand(def, errmsg); =20 if (virCommandRun(cmd, &status) < 0 || status !=3D 0) return -1; @@ -955,7 +978,7 @@ virMdevctlStart(virNodeDeviceDef *def, char **errmsg) int status; g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D nodeDeviceGetMdevctlStartCommand(def->caps->data.mdev.uuid, er= rmsg); + cmd =3D nodeDeviceGetMdevctlStartCommand(def, errmsg); =20 if (virCommandRun(cmd, &status) < 0 || status !=3D 0) return -1; diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_de= vice_driver.h index aaeed588e8..0fea75a118 100644 --- a/src/node_device/node_device_driver.h +++ b/src/node_device/node_device_driver.h @@ -152,11 +152,11 @@ nodeDeviceGetMdevctlDefineCommand(virNodeDeviceDef *d= ef, char **errmsg); =20 virCommandPtr -nodeDeviceGetMdevctlStopCommand(const char *uuid, +nodeDeviceGetMdevctlStopCommand(virNodeDeviceDefPtr def, char **errmsg); =20 virCommand * -nodeDeviceGetMdevctlUndefineCommand(const char *uuid, +nodeDeviceGetMdevctlUndefineCommand(virNodeDeviceDefPtr def, char **errmsg); =20 virCommandPtr @@ -181,7 +181,7 @@ bool nodeDeviceDefCopyFromMdevctl(virNodeDeviceDef *dst, virNodeDeviceDef *src); =20 virCommand* -nodeDeviceGetMdevctlStartCommand(const char *uuid, +nodeDeviceGetMdevctlStartCommand(virNodeDeviceDefPtr def, char **errmsg); =20 int diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 8a37dd2e80..e766ae8f34 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -130,7 +130,7 @@ testMdevctlCreateOrDefineHelper(const void *data) mdevxml, cmdlinefile, jsonfile); } =20 -typedef virCommand* (*GetStopUndefineCmdFunc)(const char *uuid, char **err= buf); +typedef virCommand* (*GetStopUndefineCmdFunc)(virNodeDeviceDef *def, char = **errbuf); struct UuidCommandTestInfo { const char *filename; virMdevctlCommand command; @@ -150,7 +150,7 @@ testMdevctlUuidCommand(GetStopUndefineCmdFunc func, if (!(def =3D virNodeDeviceDefParseFile(mdevxml, EXISTING_DEVICE, "QEM= U"))) goto cleanup; =20 - cmd =3D func(def->caps->data.mdev.uuid, &errmsg); + cmd =3D func(def, &errmsg); =20 if (!cmd) goto cleanup; --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004116; cv=none; d=zohomail.com; s=zohoarc; b=iqkKCR/wYObjs1mqHnQMh9OSRVW5HnMt5f6Zwp50u8lQ4MdJ4aW2rLHRsKJ4YZX7Q36scTTv/bZzjBNF89F60r94ZAYCD0lyohXp/rQ1eV1gdhuoCOgGIk6qk7Lv89QhYCAYzY8lk7htY/sT0zEX0kzU9ZEeAJtwZ0Dd2JeYyyw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004116; h=Content-Type:Content-Transfer-Encoding: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=FqG3GDIiT1bfXEachtv3c0/noz1pbSgfM7+kPrD17Ao=; b=h4vzZdjggwaNUZDTggOgTbAyRyTRKQgKvbOxncF65XIVcGePef5z9C6GbGoCUKi8w3DuXiGEmMrHsC56Aym7Y3VKyt2LT5QiWcS5NnVc5Hhpg4h4xCvHMT0gHSucU9ZBeMG+FbnMqfjVVuvdqx90T39qdWyuiLZ3tmDZ16KSvoE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1618004116070573.3824849489819; Fri, 9 Apr 2021 14:35:16 -0700 (PDT) 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-599-KMWNdFcvNlif1La9_7ER_A-1; Fri, 09 Apr 2021 17:33:55 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF5001007495; Fri, 9 Apr 2021 21:33:48 +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 BDF1B5C3E9; Fri, 9 Apr 2021 21:33:48 +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 7FAFD1806D22; Fri, 9 Apr 2021 21:33:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXEj7032651 for ; Fri, 9 Apr 2021 17:33:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5F2CE5D6AD; Fri, 9 Apr 2021 21:33:14 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 31CAC5D6A1 for ; Fri, 9 Apr 2021 21:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004114; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=FqG3GDIiT1bfXEachtv3c0/noz1pbSgfM7+kPrD17Ao=; b=HZQ24gVcvWCGPA6hTVxDjA9CvOG282XD0fAQ+ukplLYWvt48JInVo1DHK9BuY46crqF1gu vwR7IGtM3GYUeDDMtfML4TT6Deeg94HZ5tPJtApqgICEmaFO3w7H4l3syYB2yeVxkwz/aS ll1Jp2giI14lwEvNl7YH5SViowsiSYM= X-MC-Unique: KMWNdFcvNlif1La9_7ER_A-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 08/11] nodedev: Remove GetMdevctl*Command() wrappers Date: Fri, 9 Apr 2021 16:33:03 -0500 Message-Id: <20210409213306.3971286-9-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" These per-command generator functions were only exposed in the header to allow the commandline generation to be tested. Now that we have a generic mdevctl command generator, we can get rid of the per-command wrappers and reduce the noise in the header. Signed-off-by: Jonathon Jongsma --- src/node_device/node_device_driver.c | 56 ++++++---------------------- src/node_device/node_device_driver.h | 24 ++---------- tests/nodedevmdevctltest.c | 41 ++++---------------- 3 files changed, 23 insertions(+), 98 deletions(-) diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 0fddfdde86..76019b8631 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -702,7 +702,7 @@ nodeDeviceFindAddressByName(const char *name) } =20 =20 -static virCommand * +virCommand * nodeDeviceGetMdevctlCommand(virNodeDeviceDefPtr def, virMdevctlCommand cmd_type, char **outbuf, @@ -775,30 +775,15 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDefPtr def, return cmd; } =20 -virCommand* -nodeDeviceGetMdevctlCreateCommand(virNodeDeviceDef *def, - char **uuid_out, - char **errmsg) -{ - return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_CREATE, uuid_out, = errmsg); -} - -virCommand* -nodeDeviceGetMdevctlDefineCommand(virNodeDeviceDef *def, - char **uuid_out, - char **errmsg) -{ - return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_DEFINE, uuid_out, = errmsg); -} - - =20 static int virMdevctlCreate(virNodeDeviceDefPtr def, char **uuid, char **errmsg) { int status; - g_autoptr(virCommand) cmd =3D nodeDeviceGetMdevctlCreateCommand(def, u= uid, - errmsg); + g_autoptr(virCommand) cmd =3D nodeDeviceGetMdevctlCommand(def, + MDEVCTL_CMD_CR= EATE, + uuid, + errmsg); if (!cmd) return -1; =20 @@ -818,7 +803,9 @@ static int virMdevctlDefine(virNodeDeviceDefPtr def, char **uuid, char **errmsg) { int status; - g_autoptr(virCommand) cmd =3D nodeDeviceGetMdevctlDefineCommand(def, u= uid, errmsg); + g_autoptr(virCommand) cmd =3D nodeDeviceGetMdevctlCommand(def, + MDEVCTL_CMD_DE= FINE, + uuid, errmsg); =20 if (!cmd) return -1; @@ -921,34 +908,13 @@ nodeDeviceCreateXML(virConnectPtr conn, } =20 =20 -virCommandPtr -nodeDeviceGetMdevctlStopCommand(virNodeDeviceDefPtr def, - char **errmsg) -{ - return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_STOP, NULL, errmsg= ); -} - -virCommand * -nodeDeviceGetMdevctlUndefineCommand(virNodeDeviceDefPtr def, - char **errmsg) -{ - return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_UNDEFINE, NULL, er= rmsg); -} - -virCommand* -nodeDeviceGetMdevctlStartCommand(virNodeDeviceDef *def, - char **errmsg) -{ - return nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_START, NULL, errms= g); -} - static int virMdevctlStop(virNodeDeviceDefPtr def, char **errmsg) { int status; g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D nodeDeviceGetMdevctlStopCommand(def, errmsg); + cmd =3D nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_STOP, NULL, errms= g); =20 if (virCommandRun(cmd, &status) < 0 || status !=3D 0) return -1; @@ -963,7 +929,7 @@ virMdevctlUndefine(virNodeDeviceDef *def, char **errmsg) int status; g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D nodeDeviceGetMdevctlUndefineCommand(def, errmsg); + cmd =3D nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_UNDEFINE, NULL, e= rrmsg); =20 if (virCommandRun(cmd, &status) < 0 || status !=3D 0) return -1; @@ -978,7 +944,7 @@ virMdevctlStart(virNodeDeviceDef *def, char **errmsg) int status; g_autoptr(virCommand) cmd =3D NULL; =20 - cmd =3D nodeDeviceGetMdevctlStartCommand(def, errmsg); + cmd =3D nodeDeviceGetMdevctlCommand(def, MDEVCTL_CMD_START, NULL, errm= sg); =20 if (virCommandRun(cmd, &status) < 0 || status !=3D 0) return -1; diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_de= vice_driver.h index 0fea75a118..482a5cfb3e 100644 --- a/src/node_device/node_device_driver.h +++ b/src/node_device/node_device_driver.h @@ -141,23 +141,11 @@ int nodeConnectNodeDeviceEventDeregisterAny(virConnectPtr conn, int callbackID); =20 -virCommandPtr -nodeDeviceGetMdevctlCreateCommand(virNodeDeviceDefPtr def, - char **uuid_out, - char **errmsg); - -virCommand* -nodeDeviceGetMdevctlDefineCommand(virNodeDeviceDef *def, - char **uuid_out, - char **errmsg); - -virCommandPtr -nodeDeviceGetMdevctlStopCommand(virNodeDeviceDefPtr def, - char **errmsg); - virCommand * -nodeDeviceGetMdevctlUndefineCommand(virNodeDeviceDefPtr def, - char **errmsg); +nodeDeviceGetMdevctlCommand(virNodeDeviceDefPtr def, + virMdevctlCommand cmd_type, + char **outbuf, + char **errbuf); =20 virCommandPtr nodeDeviceGetMdevctlListCommand(bool defined, @@ -180,10 +168,6 @@ nodeDeviceGenerateName(virNodeDeviceDef *def, bool nodeDeviceDefCopyFromMdevctl(virNodeDeviceDef *dst, virNodeDeviceDef *src); =20 -virCommand* -nodeDeviceGetMdevctlStartCommand(virNodeDeviceDefPtr def, - char **errmsg); - int nodeDeviceCreate(virNodeDevice *dev, unsigned int flags); diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index e766ae8f34..c467c798e7 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -53,7 +53,7 @@ typedef virCommand* (*MdevctlCmdFunc)(virNodeDeviceDef *,= char **, char **); static int testMdevctlCreateOrDefine(const char *virt_type, int create, - MdevctlCmdFunc mdevctl_cmd_func, + virMdevctlCommand cmd_type, const char *mdevxml, const char *cmdfile, const char *jsonfile) @@ -73,7 +73,7 @@ testMdevctlCreateOrDefine(const char *virt_type, =20 /* this function will set a stdin buffer containing the json configura= tion * of the device. The json value is captured in the callback above */ - cmd =3D mdevctl_cmd_func(def, &uuid, &errmsg); + cmd =3D nodeDeviceGetMdevctlCommand(def, cmd_type, &uuid, &errmsg); =20 if (!cmd) goto cleanup; @@ -103,22 +103,11 @@ static int testMdevctlCreateOrDefineHelper(const void *data) { const struct startTestInfo *info =3D data; - const char *cmd; - MdevctlCmdFunc func; + const char *cmd =3D virMdevctlCommandTypeToString(info->command); g_autofree char *mdevxml =3D NULL; g_autofree char *cmdlinefile =3D NULL; g_autofree char *jsonfile =3D NULL; =20 - if (info->command =3D=3D MDEVCTL_CMD_CREATE) { - cmd =3D "create"; - func =3D nodeDeviceGetMdevctlCreateCommand; - } else if (info->command =3D=3D MDEVCTL_CMD_DEFINE) { - cmd =3D "define"; - func =3D nodeDeviceGetMdevctlDefineCommand; - } else { - return -1; - } - mdevxml =3D g_strdup_printf("%s/nodedevschemadata/%s.xml", abs_srcdir, info->filename); cmdlinefile =3D g_strdup_printf("%s/nodedevmdevctldata/%s-%s.argv", @@ -126,7 +115,7 @@ testMdevctlCreateOrDefineHelper(const void *data) jsonfile =3D g_strdup_printf("%s/nodedevmdevctldata/%s-%s.json", abs_s= rcdir, info->filename, cmd); =20 - return testMdevctlCreateOrDefine(info->virt_type, info->create, func, + return testMdevctlCreateOrDefine(info->virt_type, info->create, info->= command, mdevxml, cmdlinefile, jsonfile); } =20 @@ -137,7 +126,7 @@ struct UuidCommandTestInfo { }; =20 static int -testMdevctlUuidCommand(GetStopUndefineCmdFunc func, +testMdevctlUuidCommand(virMdevctlCommand command, const char *mdevxml, const char *outfile) { g_autoptr(virNodeDeviceDef) def =3D NULL; @@ -150,7 +139,7 @@ testMdevctlUuidCommand(GetStopUndefineCmdFunc func, if (!(def =3D virNodeDeviceDefParseFile(mdevxml, EXISTING_DEVICE, "QEM= U"))) goto cleanup; =20 - cmd =3D func(def, &errmsg); + cmd =3D nodeDeviceGetMdevctlCommand(def, command, NULL, &errmsg); =20 if (!cmd) goto cleanup; @@ -176,30 +165,16 @@ static int testMdevctlUuidCommandHelper(const void *data) { const struct UuidCommandTestInfo *info =3D data; - GetStopUndefineCmdFunc func; - const char *cmd; + const char *cmd =3D virMdevctlCommandTypeToString(info->command); g_autofree char *cmdlinefile =3D NULL; g_autofree char *mdevxml =3D NULL; =20 - if (info->command =3D=3D MDEVCTL_CMD_STOP) { - cmd =3D "stop"; - func =3D nodeDeviceGetMdevctlStopCommand; - } else if (info->command =3D=3D MDEVCTL_CMD_UNDEFINE) { - cmd =3D "undefine"; - func =3D nodeDeviceGetMdevctlUndefineCommand; - }else if (info->command =3D=3D MDEVCTL_CMD_START) { - cmd =3D "start"; - func =3D nodeDeviceGetMdevctlStartCommand; - } else { - return -1; - } - mdevxml =3D g_strdup_printf("%s/nodedevschemadata/%s.xml", abs_srcdir, info->filename); cmdlinefile =3D g_strdup_printf("%s/nodedevmdevctldata/mdevctl-%s.argv= ", abs_srcdir, cmd); =20 - return testMdevctlUuidCommand(func, mdevxml, cmdlinefile); + return testMdevctlUuidCommand(info->command, mdevxml, cmdlinefile); } =20 static int --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004008; cv=none; d=zohomail.com; s=zohoarc; b=TsSCxB+WQQs+3MOHRwyEaoC7/rpSBr/vemXl87IgozFsUim4wt91UFRl9DooK0WhC3rc6rHkkq/OxkTgrv/wUXu332c6nD9oWST5UVicHi59KtXVkRQ3EPTqMLpjSivZd8oBjx3mio6UXq/FOzU4vxtx9qX4CqIlrcFAB1WZCwQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004008; 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=xhvS3In7d73FFvKs2yDRRvFZPqrjJnP6lZCK+wWKfpo=; b=kTd2Ee/EEm1YD/U6yJaWQLO9mfRq0e97GhiaosewQCcJdiZIrtK6rwuj2zKKlJWuklqumMmrp/6If2b/DkpCIXdUQQVkptt1c98FO/9sBEw31bG/ye7x4Oa1QQ8Sq2hbQbIxlOhvCkOqft0OTy583q9qToQhtpryo9zDC1i+9BE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1618004008952564.3169806391273; Fri, 9 Apr 2021 14:33:28 -0700 (PDT) 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-282-vKadeBCvMtSnVGMBR3t3Qw-1; Fri, 09 Apr 2021 17:33:23 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E1F7810054F6; Fri, 9 Apr 2021 21:33:18 +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 46DFA5C1A1; Fri, 9 Apr 2021 21:33:18 +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 4E1F818095C9; Fri, 9 Apr 2021 21:33:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXEoV032658 for ; Fri, 9 Apr 2021 17:33:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id B8AAB5D6D3; Fri, 9 Apr 2021 21:33:14 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C4AC5D6A1; Fri, 9 Apr 2021 21:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004005; 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=xhvS3In7d73FFvKs2yDRRvFZPqrjJnP6lZCK+wWKfpo=; b=daKq5zajrMc20QAb+LF9jI/eIIzpAFpYXgiFoPWSYVfn7Lr+J8HM5s+1pzLDEiAFuzfDdJ +/fQ3wSaUmAV8pcvYIGDh/FXQjG2vUYkO9Mfd7G+JEA51aQyAB6qNUDpUYkcRv+4RmN7Ls 0cRDP+evkkPrjHH0S4Y2nEbGtsZD0S4= X-MC-Unique: vKadeBCvMtSnVGMBR3t3Qw-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 09/11] tests: nodedev: Make the mdevctl test function and helper generic Date: Fri, 9 Apr 2021 16:33:04 -0500 Message-Id: <20210409213306.3971286-10-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Erik Skultety 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Erik Skultety Now that we have a generic mdevctl command generator, we can unify the test infrastructure as well. Signed-off-by: Erik Skultety --- ...19_36ea_4111_8f0a_8c9a70e21366-start.argv} | 0 ...019_36ea_4111_8f0a_8c9a70e21366-stop.argv} | 0 ...36ea_4111_8f0a_8c9a70e21366-undefine.argv} | 0 tests/nodedevmdevctltest.c | 119 +++++------------- 4 files changed, 30 insertions(+), 89 deletions(-) rename tests/nodedevmdevctldata/{mdevctl-start.argv =3D> mdev_d069d019_36e= a_4111_8f0a_8c9a70e21366-start.argv} (100%) rename tests/nodedevmdevctldata/{mdevctl-stop.argv =3D> mdev_d069d019_36ea= _4111_8f0a_8c9a70e21366-stop.argv} (100%) rename tests/nodedevmdevctldata/{mdevctl-undefine.argv =3D> mdev_d069d019_= 36ea_4111_8f0a_8c9a70e21366-undefine.argv} (100%) diff --git a/tests/nodedevmdevctldata/mdevctl-start.argv b/tests/nodedevmde= vctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-start.argv similarity index 100% rename from tests/nodedevmdevctldata/mdevctl-start.argv rename to tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2136= 6-start.argv diff --git a/tests/nodedevmdevctldata/mdevctl-stop.argv b/tests/nodedevmdev= ctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-stop.argv similarity index 100% rename from tests/nodedevmdevctldata/mdevctl-stop.argv rename to tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2136= 6-stop.argv diff --git a/tests/nodedevmdevctldata/mdevctl-undefine.argv b/tests/nodedev= mdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-undefine.argv similarity index 100% rename from tests/nodedevmdevctldata/mdevctl-undefine.argv rename to tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e2136= 6-undefine.argv diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index c467c798e7..7e192ce118 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -10,7 +10,7 @@ =20 #define VIR_FROM_THIS VIR_FROM_NODEDEV =20 -struct startTestInfo { +struct TestInfo { const char *virt_type; int create; const char *filename; @@ -47,24 +47,24 @@ nodedevCompareToFile(const char *actual, } =20 =20 -typedef virCommand* (*MdevctlCmdFunc)(virNodeDeviceDef *, char **, char **= ); +typedef virCommand * (*MdevctlCmdFunc)(virNodeDeviceDef *, char **, char *= *); =20 =20 static int -testMdevctlCreateOrDefine(const char *virt_type, - int create, - virMdevctlCommand cmd_type, - const char *mdevxml, - const char *cmdfile, - const char *jsonfile) +testMdevctlCmd(const char *virt_type, + int create, + virMdevctlCommand cmd_type, + const char *mdevxml, + const char *cmdfile, + const char *jsonfile) { g_autoptr(virNodeDeviceDef) def =3D NULL; virNodeDeviceObjPtr obj =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; const char *actualCmdline =3D NULL; int ret =3D -1; - g_autofree char *uuid =3D NULL; - g_autofree char *errmsg =3D NULL; + g_autofree char *outbuf =3D NULL; + g_autofree char *errbuf =3D NULL; g_autofree char *stdinbuf =3D NULL; g_autoptr(virCommand) cmd =3D NULL; =20 @@ -73,12 +73,16 @@ testMdevctlCreateOrDefine(const char *virt_type, =20 /* this function will set a stdin buffer containing the json configura= tion * of the device. The json value is captured in the callback above */ - cmd =3D nodeDeviceGetMdevctlCommand(def, cmd_type, &uuid, &errmsg); + cmd =3D nodeDeviceGetMdevctlCommand(def, cmd_type, &outbuf, &errbuf); =20 if (!cmd) goto cleanup; =20 - virCommandSetDryRun(&buf, testCommandDryRunCallback, &stdinbuf); + if (create) + virCommandSetDryRun(&buf, testCommandDryRunCallback, &stdinbuf); + else + virCommandSetDryRun(&buf, NULL, NULL); + if (virCommandRun(cmd, NULL) < 0) goto cleanup; =20 @@ -88,7 +92,7 @@ testMdevctlCreateOrDefine(const char *virt_type, if (nodedevCompareToFile(actualCmdline, cmdfile) < 0) goto cleanup; =20 - if (virTestCompareToFile(stdinbuf, jsonfile) < 0) + if (create && virTestCompareToFile(stdinbuf, jsonfile) < 0) goto cleanup; =20 ret =3D 0; @@ -99,10 +103,11 @@ testMdevctlCreateOrDefine(const char *virt_type, return ret; } =20 + static int -testMdevctlCreateOrDefineHelper(const void *data) +testMdevctlHelper(const void *data) { - const struct startTestInfo *info =3D data; + const struct TestInfo *info =3D data; const char *cmd =3D virMdevctlCommandTypeToString(info->command); g_autofree char *mdevxml =3D NULL; g_autofree char *cmdlinefile =3D NULL; @@ -115,67 +120,10 @@ testMdevctlCreateOrDefineHelper(const void *data) jsonfile =3D g_strdup_printf("%s/nodedevmdevctldata/%s-%s.json", abs_s= rcdir, info->filename, cmd); =20 - return testMdevctlCreateOrDefine(info->virt_type, info->create, info->= command, - mdevxml, cmdlinefile, jsonfile); -} - -typedef virCommand* (*GetStopUndefineCmdFunc)(virNodeDeviceDef *def, char = **errbuf); -struct UuidCommandTestInfo { - const char *filename; - virMdevctlCommand command; -}; - -static int -testMdevctlUuidCommand(virMdevctlCommand command, - const char *mdevxml, const char *outfile) -{ - g_autoptr(virNodeDeviceDef) def =3D NULL; - g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - const char *actualCmdline =3D NULL; - int ret =3D -1; - g_autoptr(virCommand) cmd =3D NULL; - g_autofree char *errmsg =3D NULL; - - if (!(def =3D virNodeDeviceDefParseFile(mdevxml, EXISTING_DEVICE, "QEM= U"))) - goto cleanup; - - cmd =3D nodeDeviceGetMdevctlCommand(def, command, NULL, &errmsg); - - if (!cmd) - goto cleanup; - - virCommandSetDryRun(&buf, NULL, NULL); - if (virCommandRun(cmd, NULL) < 0) - goto cleanup; - - if (!(actualCmdline =3D virBufferCurrentContent(&buf))) - goto cleanup; - - if (nodedevCompareToFile(actualCmdline, outfile) < 0) - goto cleanup; - - ret =3D 0; - - cleanup: - virCommandSetDryRun(NULL, NULL, NULL); - return ret; + return testMdevctlCmd(info->virt_type, info->create, info->command, + mdevxml, cmdlinefile, jsonfile); } =20 -static int -testMdevctlUuidCommandHelper(const void *data) -{ - const struct UuidCommandTestInfo *info =3D data; - const char *cmd =3D virMdevctlCommandTypeToString(info->command); - g_autofree char *cmdlinefile =3D NULL; - g_autofree char *mdevxml =3D NULL; - - mdevxml =3D g_strdup_printf("%s/nodedevschemadata/%s.xml", abs_srcdir, - info->filename); - cmdlinefile =3D g_strdup_printf("%s/nodedevmdevctldata/mdevctl-%s.argv= ", - abs_srcdir, cmd); - - return testMdevctlUuidCommand(info->command, mdevxml, cmdlinefile); -} =20 static int testMdevctlListDefined(const void *data G_GNUC_UNUSED) @@ -384,35 +332,28 @@ mymain(void) =20 #define DO_TEST_CMD(desc, virt_type, create, filename, command) \ do { \ - struct startTestInfo info =3D { virt_type, create, filename, comma= nd }; \ - DO_TEST_FULL(desc, testMdevctlCreateOrDefineHelper, &info); \ + struct TestInfo info =3D { virt_type, create, filename, command };= \ + DO_TEST_FULL(desc, testMdevctlHelper, &info); \ } \ while (0) =20 #define DO_TEST_CREATE(filename) \ - DO_TEST_CMD("mdevctl create " filename, "QEMU", CREATE_DEVICE, filenam= e, MDEVCTL_CMD_CREATE) + DO_TEST_CMD("create mdev " filename, "QEMU", CREATE_DEVICE, filename, = MDEVCTL_CMD_CREATE) =20 #define DO_TEST_DEFINE(filename) \ - DO_TEST_CMD("mdevctl define " filename, "QEMU", CREATE_DEVICE, filenam= e, MDEVCTL_CMD_DEFINE) - -#define DO_TEST_UUID_COMMAND_FULL(desc, uuid, command) \ - do { \ - struct UuidCommandTestInfo info =3D { uuid, command }; \ - DO_TEST_FULL(desc, testMdevctlUuidCommandHelper, &info); \ - } \ - while (0) + DO_TEST_CMD("define mdev " filename, "QEMU", CREATE_DEVICE, filename, = MDEVCTL_CMD_DEFINE) =20 #define DO_TEST_STOP(filename) \ - DO_TEST_UUID_COMMAND_FULL("mdevctl stop " filename, filename, MDEVCTL_= CMD_STOP) + DO_TEST_CMD("stop mdev " filename, "QEMU", EXISTING_DEVICE, filename, = MDEVCTL_CMD_STOP) =20 #define DO_TEST_UNDEFINE(filename) \ - DO_TEST_UUID_COMMAND_FULL("mdevctl undefine " filename, filename, MDEV= CTL_CMD_UNDEFINE) + DO_TEST_CMD("undefine mdev" filename, "QEMU", EXISTING_DEVICE, filenam= e, MDEVCTL_CMD_UNDEFINE) =20 #define DO_TEST_START(filename) \ - DO_TEST_UUID_COMMAND_FULL("mdevctl start " filename, filename, MDEVCTL= _CMD_START) + DO_TEST_CMD("start mdev " filename, "QEMU", EXISTING_DEVICE, filename,= MDEVCTL_CMD_START) =20 #define DO_TEST_LIST_DEFINED() \ - DO_TEST_FULL("mdevctl list --defined", testMdevctlListDefined, NULL) + DO_TEST_FULL("list defined mdevs", testMdevctlListDefined, NULL) =20 #define DO_TEST_PARSE_JSON(filename) \ DO_TEST_FULL("parse mdevctl json " filename, testMdevctlParse, filenam= e) --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004021; cv=none; d=zohomail.com; s=zohoarc; b=HCP7d08u6V4kZDWeqzcISdTtvmEyO4igO8ZOKftDZFPT1ePt0D3PnQ/vcFTqtmC2Yo2lJIuM8wWe4FBAGCXxl9UWGacOplGKrm+wgUqZ/VXyg1I5sUBO1J2iRNd6Y9v+7IIXPYNO3JQqe/Zb7IpaCVUOTX3qOBp7neQAWAgZ+HU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004021; h=Content-Type:Content-Transfer-Encoding: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=NikI/TbeTy1Uvi+BNyekm9+Pu+JjkxALCLqcVSScN/w=; b=ePvmbVYx8IdSAHuTbIga6NqlsYgk8K4N6JJ0aXe6k/3c40HCZ90fVFDULeABbPcCZs/JfVhAuhnpHA+FoY/qSKiSuQ02U8EwtrPMvbR2dSwdanBJU/JR//YvI/49Gm1wnY3AfG9BuG6RGlLQ0IuEl+jl4dF3s+cO0OQtTsfgbmA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1618004021823595.0882402387568; Fri, 9 Apr 2021 14:33:41 -0700 (PDT) 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-342-Lrcl1sH7OAqqrRIxIF-5tg-1; Fri, 09 Apr 2021 17:33:38 -0400 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 0A1F681747D; Fri, 9 Apr 2021 21:33:34 +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 D637F1043276; Fri, 9 Apr 2021 21:33:33 +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 994E41C98; Fri, 9 Apr 2021 21:33:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXFbO032663 for ; Fri, 9 Apr 2021 17:33:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0E3205D6AD; Fri, 9 Apr 2021 21:33:15 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D43685D6A1 for ; Fri, 9 Apr 2021 21:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004020; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=NikI/TbeTy1Uvi+BNyekm9+Pu+JjkxALCLqcVSScN/w=; b=AVaF/QepLVRpaxFoUvQKsZc2EYvlLJjMP/EbXAtrrLZe+1MncyYukiQ13pMUc7C38VG05e Hz64E1PjMPyGS6NGUgqcalahKzvEQB0m4Jg1rRYTMEvLyJc8OiLqBWyd/AzwqW69/r/obg ZzXQo6b47peHyLAaO0RjCzLQ8eLASlk= X-MC-Unique: Lrcl1sH7OAqqrRIxIF-5tg-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 10/11] tests: nodedev: simplify test macros Date: Fri, 9 Apr 2021 16:33:05 -0500 Message-Id: <20210409213306.3971286-11-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We only use the virt_type "QEMU" in this tests, so simply hard-code it in the test function rather than specifying it in the test macro. In addition, we can figure out the appropriate value for 'create' from the command type, so push that into the test function rather than specifying it in the test macro. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctltest.c | 43 +++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 7e192ce118..3a53254195 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -10,9 +10,9 @@ =20 #define VIR_FROM_THIS VIR_FROM_NODEDEV =20 +#define VIRT_TYPE "QEMU" + struct TestInfo { - const char *virt_type; - int create; const char *filename; virMdevctlCommand command; }; @@ -51,9 +51,7 @@ typedef virCommand * (*MdevctlCmdFunc)(virNodeDeviceDef *= , char **, char **); =20 =20 static int -testMdevctlCmd(const char *virt_type, - int create, - virMdevctlCommand cmd_type, +testMdevctlCmd(virMdevctlCommand cmd_type, const char *mdevxml, const char *cmdfile, const char *jsonfile) @@ -67,8 +65,24 @@ testMdevctlCmd(const char *virt_type, g_autofree char *errbuf =3D NULL; g_autofree char *stdinbuf =3D NULL; g_autoptr(virCommand) cmd =3D NULL; + int create; + + switch (cmd_type) { + case MDEVCTL_CMD_CREATE: + case MDEVCTL_CMD_DEFINE: + create =3D CREATE_DEVICE; + break; + case MDEVCTL_CMD_START: + case MDEVCTL_CMD_STOP: + case MDEVCTL_CMD_UNDEFINE: + create =3D EXISTING_DEVICE; + break; + case MDEVCTL_CMD_LAST: + default: + goto cleanup; + } =20 - if (!(def =3D virNodeDeviceDefParseFile(mdevxml, create, virt_type))) + if (!(def =3D virNodeDeviceDefParseFile(mdevxml, create, VIRT_TYPE))) goto cleanup; =20 /* this function will set a stdin buffer containing the json configura= tion @@ -120,8 +134,7 @@ testMdevctlHelper(const void *data) jsonfile =3D g_strdup_printf("%s/nodedevmdevctldata/%s-%s.json", abs_s= rcdir, info->filename, cmd); =20 - return testMdevctlCmd(info->virt_type, info->create, info->command, - mdevxml, cmdlinefile, jsonfile); + return testMdevctlCmd(info->command, mdevxml, cmdlinefile, jsonfile); } =20 =20 @@ -330,27 +343,27 @@ mymain(void) if (virTestRun(desc, func, info) < 0) \ ret =3D -1; =20 -#define DO_TEST_CMD(desc, virt_type, create, filename, command) \ +#define DO_TEST_CMD(desc, filename, command) \ do { \ - struct TestInfo info =3D { virt_type, create, filename, command };= \ + struct TestInfo info =3D { filename, command }; \ DO_TEST_FULL(desc, testMdevctlHelper, &info); \ } \ while (0) =20 #define DO_TEST_CREATE(filename) \ - DO_TEST_CMD("create mdev " filename, "QEMU", CREATE_DEVICE, filename, = MDEVCTL_CMD_CREATE) + DO_TEST_CMD("create mdev " filename, filename, MDEVCTL_CMD_CREATE) =20 #define DO_TEST_DEFINE(filename) \ - DO_TEST_CMD("define mdev " filename, "QEMU", CREATE_DEVICE, filename, = MDEVCTL_CMD_DEFINE) + DO_TEST_CMD("define mdev " filename, filename, MDEVCTL_CMD_DEFINE) =20 #define DO_TEST_STOP(filename) \ - DO_TEST_CMD("stop mdev " filename, "QEMU", EXISTING_DEVICE, filename, = MDEVCTL_CMD_STOP) + DO_TEST_CMD("stop mdev " filename, filename, MDEVCTL_CMD_STOP) =20 #define DO_TEST_UNDEFINE(filename) \ - DO_TEST_CMD("undefine mdev" filename, "QEMU", EXISTING_DEVICE, filenam= e, MDEVCTL_CMD_UNDEFINE) + DO_TEST_CMD("undefine mdev" filename, filename, MDEVCTL_CMD_UNDEFINE) =20 #define DO_TEST_START(filename) \ - DO_TEST_CMD("start mdev " filename, "QEMU", EXISTING_DEVICE, filename,= MDEVCTL_CMD_START) + DO_TEST_CMD("start mdev " filename, filename, MDEVCTL_CMD_START) =20 #define DO_TEST_LIST_DEFINED() \ DO_TEST_FULL("list defined mdevs", testMdevctlListDefined, NULL) --=20 2.26.3 From nobody Mon Apr 29 14:52:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1618004131; cv=none; d=zohomail.com; s=zohoarc; b=jNedG1O92Q/ufepSInW3Wq/JwlGEgNlAynN1kYjt2kJRwtnRzgLUow3B2JJmknJBla+52pYfcThU0CxydUblZ+uabEdfDFTN0ZlNXIYUXY4YGLi5cxPXUqfgjmws0oPpgMn2IKI6GEumPm7voiKHxvsJ/S7F1SNPGZph3w7Cxmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618004131; h=Content-Type:Content-Transfer-Encoding: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=Oob5Kvk/WvvN2HloE1Tn1rbsmekKuKnmBUbOdBBqi4s=; b=Z8ioJJS2F2ZQ2czVu4vlNBQASHniG0yJq6rIb5th03Gyf6u8/561Ndk7Sc1kDnsKNCXzxJgya9CTn/CiN0dwwmeh3/O1zzHxQcar87RHVdnS8+155GJpHS/UE5802BbI0NvmmoJ1e5sero0+lVCbLJ6y1bX6tebQoHrnwrCSXkY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618004131217412.6360462232335; Fri, 9 Apr 2021 14:35:31 -0700 (PDT) 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-229-WTc8LEz1PPWweCvaul3n3A-1; Fri, 09 Apr 2021 17:33:43 -0400 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 0842C1922969; Fri, 9 Apr 2021 21:33: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 D799629151; Fri, 9 Apr 2021 21:33: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 9B2061806D1C; Fri, 9 Apr 2021 21:33:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139LXFjH032668 for ; Fri, 9 Apr 2021 17:33:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5841E5D6AD; Fri, 9 Apr 2021 21:33:15 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A8635D6A1 for ; Fri, 9 Apr 2021 21:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618004130; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=Oob5Kvk/WvvN2HloE1Tn1rbsmekKuKnmBUbOdBBqi4s=; b=UK0Rf/DYmK3g3AMjuKKaAI+/YTNr0pCQkXaPzBWNfwnQnUZEp9MoNdJ3BR2+IbnU9pY3z/ xguSG4wxjYHb0r/KAv+XqiZI2vXfZ6ajLNo0xzCEOp3mPIBuK0QnQz6Bk7QI6W5gbCzPQt XqLTkDb+EuPa3dpSSpGBwj3YSqsCWoA= X-MC-Unique: WTc8LEz1PPWweCvaul3n3A-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 11/11] tests: nodedev: remove unused variable Date: Fri, 9 Apr 2021 16:33:06 -0500 Message-Id: <20210409213306.3971286-12-jjongsma@redhat.com> In-Reply-To: <20210409213306.3971286-1-jjongsma@redhat.com> References: <20210409213306.3971286-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This variable was leftover from previous changes but is no longer used. Signed-off-by: Jonathon Jongsma --- tests/nodedevmdevctltest.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c index 3a53254195..b2507e1567 100644 --- a/tests/nodedevmdevctltest.c +++ b/tests/nodedevmdevctltest.c @@ -57,7 +57,6 @@ testMdevctlCmd(virMdevctlCommand cmd_type, const char *jsonfile) { g_autoptr(virNodeDeviceDef) def =3D NULL; - virNodeDeviceObjPtr obj =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; const char *actualCmdline =3D NULL; int ret =3D -1; @@ -113,7 +112,6 @@ testMdevctlCmd(virMdevctlCommand cmd_type, =20 cleanup: virCommandSetDryRun(NULL, NULL, NULL); - virNodeDeviceObjEndAPI(&obj); return ret; } =20 --=20 2.26.3