From nobody Tue Feb 10 06:52:30 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 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 16305858078051020.3022687770663; Thu, 2 Sep 2021 05:30:07 -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-234-t-5QqLinPHinR26BD-vBSA-1; Thu, 02 Sep 2021 08:30:05 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C9122194092A; Thu, 2 Sep 2021 12:29:59 +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 BFB756A8FF; Thu, 2 Sep 2021 12:29:57 +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 08FBB44A5A; Thu, 2 Sep 2021 12:29:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 182CTqLR029174 for ; Thu, 2 Sep 2021 08:29:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id EDB7B2095BA3; Thu, 2 Sep 2021 12:29:51 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E973F2095BB6 for ; Thu, 2 Sep 2021 12:29:48 +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 79703185A794 for ; Thu, 2 Sep 2021 12:29:48 +0000 (UTC) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-470-Qgd-ygDUNlW7s34x9UbbAw-1; Thu, 02 Sep 2021 08:29:46 -0400 Received: by mail-pl1-f170.google.com with SMTP id q3so1074753plx.4 for ; Thu, 02 Sep 2021 05:29:46 -0700 (PDT) Received: from localhost ([38.94.109.214]) by smtp.gmail.com with ESMTPSA id e2sm2471568pfn.141.2021.09.02.05.29.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 05:29:44 -0700 (PDT) X-MC-Unique: t-5QqLinPHinR26BD-vBSA-1 X-MC-Unique: Qgd-ygDUNlW7s34x9UbbAw-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=82w/pZB+DZ1qNBYZI1yBrQgFAEaePtZTeQpXqbsBMyA=; b=crh7grsO96OAOi3KMqN23LAeGtrkKoTHbg2XxNBAWxHsuTJHe5UzwSahNqSO4KHHOJ /F6F2K3a6pd7NrCYwkcAAuKARQzkzEUeDKWq5pfMRw62KkWH0tSgnc/KAsxIGU1HoezY br5nPtgCGxittVk3QloZpYd6OVS+mBw+p2NbS4cv4NHz+vh1Yc0nEjBtacE5FmbtoEia 1q6SKuPEQk+E62OELv+QWa3OpVWCK+33ai1xkU5nddn6TIZTZ+Ct+/D+2nSFeyH5mcpZ rsuGECkevwpq0KxkQFcV3tSpy4BflSJE9rcmTAyXHNnSlviXAwtyMzElH8u3d3fMoLev 3Y4A== X-Gm-Message-State: AOAM531jXHchrQ7erPGCSBp7oQXBVZVnjBzMvfmalEQkycUxv/9yx+7Z +LVFrrHSH0f6HLqy0ecLoVTHEdsmh/Ec0YTsOpE= X-Google-Smtp-Source: ABdhPJyslZiKAGj2yDi8A+ltOjG99pjUE9ECM6As8m4ERHkPhfcTjUDq+ubIwoDCDavPMdk4f39hng== X-Received: by 2002:a17:90a:ae12:: with SMTP id t18mr3633552pjq.211.1630585785202; Thu, 02 Sep 2021 05:29:45 -0700 (PDT) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH 1/3] test_driver: Implement virDomainGetSecurityLabelList Date: Thu, 2 Sep 2021 20:29:34 +0800 Message-Id: <20210902122936.57399-2-lukedyue@gmail.com> In-Reply-To: <20210902122936.57399-1-lukedyue@gmail.com> References: <20210902122936.57399-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.4 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.15 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 X-ZM-MESSAGEID: 1630585808426100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- src/test/test_driver.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2f19b7c520..1b5914c890 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -137,6 +137,7 @@ VIR_ONCE_GLOBAL_INIT(testDriver); =20 #define TEST_MODEL "i686" #define TEST_EMULATOR "/usr/bin/test-hv" +#define TEST_SECURITY_LABEL_LIST_LENGTH 2 =20 static const virNodeInfo defaultNodeInfo =3D { TEST_MODEL, @@ -5261,6 +5262,46 @@ testDomainGetSecurityLabel(virDomainPtr dom, return ret; } =20 +static int +testDomainGetSecurityLabelList(virDomainPtr dom, + virSecurityLabelPtr* seclabels) +{ + virDomainObj *vm; + size_t i; + int ret =3D -1; + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (!virDomainObjIsActive(vm)) { + /* No seclabels */ + *seclabels =3D NULL; + ret =3D 0; + } else { + int len =3D TEST_SECURITY_LABEL_LIST_LENGTH; + + (*seclabels) =3D g_new0(virSecurityLabel, len); + memset(*seclabels, 0, sizeof(**seclabels) * len); + + /* Fill the array */ + for (i =3D 0; i < len; i++) { + if (virStrcpyStatic((*seclabels)[i].label, "libvirt-test") < 0= ) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("security label exceeds maximum: %zu"), + sizeof((*seclabels)[i].label) - 1); + g_clear_pointer(seclabels, g_free); + goto cleanup; + } + (*seclabels)[i].enforcing =3D 1; + } + ret =3D len; + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + static int testNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel) @@ -9615,6 +9656,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainGetVcpuPinInfo =3D testDomainGetVcpuPinInfo, /* 1.2.18 */ .domainGetMaxVcpus =3D testDomainGetMaxVcpus, /* 0.7.3 */ .domainGetSecurityLabel =3D testDomainGetSecurityLabel, /* 7.5.0 */ + .domainGetSecurityLabelList =3D testDomainGetSecurityLabelList, /* 7.8= .0 */ .nodeGetSecurityModel =3D testNodeGetSecurityModel, /* 7.5.0 */ .domainGetXMLDesc =3D testDomainGetXMLDesc, /* 0.1.4 */ .domainSetMemoryParameters =3D testDomainSetMemoryParameters, /* 5.6.0= */ --=20 2.33.0