From nobody Tue Feb 10 20:06:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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.129.124]) by mx.zohomail.com with SMTPS id 1638541243110856.6231027677816; Fri, 3 Dec 2021 06:20:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-281-DBFaAXviO6qtNuEyHo9fNg-1; Fri, 03 Dec 2021 09:20:38 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29B631926DBB; Fri, 3 Dec 2021 14:20:24 +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 9923E18831; Fri, 3 Dec 2021 14:20:23 +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 E95101809CB8; Fri, 3 Dec 2021 14:20:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1B3EKLQl026009 for ; Fri, 3 Dec 2021 09:20:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 80DA64047279; Fri, 3 Dec 2021 14:20:21 +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 7CFB24047272 for ; Fri, 3 Dec 2021 14:20:21 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 6401B181E066 for ; Fri, 3 Dec 2021 14:20:21 +0000 (UTC) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-417-b3YAFoG5NCq5zBotKj7uRg-1; Fri, 03 Dec 2021 09:20:19 -0500 Received: by mail-pj1-f51.google.com with SMTP id j6-20020a17090a588600b001a78a5ce46aso5324319pji.0 for ; Fri, 03 Dec 2021 06:20:18 -0800 (PST) Received: from localhost ([2400:ddc0:1000::b373:390c]) by smtp.gmail.com with ESMTPSA id h2sm3881784pfc.190.2021.12.03.06.20.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Dec 2021 06:20:16 -0800 (PST) X-MC-Unique: DBFaAXviO6qtNuEyHo9fNg-1 X-MC-Unique: b3YAFoG5NCq5zBotKj7uRg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZR5gouPux4tTEPgwndTqmqkwKCYoY9L6mKsQ0G112uw=; b=DXB4oabn0g+Q+FaHMPb+mf8tiV0jljhqKTjwVEJpCcb8CmxLAtppDSpM9SiEnmFudY bizL6rkvZWWTv0UFdjWrMypcsN/TFnoMy4l9J5w+ClTcrx3jQgtaPwY++jOEsnBuZsc7 aUmK+MICAE/w1a9W3/zku0icxnDPDh7VwNsNKPlUbLei+1+FCmLTsaXOCzHkIWDQrS6h NbkNUqSuJCSCWPDmYl3b5U6jzecVXXaPqOEYzErGGgE0waK2aKGujZxZK5f97gkM4HE+ +UwiFZp9e27+usq4AhIQJjcz/4e8+V2Fawe19pLjEbpN7ScPNnGUKm20ZEMXtVwxQYtW hAyQ== X-Gm-Message-State: AOAM532KRakXhzyy0ZBk1IuERFuPMBNq300SM1qAP7t2dbL1oUHv475F p2mBU8wUMre/Xi8PykFIG82qahqGlfwD4nXr X-Google-Smtp-Source: ABdhPJw0cjNvjNr2yk8Ddb2/UEWY33jY4WMfbSSmCOC4S5cHfOM9o6c/VphYoOYqm8KmYDZv70ulrw== X-Received: by 2002:a17:90a:909:: with SMTP id n9mr14500296pjn.1.1638541217169; Fri, 03 Dec 2021 06:20:17 -0800 (PST) From: Luke Yue To: libvir-list@redhat.com Subject: [PATCH v2 1/4] test_driver: Implement virDomainGetSecurityLabelList Date: Fri, 3 Dec 2021 22:19:54 +0800 Message-Id: <20211203141957.686148-2-lukedyue@gmail.com> In-Reply-To: <20211203141957.686148-1-lukedyue@gmail.com> References: <20211203141957.686148-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.84 on 10.11.54.2 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.12 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: 1638541244395100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Luke Yue --- src/test/test_driver.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index b6bca884f0..e9d009cfdb 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, @@ -5275,6 +5276,47 @@ 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; + } + if (i =3D=3D 0) + (*seclabels)[i].enforcing =3D 1; + } + ret =3D len; + } + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + static int testNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel) @@ -10049,6 +10091,7 @@ static virHypervisorDriver testHypervisorDriver =3D= { .domainPinIOThread =3D testDomainPinIOThread, /* 7.8.0 */ .domainSetIOThreadParams =3D testDomainSetIOThreadParams, /* 7.8.0 */ .domainGetSecurityLabel =3D testDomainGetSecurityLabel, /* 7.5.0 */ + .domainGetSecurityLabelList =3D testDomainGetSecurityLabelList, /* 8.0= .0 */ .nodeGetSecurityModel =3D testNodeGetSecurityModel, /* 7.5.0 */ .domainGetXMLDesc =3D testDomainGetXMLDesc, /* 0.1.4 */ .domainSetMemoryParameters =3D testDomainSetMemoryParameters, /* 5.6.0= */ --=20 2.34.1