From nobody Mon Feb 9 10:28:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1578556988; cv=none; d=zohomail.com; s=zohoarc; b=R29eTv66ulJZ5XYbMlWYSm7ZKPDPbgxE9O2hsk7lRlrADOgU9vJNXD6vQXnyxTiZWMAt2nZV0GjrM+Jk/w5YW+DBupOs0V8RdcpzXCkQwTwlxPKoIxnOrMuQS+r5YuWgHxvJT4t9bnsAvrrqGKE8omR8Ac6Aih89Pewn70+VNdQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578556988; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2czrs9xoGHK7kecrC7vTfSGBp5x5bWBSMiPwh+z3g+E=; b=RfriihGB2chXJzDYIB5Befp9uTaEQi0lf+B1Mo7VwmgLnhkYGwLliPzhOoiznlEl2oUcOYKofe1YrX9qqYxQKs3cZZb5lLQQsjC4OmhS7enCEM0ZgXPcizk08xoXf0CrCzzZOGs2LnefPC9mGWKese52GdehzRoFYDVYae15r9Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1578556988548733.6769064626628; Thu, 9 Jan 2020 00:03:08 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-39LGX7DtOHerEEC05IQwmA-1; Thu, 09 Jan 2020 03:03:02 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id B1C898005B4; Thu, 9 Jan 2020 08:02:56 +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 884D25DA2C; Thu, 9 Jan 2020 08:02:56 +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 3F87E503BA; Thu, 9 Jan 2020 08:02:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00982ip7012895 for ; Thu, 9 Jan 2020 03:02:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2E8A71000322; Thu, 9 Jan 2020 08:02:44 +0000 (UTC) Received: from hansolo.redhat.com (ovpn-12-147.pek2.redhat.com [10.72.12.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id F12461000328; Thu, 9 Jan 2020 08:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578556987; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2czrs9xoGHK7kecrC7vTfSGBp5x5bWBSMiPwh+z3g+E=; b=f3/95ay2lLSATIJjmHicNTQtptSr0UzBr9OrOtutM9nQGmoA5tzRpAjA4CWdyejaprzwa2 mNbP+5ljJXG9M9EqHVvn+fT93AwIduGXDZnT3Xv1m4kiRQ8GyVvq3oTa/U5IIlFrSGRW2u fP/+A60u3JlaOsG6zfle+uC8/nZK2z4= From: Han Han To: libvir-list@redhat.com Date: Thu, 9 Jan 2020 16:00:07 +0800 Message-Id: <20200109080009.20281-4-hhan@redhat.com> In-Reply-To: <20200109080009.20281-1-hhan@redhat.com> References: <20200109080009.20281-1-hhan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: mprivozn@redhat.com, pkrempa@redhat.com, Han Han Subject: [libvirt] [PATCH v2 3/5] conf: Add rng backend model builtin 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: , 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-MC-Unique: 39LGX7DtOHerEEC05IQwmA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The 'builtin' rng backend model can be used as following: Signed-off-by: Han Han --- docs/formatdomain.html.in | 10 ++++++++++ docs/formatdomaincaps.html.in | 1 + docs/schemas/domaincommon.rng | 6 ++++++ src/conf/domain_audit.c | 2 ++ src/conf/domain_conf.c | 9 +++++++++ src/conf/domain_conf.h | 1 + 6 files changed, 29 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 3040448df1..9621b5f120 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -8257,6 +8257,8 @@ qemu-kvm -net nic,model=3D? /dev/null <source mode=3D'bind' service=3D'1234'/> <source mode=3D'connect' host=3D'1.2.3.4' service=3D'1234'/> </backend> + <!-- OR --> + <backend model=3D'builtin'/> </rng> </devices> ... @@ -8321,6 +8323,14 @@ qemu-kvm -net nic,model=3D? /dev/null for more information.

+
builtin
+
+

+ This backend uses qemu builtin random generator, which uses + getrandom() syscall to generate random. + (Since 6.0.0 and QEMU 4.2) +

+
driver
diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in index 6bf7a1c17a..aa4dece220 100644 --- a/docs/formatdomaincaps.html.in +++ b/docs/formatdomaincaps.html.in @@ -481,6 +481,7 @@ <enum name=3D'backendModel'> <value>random</value> <value>egd</value> + <value>builtin</value> </enum> </rng> ... diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 9b555d6acb..bbcf6ce896 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5681,6 +5681,12 @@ + + + builtin + + + diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index fdccc585fb..138f270129 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -227,6 +227,7 @@ virDomainAuditRNG(virDomainObjPtr vm, newsrcpath =3D virDomainChrSourceDefGetPath(newDef->source.cha= rdev); break; =20 + case VIR_DOMAIN_RNG_BACKEND_BUILTIN: case VIR_DOMAIN_RNG_BACKEND_LAST: break; } @@ -242,6 +243,7 @@ virDomainAuditRNG(virDomainObjPtr vm, oldsrcpath =3D virDomainChrSourceDefGetPath(oldDef->source.cha= rdev); break; =20 + case VIR_DOMAIN_RNG_BACKEND_BUILTIN: case VIR_DOMAIN_RNG_BACKEND_LAST: break; } diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6b05d06481..dc0c8997bc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1112,6 +1112,7 @@ VIR_ENUM_IMPL(virDomainRNGBackend, VIR_DOMAIN_RNG_BACKEND_LAST, "random", "egd", + "builtin", ); =20 VIR_ENUM_IMPL(virDomainTPMModel, @@ -14783,6 +14784,7 @@ virDomainRNGDefParseXML(virDomainXMLOptionPtr xmlop= t, goto error; break; =20 + case VIR_DOMAIN_RNG_BACKEND_BUILTIN: case VIR_DOMAIN_RNG_BACKEND_LAST: break; } @@ -17709,6 +17711,7 @@ virDomainRNGFind(virDomainDefPtr def, continue; break; =20 + case VIR_DOMAIN_RNG_BACKEND_BUILTIN: case VIR_DOMAIN_RNG_BACKEND_LAST: break; } @@ -26386,6 +26389,11 @@ virDomainRNGDefFormat(virBufferPtr buf, return -1; virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); + break; + + case VIR_DOMAIN_RNG_BACKEND_BUILTIN: + virBufferAddLit(buf, "/>\n"); + break; =20 case VIR_DOMAIN_RNG_BACKEND_LAST: break; @@ -26417,6 +26425,7 @@ virDomainRNGDefFree(virDomainRNGDefPtr def) case VIR_DOMAIN_RNG_BACKEND_EGD: virObjectUnref(def->source.chardev); break; + case VIR_DOMAIN_RNG_BACKEND_BUILTIN: case VIR_DOMAIN_RNG_BACKEND_LAST: break; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e6b06a8eba..17d7ad9229 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2103,6 +2103,7 @@ typedef enum { typedef enum { VIR_DOMAIN_RNG_BACKEND_RANDOM, VIR_DOMAIN_RNG_BACKEND_EGD, + VIR_DOMAIN_RNG_BACKEND_BUILTIN, =20 VIR_DOMAIN_RNG_BACKEND_LAST } virDomainRNGBackend; --=20 2.24.0.rc1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list