From patchwork Fri Feb 23 23:16:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 129498 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1144516lja; Fri, 23 Feb 2018 15:16:20 -0800 (PST) X-Google-Smtp-Source: AG47ELuw0+nYd3Lu1Uvxqbe7Y8vhfNE9PcHJAdc4wZFJQ/kJjDVuKDrlq3I1LHqhVh6k4ZtO60G/ X-Received: by 10.157.48.153 with SMTP id s25mr2214221otc.148.1519427780327; Fri, 23 Feb 2018 15:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519427780; cv=none; d=google.com; s=arc-20160816; b=giY/lUiIrBSm5F/KW/Uz2lvs23z6BwYNyS6dpjT5pg2dYbTm701F1JT1m8ys0gnDOj WiMtZKFD6GJf1JALMmyVyhO/r0T8f1LhYl4C2KJPtK4dAyLUxkgoQABsW6fvBEtuSCqH 6c6t1tAPCXxuG+Pc7GG5D/QLt6Iq68+MHe+Zf7FrrUsFbT7Yt/VlzO13fB7iZZwGhay8 riwb66MZwjFSVZw+hNfCKpsGnVeKVGqCciaFbWVIqInv95Q0vscjJ5WhJtEVt1n6BFGE zn9jxT86ZuhaD3icYFb0iyLfN77d8KGSOcfoOon7NWGXGuETGzVMnojUAMNDwaAU0bKC /m4Q== 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:references:in-reply-to:references :in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=3GXRXdQAU9XLQtCRz5nu0BAxorBEvFUs+qq+W+MhHUg=; b=hp16J16/1Rr6lGjxzlrmkpd8XBosIcF8CzgA8cGI/nFPAxEXJqIbLlerQc34Hao/KN NE8jz8+4fvZxl5BNlJ0m+PczQR9jGmAwhcqN3mC0kCTzCEM3Buy2dTgVgz2796XAUYmw PXEXVwO0Z5rHa7KgOkg5I4D7jDU8sNAoa2pclNNq8BzZQw1MS4wL/1R29HDyFTxprgP9 eS+vyqf6CCTyYQuhdZuvY4EDM8hI+CC4iD6gDVRb8ZeegdVbXmwKr/nGU75J8v/S6oHE wljc+1OH9xuA/LJ/PwXCNPBMid/q4A5BPGpWCI9xbw5uo04NFZwcff13XlQBAR85hmAf 6a6w== 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 c47si1139143otj.294.2018.02.23.15.16.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 15:16:20 -0800 (PST) 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-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 mx1.redhat.com (Postfix) with ESMTPS id BBD1A3DFD0; Fri, 23 Feb 2018 23:16: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 3937160C93; Fri, 23 Feb 2018 23:16: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 97F8F18033EC; Fri, 23 Feb 2018 23:16:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1NNGE24017935 for ; Fri, 23 Feb 2018 18:16:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8B47D5D965; Fri, 23 Feb 2018 23:16:14 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-116-122.phx2.redhat.com [10.3.116.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3357E5D9C5; Fri, 23 Feb 2018 23:16:14 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 23 Feb 2018 18:16:07 -0500 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 23 Feb 2018 23:16:19 +0000 (UTC) Add a 'testdriver' bool that we set for test_driver.c nodedevs which will skip accessing host resources via virNodeDeviceUpdateCaps Signed-off-by: Cole Robinson --- src/conf/node_device_conf.c | 3 +++ src/conf/node_device_conf.h | 1 + src/test/test_driver.c | 2 ++ 3 files changed, 6 insertions(+) -- 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index fd8f4e4a9..90c940f11 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -2425,6 +2425,9 @@ virNodeDeviceUpdateCaps(virNodeDeviceDefPtr def) { virNodeDevCapsDefPtr cap = def->caps; + if (def->testdriver) + return 0; + while (cap) { switch (cap->data.type) { case VIR_NODE_DEV_CAP_SCSI_HOST: diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 685ae3034..665f766e2 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -316,6 +316,7 @@ struct _virNodeDeviceDef { char *driver; /* optional driver name */ char *devnode; /* /dev path */ char **devlinks; /* /dev links */ + bool testdriver; /* if true, skip host checks */ virNodeDevCapsDefPtr caps; /* optional device capabilities */ }; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 043caa976..39784c9fa 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1165,6 +1165,7 @@ testParseNodedevs(testDriverPtr privconn, if (!def) goto error; + def->testdriver = true; if (!(obj = virNodeDeviceObjListAssignDef(privconn->devs, def))) { virNodeDeviceDefFree(def); goto error; @@ -5565,6 +5566,7 @@ testNodeDeviceMockCreateVport(testDriverPtr driver, caps = caps->next; } + def->testdriver = true; if (!(obj = virNodeDeviceObjListAssignDef(driver->devs, def))) goto cleanup; def = NULL; From patchwork Fri Feb 23 23:16:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 129500 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1144518lja; Fri, 23 Feb 2018 15:16:20 -0800 (PST) X-Google-Smtp-Source: AH8x224GcXBoVgHgpkq29kSjFSvl3u855CTaEIyzd2qCwT4YB4gIJQxxVZn5EEDF0rTez5Ch9ba4 X-Received: by 10.157.64.225 with SMTP id t30mr2242221oti.293.1519427780598; Fri, 23 Feb 2018 15:16:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519427780; cv=none; d=google.com; s=arc-20160816; b=WeOZj0ePp2rf1edAr7EmLhHXwvisWmxzXuabNKmgNjVjgC2ZILkf9QnGBuOW57Pf/v o86Kd0TG13MhtGTfEU7wOgh/j283rIUSsxPhNgp88bil3plCfRV+k52A/x08Wb2gQ3VH vzGZ0MEY8I+uQkfXFbdGAWR7zjc+VkU3CnFOt5XhUdtjWvNz0Jvyf5rMVe9Zs7Kmrw0E Bzxse06ilqhh5IAyzFPrQbkFBBq0JEy85KNbnzKamJd4EXGJVC5fmo36KbYz2xmvmgXq xFLjOnY15WxQLpD2g1O1AP5cYTrLoRwCvW+JnrFkaalMI6fQd90sq4f3Ya7KovSfv/by Z3pg== 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:references:in-reply-to:references :in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=VYLpR/KX51jrVhSUTgdvA1Gr4lAMjnb7O+W06oS58Pk=; b=jhtR1xF3azjR/7rkjH3U25cg/tkDLCx08Hm89xom/McmxmlURVS31eH9+bQIl1jNy1 x78mlApJu8PzGnYh3SMKiZTPt8dt8pvQ6jfS/i1UO9pOFOcJYrMBykds/QKZevVwHRqJ oiUOgEKCk11rXvdO48lrv4NRZhjAiLbGTZMZvRNvo/qJbSTxtg4WZowYt2nthV2wX/lQ nr+piTbw/9uyEAbAd94qlMPm5/19DpT+P56/z6aBExDvOTagJmlHUPqpKOADIO60JBy5 /OF+1r1uJlM2whVvvLB+SNrAU1B55N322eZysOS9irt6P59zFDOo5j6HxjoeAOHmpySZ M98A== 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 t189si1033596oib.403.2018.02.23.15.16.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Feb 2018 15:16:20 -0800 (PST) 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-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 mx1.redhat.com (Postfix) with ESMTPS id 611FF757D4; Fri, 23 Feb 2018 23:16:19 +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 1E9645C25A; Fri, 23 Feb 2018 23:16:19 +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 D09CB4A46C; Fri, 23 Feb 2018 23:16:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1NNGFP8017941 for ; Fri, 23 Feb 2018 18:16:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7003B5D965; Fri, 23 Feb 2018 23:16:15 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-116-122.phx2.redhat.com [10.3.116.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id F188D5D9C5; Fri, 23 Feb 2018 23:16:14 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 23 Feb 2018 18:16:08 -0500 Message-Id: <5acbdcd616caf430445683c401137e24ebfd5439.1519427518.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 23 Feb 2018 23:16:19 +0000 (UTC) Signed-off-by: Cole Robinson --- src/test/test_driver.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: John Ferlan diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 39784c9fa..844e99dd7 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5385,6 +5385,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) @@ -7022,6 +7034,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 */