From nobody Sun Feb 8 09:41:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500477020099636.4091181799078; Wed, 19 Jul 2017 08:10:20 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 80729356CF; Wed, 19 Jul 2017 15:10:17 +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 5212A783B7; Wed, 19 Jul 2017 15:10: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 E91C01853E3E; Wed, 19 Jul 2017 15:10:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6JFA9o7029652 for ; Wed, 19 Jul 2017 11:10:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7CA3660606; Wed, 19 Jul 2017 15:10:09 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 06D047840D for ; Wed, 19 Jul 2017 15:10:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 80729356CF Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 80729356CF From: Pavel Hrdina To: libvir-list@redhat.com Date: Wed, 19 Jul 2017 17:09:50 +0200 Message-Id: <9a5ac0bb32986f43e061ffa856e797019fa69da9.1500476925.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 5/6] qemu: don't pass qemuctime into virQEMUCapsIsValid 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 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 19 Jul 2017 15:10:18 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" It's not required and following patches will change the code. Signed-off-by: Pavel Hrdina Reviewed-by: Jiri Denemark --- src/qemu/qemu_capabilities.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index dd52a5f688..948a7d900b 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4283,11 +4283,11 @@ virQEMUCapsReset(virQEMUCapsPtr qemuCaps) =20 static bool virQEMUCapsIsValid(virQEMUCapsPtr qemuCaps, - time_t qemuctime, uid_t runUid, gid_t runGid) { bool kvmUsable; + struct stat sb; =20 if (!qemuCaps->binary) return true; @@ -4304,24 +4304,19 @@ virQEMUCapsIsValid(virQEMUCapsPtr qemuCaps, return false; } =20 - if (!qemuctime) { - struct stat sb; - - if (stat(qemuCaps->binary, &sb) < 0) { - char ebuf[1024]; - VIR_DEBUG("Failed to stat QEMU binary '%s': %s", - qemuCaps->binary, - virStrerror(errno, ebuf, sizeof(ebuf))); - return false; - } - qemuctime =3D sb.st_ctime; + if (stat(qemuCaps->binary, &sb) < 0) { + char ebuf[1024]; + VIR_DEBUG("Failed to stat QEMU binary '%s': %s", + qemuCaps->binary, + virStrerror(errno, ebuf, sizeof(ebuf))); + return false; } =20 - if (qemuctime !=3D qemuCaps->ctime) { + if (sb.st_ctime !=3D qemuCaps->ctime) { VIR_DEBUG("Outdated capabilities for '%s': QEMU binary changed " "(%lld vs %lld)", qemuCaps->binary, - (long long) qemuctime, (long long) qemuCaps->ctime); + (long long) sb.st_ctime, (long long) qemuCaps->ctime); return false; } =20 @@ -4401,7 +4396,7 @@ virQEMUCapsInitCached(virCapsPtr caps, goto discard; } =20 - if (!virQEMUCapsIsValid(qemuCaps, qemuctime, runUid, runGid)) + if (!virQEMUCapsIsValid(qemuCaps, runUid, runGid)) goto discard; =20 VIR_DEBUG("Loaded '%s' for '%s' ctime %lld usedQMP=3D%d", @@ -5411,7 +5406,7 @@ virQEMUCapsCacheValidate(virQEMUCapsCachePtr cache, virQEMUCapsPtr *qemuCaps) { if (*qemuCaps && - !virQEMUCapsIsValid(*qemuCaps, 0, cache->runUid, cache->runGid)) { + !virQEMUCapsIsValid(*qemuCaps, cache->runUid, cache->runGid)) { VIR_DEBUG("Cached capabilities %p no longer valid for %s", *qemuCaps, binary); virHashRemoveEntry(cache->binaries, binary); --=20 2.13.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list