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;