From patchwork Tue Jul 10 21:46:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 141656 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4377316ljj; Tue, 10 Jul 2018 14:46:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdEaZN7dAsYxwyhc+oLRUtTVMOZPJi7xXpgjiFQQUsM9TZPGPPXDhh0oJUhLaKXr9VfP05q X-Received: by 2002:a37:28c4:: with SMTP id o65-v6mr23254323qko.251.1531259174266; Tue, 10 Jul 2018 14:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531259174; cv=none; d=google.com; s=arc-20160816; b=JrNCl/hJOLjyH6GIK6PTcbjEp7M+01XBkT4aOLWDpzQvHy/N4BUcSVVK8aSHunmJtM ftP7Ovvljyd/40daOnVf5eXu1wror6uE/A7E2NPRLbBw26FCh10HSWZ2Z3j2JKFknfD5 H6oPjBpDvHPITxHNHMedNl1Ef9UenItDNjPb9XkkHjYtWpYjh0QEDC1wVtdqMFunwbyi XXgkXYHYh9M3hk4QoeUT1bG74AZM+bQhnu59T8Q6jTS5536JUDrG234zzV0WB8DX+1Py 2StyvmyDyq/I6epNTJia3ie1fvmM618DCOBBc7QX6BQ8uc9idqOb7iebpZEfFltvw3Lq BamQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=L3ynzQZsZbVULwmra8HJdRwqqu2XDoQirmnyUIFvcU8=; b=nYQlad08+gwqsTBxtjG11yyfIZ8KmQJx/b2Qq+JhJdKPXMr/kW+QnxAGYfMr+5pfeW /5R0ImoLkRS4gp1AXJub3ZMijG2GG3XxvyF4kPLPnhA0azSWGcb17BHcgci1lGxjBLgQ hA4Bz1hOyxvKS8LvPIaEzqvnBB3S+doYGmZs2cNDR2dCOXz1tYZWOxDAyREYdM3Y5NWP 4pxWNej9GauWj2xClZ85OBhMob3ETcdX+DIIEic6+nk0AM4ZcCbEZuxzNR4ke7dvusXg Ev3wpef06OkchQ4W6C7AgDpVP+ahY75EhBR1bSlTZ/RKLs378WLLu7KP0WaXtBgsqi2q YVQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id 186-v6si2592462qko.53.2018.07.10.14.46.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jul 2018 14:46:14 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 mx1.redhat.com (Postfix) with ESMTPS id 69C668110D; Tue, 10 Jul 2018 21:46:12 +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 BBEC4414B; Tue, 10 Jul 2018 21:46:11 +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 03F4F18037ED; Tue, 10 Jul 2018 21:46:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6ALk89q023414 for ; Tue, 10 Jul 2018 17:46:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8916521568A4; Tue, 10 Jul 2018 21:46:07 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.bos.redhat.com (dhcp-17-157.bos.redhat.com [10.18.17.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 610582156891; Tue, 10 Jul 2018 21:46:07 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 10 Jul 2018 17:46:01 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: eskultet@redhat.com Subject: [libvirt] [PATCH v2 1/2] conf: nodedev: Don't refresh host caps in testdriver 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: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 10 Jul 2018 21:46:12 +0000 (UTC) Add a 'skipUpdateCaps' bool that we set for test_driver.c nodedevs which will skip accessing host resources via virNodeDeviceUpdateCaps Signed-off-by: Cole Robinson --- src/conf/virnodedeviceobj.c | 13 ++++++++++++- src/conf/virnodedeviceobj.h | 4 ++++ src/test/test_driver.c | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) -- 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 13e9a17518..6c04caf6ab 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -37,6 +37,8 @@ struct _virNodeDeviceObj { virObjectLockable parent; virNodeDeviceDefPtr def; /* device definition */ + bool skipUpdateCaps; /* whether to skip checking host caps, + used by testdriver */ }; struct _virNodeDeviceObjList { @@ -806,7 +808,8 @@ virNodeDeviceMatch(virNodeDeviceObjPtr obj, unsigned int flags) { /* Refresh the capabilities first, e.g. due to a driver change */ - if (virNodeDeviceUpdateCaps(obj->def) < 0) + if (!obj->skipUpdateCaps && + virNodeDeviceUpdateCaps(obj->def) < 0) return false; /* filter by cap type */ @@ -915,3 +918,11 @@ virNodeDeviceObjListExport(virConnectPtr conn, virObjectListFree(data.devices); return -1; } + + +void +virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr obj, + bool skipUpdateCaps) +{ + obj->skipUpdateCaps = skipUpdateCaps; +} diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h index 87f9083696..ffbe4e32e5 100644 --- a/src/conf/virnodedeviceobj.h +++ b/src/conf/virnodedeviceobj.h @@ -109,4 +109,8 @@ virNodeDeviceObjListExport(virConnectPtr conn, virNodeDeviceObjListFilter filter, unsigned int flags); +void +virNodeDeviceObjSetSkipUpdateCaps(virNodeDeviceObjPtr obj, + bool skipUpdateCaps); + #endif /* __VIRNODEDEVICEOBJ_H__ */ diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 951d9c4151..7374c83eaa 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1165,6 +1165,7 @@ testParseNodedevs(testDriverPtr privconn, goto error; } + virNodeDeviceObjSetSkipUpdateCaps(obj, true); virNodeDeviceObjEndAPI(&obj); } @@ -5565,6 +5566,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver, goto cleanup; def = NULL; objdef = virNodeDeviceObjGetDef(obj); + virNodeDeviceObjSetSkipUpdateCaps(obj, true); event = virNodeDeviceEventLifecycleNew(objdef->name, VIR_NODE_DEVICE_EVENT_CREATED, From patchwork Tue Jul 10 21:46:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 141657 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4377453ljj; Tue, 10 Jul 2018 14:46:25 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfab4ftwDZOhAQFukoFynJ2nMyT0DoqFWyDdik171Hlbta/mgaZfkv3SkFJw92g2TMD058n X-Received: by 2002:aed:3ec4:: with SMTP id o4-v6mr24681079qtf.252.1531259185473; Tue, 10 Jul 2018 14:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531259185; cv=none; d=google.com; s=arc-20160816; b=yg8mtJA+BazDOhVmWAxPEZ+CsPSP22brmTOj/CK0mwm7lNZRYChnuXLm/i2hty9brO hUjVT0wHWBPi4VWIuMWJbTzW1lCJVTCr2AhbTImABFIeicvPhAvi/eBNGDqom7o6PR0I W2JfwihNpFPIyChcZMnM4KH8N5LZblDs2w+9GryaVy6Kk/0TduhOV7LAaYExnfKKbdEG mEkt4iYKGuj3TSMPfhyJbiy3HP7l6sFQ2edkHU+DlkzyhJL9UfgvBH/hKnPCeer8I4Z7 ymm6l/BVqeNCtfGTbHgM2h4617zFCRcu3oA3E9lIcRWYXmlC2RX+4hlwqC2QJpo91A7b 3X6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:references :in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=LJdyLB6fnKb4gT2BHQUPjLVc3T3RXlI5n+luN1FknVo=; b=sQSo7quOclHWQdtDNKMTHTOad1OkXIFM6Fj/QcqDJa1PutfhAZXTMovbTI2NSWWV2n XtFU2rngxIJJTOferP1dG9tF0vRrzKYUmpkhNVv5OFpfp2ZQ4RyYkGB9hKVx55jZgFlQ 2arbXiGarqB8qhCtMtH1+G3Phw9h2IGBtsdJ5gkJ7YUJp3GMWEuyqAJXxKDOuDvPnh91 40a6UJ16jTwfW84+FqYDFpDI7M+fU5r+bhxGAMy62Fk5DkfUJn+M17PadnoV14Ct1EtB xI5u9peiJhiZ6QgIO3rf6dID+5YRWLmfT75d8PeqxXPiqk33yPnFOZrTNuOr9TtKGtk4 8ovQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id e4-v6si1691966qtc.150.2018.07.10.14.46.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jul 2018 14:46:25 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 mx1.redhat.com (Postfix) with ESMTPS id D1C794E90E; Tue, 10 Jul 2018 21:46:23 +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 803D61001949; Tue, 10 Jul 2018 21:46:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3077218037EF; Tue, 10 Jul 2018 21:46:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6ALk8Y7023419 for ; Tue, 10 Jul 2018 17:46:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id B988D2156700; Tue, 10 Jul 2018 21:46:07 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.bos.redhat.com (dhcp-17-157.bos.redhat.com [10.18.17.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 930DB2156891; Tue, 10 Jul 2018 21:46:07 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 10 Jul 2018 17:46:02 -0400 Message-Id: <34dec2cf3568a43193be17920ee37ca97a3dff21.1531259066.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: eskultet@redhat.com Subject: [libvirt] [PATCH v2 2/2] test: Implement virConnectListAllNodeDevices 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: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 10 Jul 2018 21:46:24 +0000 (UTC) Signed-off-by: Cole Robinson --- src/test/test_driver.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 7374c83eaa..3bc79bf358 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5381,6 +5381,18 @@ testNodeListDevices(virConnectPtr conn, cap, names, maxnames); } +static int +testConnectListAllNodeDevices(virConnectPtr conn, + virNodeDevicePtr **devices, + unsigned int flags) +{ + testDriverPtr driver = conn->privateData; + + virCheckFlags(VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP, -1); + + return virNodeDeviceObjListExport(conn, driver->devs, devices, + NULL, flags); +} static virNodeDevicePtr testNodeDeviceLookupByName(virConnectPtr conn, const char *name) @@ -7017,6 +7029,7 @@ static virStorageDriver testStorageDriver = { }; static virNodeDeviceDriver testNodeDeviceDriver = { + .connectListAllNodeDevices = testConnectListAllNodeDevices, /* 4.1.0 */ .connectNodeDeviceEventRegisterAny = testConnectNodeDeviceEventRegisterAny, /* 2.2.0 */ .connectNodeDeviceEventDeregisterAny = testConnectNodeDeviceEventDeregisterAny, /* 2.2.0 */ .nodeNumOfDevices = testNodeNumOfDevices, /* 0.7.2 */