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,