From nobody Mon Feb 9 00:20:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623051737; cv=none; d=zohomail.com; s=zohoarc; b=bEWyTP8W1GFZtIKi2H5d8tlQ9ZreUmGVAe0W8eHjW0RYfrWoGZJLGpy52zMJ8LmsfVZEO+tQKsQCDVf0xMmJPyI8/EOtumV5nE3NhRrab9jYA/XQ5/aSMHdUhbAyde5cNsrvSoq28iUoVQ7RXpZSHFBB5Qs8GiHH3doCtXEyJto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623051737; h=Content-Type:Content-Transfer-Encoding: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=NjchygWS3kxUY38w4se/2INYB/OLnFeObQmMzHfkagA=; b=ebr1CvGRhodilK7TwEfclrirFPn8KUmSNx3aCkcu0YbZ6Cn2o7YfiXV08W1iLvxXB0Tb8vgw2tImUEZQ+X0Lkf07v2Eb9PNcJvh3dT4hZEh3Rpsc3d4kKlmEEd65Y3FHd0FEZO/Y/ZX4p0MlOEA+PgEyR4jFjHALLgR5cwhxfYU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1623051737681808.4471697537384; Mon, 7 Jun 2021 00:42:17 -0700 (PDT) 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-398-YUIFb4B2M5KFwNJ4hOShZg-1; Mon, 07 Jun 2021 03:42:14 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 289A080ED8E; Mon, 7 Jun 2021 07:42:10 +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 084E12B0BC; Mon, 7 Jun 2021 07:42:10 +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 C7E8F44A58; Mon, 7 Jun 2021 07:42:09 +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 1577cbEi028380 for ; Mon, 7 Jun 2021 03:38:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id F076521623B3; Mon, 7 Jun 2021 07:38:36 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC49B2157426 for ; Mon, 7 Jun 2021 07:38:33 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0E792101D228 for ; Mon, 7 Jun 2021 07:38:33 +0000 (UTC) Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-AwWrC_VEONeKMIlgMUYpRg-1; Mon, 07 Jun 2021 03:38:30 -0400 Received: by mail-pg1-f173.google.com with SMTP id t9so13174577pgn.4 for ; Mon, 07 Jun 2021 00:38:30 -0700 (PDT) Received: from localhost ([38.94.108.250]) by smtp.gmail.com with ESMTPSA id fw16sm10009773pjb.30.2021.06.07.00.38.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Jun 2021 00:38:29 -0700 (PDT) X-MC-Unique: YUIFb4B2M5KFwNJ4hOShZg-1 X-MC-Unique: AwWrC_VEONeKMIlgMUYpRg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NjchygWS3kxUY38w4se/2INYB/OLnFeObQmMzHfkagA=; b=DF9SjrD9G0ouoN9ij4mh7Cdnf2ktcBY3fiR9jCwDBnrWaziXUXykzk/rT6ln9wfwN0 ZICRrl+fygGUTx1TIqiKj+kEkEmiNfQNSIZ97r3EwcB/5yYji43GaV/3XPpyBZKSRec5 smy5ZwU8WZlgiwDFWFnkJ/TQQ/JKaMjPE83I9+BQePOmUnjy7mqubI8QEA6mn1dXTQrR j/UYrLNYnKtMvsH7LlGl7Fe0BBW7TqSqUTXhok1VhbSt6i+unypO+ApUrcsWxt7xm5XX KfLWoLos3YcggTOnRuqtl60RzWDQxSs/HeviEhBmoA3uy7XiZ8ZCCB7SBiwI/BAZNp89 eNmQ== X-Gm-Message-State: AOAM531dX3C24u8xQ9lFWpZRIrXr/ZHVJV3fWhfn7hHhI4dJ1RdiH7hb sVTCWZ6mxCgRyU2d8WZVWawIoih/iN8qVIf5NlY= X-Google-Smtp-Source: ABdhPJx1kWcA1EhFl/Rd9ht7WYkMD6QzkGidypCdATPYdxQSyv9LrtIFpC7UJ8rWogAZ7TMpKIZk8Q== X-Received: by 2002:aa7:921a:0:b029:2cf:b55b:9d52 with SMTP id 26-20020aa7921a0000b02902cfb55b9d52mr15502657pfo.35.1623051509576; Mon, 07 Jun 2021 00:38:29 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH 1/2] test_driver: Implement virNodeGetSecurityModel Date: Mon, 7 Jun 2021 15:38:18 +0800 Message-Id: <20210607073819.240931-2-lukedyue@gmail.com> In-Reply-To: <20210607073819.240931-1-lukedyue@gmail.com> References: <20210607073819.240931-1-lukedyue@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue Reviewed-by: Martin Kletzander --- src/test/test_driver.c | 32 ++++++++++++++++++++++++++++++++ tests/virshtest.c | 2 ++ 2 files changed, 34 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index ea5a5005e7..2651301629 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4963,6 +4963,7 @@ static int testDomainBlockStats(virDomainPtr domain, } =20 =20 + static int testDomainInterfaceAddressFromNet(testDriver *driver, const virDomainNetDef *net, @@ -5006,6 +5007,36 @@ testDomainInterfaceAddressFromNet(testDriver *driver, return ret; } =20 +static int +testNodeGetSecurityModel(virConnectPtr conn, + virSecurityModelPtr secmodel) +{ + testDriver *driver =3D conn->privateData; + + memset(secmodel, 0, sizeof(*secmodel)); + + if (driver->caps->host.nsecModels =3D=3D 0 || + driver->caps->host.secModels[0].model =3D=3D NULL) + return 0; + + if (virStrcpy(secmodel->model, driver->caps->host.secModels[0].model, + VIR_SECURITY_MODEL_BUFLEN) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security model string exceeds max %d bytes"), + VIR_SECURITY_MODEL_BUFLEN - 1); + return -1; + } + + if (virStrcpy(secmodel->doi, driver->caps->host.secModels[0].doi, + VIR_SECURITY_DOI_BUFLEN) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security DOI string exceeds max %d bytes"), + VIR_SECURITY_DOI_BUFLEN - 1); + return -1; + } + + return 0; +} =20 static int testDomainInterfaceAddresses(virDomainPtr dom, @@ -9295,6 +9326,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainGetVcpus =3D testDomainGetVcpus, /* 0.7.3 */ .domainGetVcpuPinInfo =3D testDomainGetVcpuPinInfo, /* 1.2.18 */ .domainGetMaxVcpus =3D testDomainGetMaxVcpus, /* 0.7.3 */ + .nodeGetSecurityModel =3D testNodeGetSecurityModel, /* 7.5.0 */ .domainGetXMLDesc =3D testDomainGetXMLDesc, /* 0.1.4 */ .domainSetMemoryParameters =3D testDomainSetMemoryParameters, /* 5.6.0= */ .domainGetMemoryParameters =3D testDomainGetMemoryParameters, /* 5.6.0= */ diff --git a/tests/virshtest.c b/tests/virshtest.c index add33215b7..119b2ef54d 100644 --- a/tests/virshtest.c +++ b/tests/virshtest.c @@ -34,6 +34,8 @@ Used memory: 131072 KiB\n\ Persistent: yes\n\ Autostart: disable\n\ Managed save: no\n\ +Security model: testSecurity\n\ +Security DOI: \n\ \n"; static const char *domuuid_fc4 =3D DOM_UUID "\n\n"; static const char *domid_fc4 =3D "2\n\n"; --=20 2.31.1