From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1611335941; cv=none; d=zohomail.com; s=zohoarc; b=SoxWxc2VaPuEHj96OJVk28+ZvWf7sEM0UrLPNU16y5+gW3mZa+aqd/KOnPz8B6ISX9zNo/PCQlFXvGHldJ/BQSJSugl5FrMo6I+gsvWRpuVGEltW4tUG+h7lKMx5f10LfzytC6iQ0wxW5fDC9hyjrh98DWeIV7JmbOE7ud5ZhO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611335941; 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=Rt5Uk3ciA5kKg+Eg62i1SWI339J3IlLjJFVLWkwWW5o=; b=AwMinSFydLGQuLaL0iuPcelBkzFcd0dh+yLoD+C6MD6yPx+HdESIsaT9J+VtoKYK9ET4xD4kuJF0OpazNUqxrvepW7j7d/aBHhDVIgS41Qu6g4YKbETjmdzim7l79budvForTr3jFIwJchoF4grW+4M9yOLmPkozbOeK3r0UJqs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1611335941946138.0488284972023; Fri, 22 Jan 2021 09:19:01 -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-433-E79_a-_RPSWFFM5QqCM2yg-1; Fri, 22 Jan 2021 12:18:57 -0500 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 EE3B48030A1; Fri, 22 Jan 2021 17:18:51 +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 CBE7C5D722; Fri, 22 Jan 2021 17:18:51 +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 965261809CA1; Fri, 22 Jan 2021 17:18:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHIil4009523 for ; Fri, 22 Jan 2021 12:18:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1AD2F60C43; Fri, 22 Jan 2021 17:18:44 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7138360BF3; Fri, 22 Jan 2021 17:18:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611335940; 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=Rt5Uk3ciA5kKg+Eg62i1SWI339J3IlLjJFVLWkwWW5o=; b=Yd56087mnlz+SaWAlHPacQhEFD0qZNSjo/egObUglWyodfbGaVLcab0DQFGEc3kmLzgu/J MOrvGvodbc2ESlyfRFqsREpPP3MFNMs4CAJp1UcpcO3SeSfPNxB/ggBjK/67BkWkPUZ16z ndLLZlFcW9t5EdzNbiZQVClsSGt0S/U= X-MC-Unique: E79_a-_RPSWFFM5QqCM2yg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/16] qemu: report whether a CPU model is deprecated in dom capabilities Date: Fri, 22 Jan 2021 17:18:21 +0000 Message-Id: <20210122171836.3523210-2-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) QEMU has the ability to mark CPUs as deprecated. This should be exposed to management applications in the domain capabilities. This attribute is only set when the model is actually deprecated. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- docs/formatdomaincaps.html.in | 10 ++++++---- docs/schemas/domaincaps.rng | 8 ++++++++ src/conf/domain_capabilities.c | 14 ++++++++++---- src/conf/domain_capabilities.h | 4 +++- src/qemu/qemu_capabilities.c | 10 +++++++++- src/qemu/qemu_monitor.c | 1 + src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 4 ++++ tests/cputest.c | 4 ++-- tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 4 ++-- tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 4 ++-- tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 4 ++-- tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 16 ++++++++-------- 13 files changed, 58 insertions(+), 26 deletions(-) diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in index 65ab5574d3..8df88f5355 100644 --- a/docs/formatdomaincaps.html.in +++ b/docs/formatdomaincaps.html.in @@ -214,9 +214,9 @@ <feature policy=3D'require' name=3D'vmx'/> </mode> <mode name=3D'custom' supported=3D'yes'> - <model usable=3D'no'>Broadwell</model> - <model usable=3D'yes'>Broadwell-noTSX</model> - <model usable=3D'no'>Haswell</model> + <model usable=3D'no' deprecated=3D'no'>Broadwell</model> + <model usable=3D'yes' deprecated=3D'no'>Broadwell-noTSX</mo= del> + <model usable=3D'no' deprecated=3D'yes'>Haswell</model> ... </mode> </cpu> @@ -262,7 +262,9 @@ cannot be used without disabling some features that the CPU of such model is expected to have. A special value unknown indicates libvirt does not have enough information to provide the - usability data. + usability data. The deprecated attribute reflects + the hypervisor's policy on usage of this model + (since 7.1.0). =20 diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng index 0dbffb28ac..a57ef715c3 100644 --- a/docs/schemas/domaincaps.rng +++ b/docs/schemas/domaincaps.rng @@ -138,6 +138,14 @@ unknown + + + + yes + no + + + diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 8130311590..cdb1b31af6 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -175,7 +175,8 @@ virDomainCapsCPUModelsCopy(virDomainCapsCPUModelsPtr ol= d) if (virDomainCapsCPUModelsAdd(cpuModels, old->models[i].name, old->models[i].usable, - old->models[i].blockers) < 0) + old->models[i].blockers, + old->models[i].deprecated) < 0) goto error; } =20 @@ -191,7 +192,8 @@ int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels, const char *name, virDomainCapsCPUUsable usable, - char **blockers) + char **blockers, + bool deprecated) { g_autofree char * nameCopy =3D NULL; virDomainCapsCPUModelPtr cpu; @@ -208,6 +210,7 @@ virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpu= Models, cpu->usable =3D usable; cpu->name =3D g_steal_pointer(&nameCopy); cpu->blockers =3D g_strdupv(blockers); + cpu->deprecated =3D deprecated; =20 return 0; } @@ -388,8 +391,11 @@ virDomainCapsCPUCustomFormat(virBufferPtr buf, =20 for (i =3D 0; i < custom->nmodels; i++) { virDomainCapsCPUModelPtr model =3D custom->models + i; - virBufferAsprintf(buf, "%s\n", - virDomainCapsCPUUsableTypeToString(model->usable= ), + virBufferAsprintf(buf, "usable= )); + if (model->deprecated) + virBufferAddLit(buf, " deprecated=3D'yes'"); + virBufferAsprintf(buf, ">%s\n", model->name); } =20 diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index b22d40abb2..f454780185 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -146,6 +146,7 @@ struct _virDomainCapsCPUModel { char *name; virDomainCapsCPUUsable usable; char **blockers; /* NULL-terminated list of usability blockers */ + bool deprecated; }; =20 typedef struct _virDomainCapsCPUModels virDomainCapsCPUModels; @@ -228,7 +229,8 @@ virDomainCapsCPUModelsPtr virDomainCapsCPUModelsCopy(vi= rDomainCapsCPUModelsPtr o int virDomainCapsCPUModelsAdd(virDomainCapsCPUModelsPtr cpuModels, const char *name, virDomainCapsCPUUsable usable, - char **blockers); + char **blockers, + bool deprecated); virDomainCapsCPUModelPtr virDomainCapsCPUModelsGet(virDomainCapsCPUModelsPtr cpuModels, const char *name); diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d656732c3e..61467eb6c2 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2176,7 +2176,7 @@ virQEMUCapsCPUDefsToModels(qemuMonitorCPUDefsPtr defs, continue; =20 if (virDomainCapsCPUModelsAdd(cpuModels, cpu->name, cpu->usable, - cpu->blockers) < 0) + cpu->blockers, cpu->deprecated) < 0) return NULL; } =20 @@ -3896,6 +3896,7 @@ virQEMUCapsLoadCPUModels(virQEMUCapsAccelPtr caps, int usable =3D VIR_DOMCAPS_CPU_USABLE_UNKNOWN; g_autofree char * strUsable =3D NULL; g_autofree xmlNodePtr * blockerNodes =3D NULL; + g_autofree char *deprecated =3D NULL; int nblockers; =20 if ((strUsable =3D virXMLPropString(nodes[i], "usable")) && @@ -3940,6 +3941,11 @@ virQEMUCapsLoadCPUModels(virQEMUCapsAccelPtr caps, } } } + + deprecated =3D virXMLPropString(nodes[i], "deprecated"); + if (deprecated && + STREQ(deprecated, "yes")) + cpu->deprecated =3D true; } =20 caps->cpuModels =3D g_steal_pointer(&defs); @@ -4448,6 +4454,8 @@ virQEMUCapsFormatCPUModels(virQEMUCapsAccelPtr caps, virBufferAsprintf(buf, " usable=3D'%s'", virDomainCapsCPUUsableTypeToString(cpu->usab= le)); } + if (cpu->deprecated) + virBufferAddLit(buf, " deprecated=3D'yes'"); =20 if (cpu->blockers) { size_t j; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 09b8617097..990519252e 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3673,6 +3673,7 @@ qemuMonitorCPUDefsCopy(qemuMonitorCPUDefsPtr src) cpuDst->name =3D g_strdup(cpuSrc->name); cpuDst->type =3D g_strdup(cpuSrc->type); cpuDst->blockers =3D g_strdupv(cpuSrc->blockers); + cpuDst->deprecated =3D cpuSrc->deprecated; } =20 return g_steal_pointer(&defs); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index a07617ec28..67f149ebde 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1193,6 +1193,7 @@ struct _qemuMonitorCPUDefInfo { char *name; char *type; char **blockers; /* NULL-terminated string list */ + bool deprecated; }; =20 typedef struct _qemuMonitorCPUDefs qemuMonitorCPUDefs; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8a75a2734e..6534878d45 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5896,6 +5896,10 @@ qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon, =20 cpu->usable =3D VIR_DOMCAPS_CPU_USABLE_NO; } + + if (virJSONValueObjectHasKey(child, "deprecated") && + virJSONValueObjectGetBoolean(child, "deprecated", &cpu->deprec= ated) < 0) + return -1; } =20 *cpuDefs =3D g_steal_pointer(&defs); diff --git a/tests/cputest.c b/tests/cputest.c index 4c75ee535f..593861dfe9 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -846,7 +846,7 @@ cpuTestUpdateLive(const void *arg) } =20 if (virDomainCapsCPUModelsAdd(models, expected->model, - usable, blockers) < 0) + usable, blockers, false) < 0) goto cleanup; =20 cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; @@ -953,7 +953,7 @@ cpuTestInitModels(const char **list) =20 for (model =3D list; *model; model++) { if (virDomainCapsCPUModelsAdd(cpus, *model, - VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL= ) < 0) + VIR_DOMCAPS_CPU_USABLE_UNKNOWN, NULL= , false) < 0) goto error; } =20 diff --git a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml b/tests/domainc= apsdata/qemu_5.2.0-q35.x86_64.xml index 7111bdf2c5..5a5232751d 100644 --- a/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-q35.x86_64.xml @@ -91,8 +91,8 @@ IvyBridge Icelake-Server-noTSX Icelake-Server - Icelake-Client-noTSX - Icelake-Client + Icelake-Client-noTSX + Icelake-Client Haswell-noTSX-IBRS Haswell-noTSX Haswell-IBRS diff --git a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml b/tests/domainc= apsdata/qemu_5.2.0-tcg.x86_64.xml index 9d2e870b1c..63546dc0a5 100644 --- a/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0-tcg.x86_64.xml @@ -96,8 +96,8 @@ IvyBridge Icelake-Server-noTSX Icelake-Server - Icelake-Client-noTSX - Icelake-Client + Icelake-Client-noTSX + Icelake-Client Haswell-noTSX-IBRS Haswell-noTSX Haswell-IBRS diff --git a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml b/tests/domaincapsd= ata/qemu_5.2.0.x86_64.xml index d8113c4e92..efc21244b3 100644 --- a/tests/domaincapsdata/qemu_5.2.0.x86_64.xml +++ b/tests/domaincapsdata/qemu_5.2.0.x86_64.xml @@ -90,8 +90,8 @@ IvyBridge Icelake-Server-noTSX Icelake-Server - Icelake-Client-noTSX - Icelake-Client + Icelake-Client-noTSX + Icelake-Client Haswell-noTSX-IBRS Haswell-noTSX Haswell-IBRS diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.2.0.x86_64.xml index dea2ff4b54..7f15bcda09 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml @@ -1055,7 +1055,7 @@ - + @@ -1071,7 +1071,7 @@ - + @@ -1089,7 +1089,7 @@ - + @@ -1105,7 +1105,7 @@ - + @@ -2429,7 +2429,7 @@ - + @@ -2454,7 +2454,7 @@ - + @@ -2481,7 +2481,7 @@ - + @@ -2506,7 +2506,7 @@ - + --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1611335941; cv=none; d=zohomail.com; s=zohoarc; b=Q1PH2T8C9NxPum8Iy5HaL0p1p5tQS5wMTxtwXexJYmv+vumi772VeH6LWCMtLGP7kS8/EGKuFwqVKeT4S/yJcMeSIFYwwK/SwxKX9H7qMZlStETok9rk6GlyM63xYIfqQJkOhHFOgeDhZSJMFke5v9U7888kV6DX/vNwv7oLLVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611335941; 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=6inKFDYHCqvvDstI+xIO/UPCZHjXNQJd1u3VG9giuJs=; b=eSoXhd0l4o81b1EzOvfsKyLBjlbIEAlxF3ybCBnerbqy4NFleIWQ3v0dKgg3uI8UqHDJKmwRUmPUBUye1cJfoZhyrtIIhr5VvTRjmeoinvdo5vno4yelkthTfA7M5FY9ddyTOhvIz95+kziVbSZZTdzIL7K4lmxSUCXWEvg9n/A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 161133594140021.390803581757154; Fri, 22 Jan 2021 09:19:01 -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-563-yndm3JzfOl20VqdvehwYUg-1; Fri, 22 Jan 2021 12:18:57 -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 8C66F8030B5; Fri, 22 Jan 2021 17:18:49 +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 4055B5D960; Fri, 22 Jan 2021 17:18:49 +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 09A544BB7B; Fri, 22 Jan 2021 17:18:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHIjV6009539 for ; Fri, 22 Jan 2021 12:18:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id C674160C61; Fri, 22 Jan 2021 17:18:45 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CC8C60C13; Fri, 22 Jan 2021 17:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611335940; 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=6inKFDYHCqvvDstI+xIO/UPCZHjXNQJd1u3VG9giuJs=; b=EOrcHyxEamyM67ZOcMLW3O/TPCGqfZAUfVrQptvK32do1/BxL/ufUctCRpOlJr/QuHkIVd FdEYpmOfWd1S/GQTMznDlc2ARcJwZcqzXhd7lkN2TGq92g+rVz8OgujwDcTcpmZN9IuSoA 2ZMyO7HBEhYjAiw0gu/q/O7OJkEpgF8= X-MC-Unique: yndm3JzfOl20VqdvehwYUg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 02/16] qemu: report whether a machine type is deprecated in capabilities Date: Fri, 22 Jan 2021 17:18:22 +0000 Message-Id: <20210122171836.3523210-3-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) QEMU has the ability to mark machine types as deprecated. This should be exposed to management applications in the capabilities. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- docs/schemas/capability.rng | 8 ++++++++ src/conf/capabilities.c | 2 ++ src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 17 ++++++++++++++--- src/qemu/qemu_capspriv.h | 3 ++- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 4 ++++ .../qemucapabilitiesdata/caps_4.1.0.x86_64.xml | 16 ++++++++-------- tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 4 ++-- .../qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 16 ++++++++-------- .../qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 16 ++++++++-------- .../qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 16 ++++++++-------- .../qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 16 ++++++++-------- tests/testutilsqemu.c | 8 +++++--- 14 files changed, 79 insertions(+), 49 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 91a046eb48..c4cafc47ee 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -407,6 +407,14 @@ + + + + yes + no + + + diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 425f34113a..1ea059ea6f 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -1244,6 +1244,8 @@ virCapabilitiesFormatGuestXML(virCapsGuestPtr *guests, virBufferAsprintf(buf, " canonical=3D'%s'", machine->canon= ical); if (machine->maxCpus > 0) virBufferAsprintf(buf, " maxCpus=3D'%d'", machine->maxCpus= ); + if (machine->deprecated) + virBufferAddLit(buf, " deprecated=3D'yes'"); virBufferAsprintf(buf, ">%s\n", machine->name); } =20 diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index e2581fac8b..5fd59efc05 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -56,6 +56,7 @@ struct _virCapsGuestMachine { char *name; char *canonical; unsigned int maxCpus; + bool deprecated; }; =20 struct _virCapsGuestDomainInfo { diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 61467eb6c2..e3d1de0779 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -624,6 +624,7 @@ struct _virQEMUCapsMachineType { char *defaultCPU; bool numaMemSupported; char *defaultRAMid; + bool deprecated; }; =20 typedef struct _virQEMUCapsHostCPUData virQEMUCapsHostCPUData; @@ -943,6 +944,7 @@ virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, mach->name =3D g_strdup(accel->machineTypes[i].name); } mach->maxCpus =3D accel->machineTypes[i].maxCpus; + mach->deprecated =3D accel->machineTypes[i].deprecated; } =20 /* Make sure all canonical machine types also have their own entry so = that @@ -976,6 +978,7 @@ virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, } mach->name =3D g_strdup(machine->canonical); mach->maxCpus =3D machine->maxCpus; + mach->deprecated =3D machine->deprecated; i++; } i++; @@ -1874,6 +1877,7 @@ virQEMUCapsAccelCopyMachineTypes(virQEMUCapsAccelPtr = dst, dst->machineTypes[i].qemuDefault =3D src->machineTypes[i].qemuDefa= ult; dst->machineTypes[i].numaMemSupported =3D src->machineTypes[i].num= aMemSupported; dst->machineTypes[i].defaultRAMid =3D g_strdup(src->machineTypes[i= ].defaultRAMid); + dst->machineTypes[i].deprecated =3D src->machineTypes[i].deprecate= d; } } =20 @@ -2708,7 +2712,8 @@ virQEMUCapsAddMachine(virQEMUCapsPtr qemuCaps, bool hotplugCpus, bool isDefault, bool numaMemSupported, - const char *defaultRAMid) + const char *defaultRAMid, + bool deprecated) { virQEMUCapsAccelPtr accel =3D virQEMUCapsGetAccel(qemuCaps, virtType); virQEMUCapsMachineTypePtr mach; @@ -2731,6 +2736,7 @@ virQEMUCapsAddMachine(virQEMUCapsPtr qemuCaps, mach->numaMemSupported =3D numaMemSupported; =20 mach->defaultRAMid =3D g_strdup(defaultRAMid); + mach->deprecated =3D deprecated; } =20 /** @@ -2778,7 +2784,8 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCa= ps, machines[i]->hotplugCpus, machines[i]->isDefault, machines[i]->numaMemSupported, - machines[i]->defaultRAMid); + machines[i]->defaultRAMid, + machines[i]->deprecated); =20 if (preferredMachine && (STREQ_NULLABLE(machines[i]->alias, preferredMachine) || @@ -4010,6 +4017,7 @@ virQEMUCapsLoadMachines(virQEMUCapsAccelPtr caps, =20 caps->machineTypes[i].defaultCPU =3D virXMLPropString(nodes[i], "d= efaultCPU"); caps->machineTypes[i].defaultRAMid =3D virXMLPropString(nodes[i], = "defaultRAMid"); + caps->machineTypes[i].deprecated =3D virXMLPropString(nodes[i], "d= eprecated"); } =20 return 0; @@ -4500,6 +4508,8 @@ virQEMUCapsFormatMachines(virQEMUCapsAccelPtr caps, virBufferAddLit(buf, " numaMemSupported=3D'yes'"); virBufferEscapeString(buf, " defaultRAMid=3D'%s'", caps->machineTypes[i].defaultRAMid); + if (caps->machineTypes[i].deprecated) + virBufferAddLit(buf, " deprecated=3D'yes'"); virBufferAddLit(buf, "/>\n"); } } @@ -6324,7 +6334,8 @@ virQEMUCapsStripMachineAliasesForVirtType(virQEMUCaps= Ptr qemuCaps, if (name) { virQEMUCapsAddMachine(qemuCaps, virtType, name, NULL, mach->de= faultCPU, mach->maxCpus, mach->hotplugCpus, mach->= qemuDefault, - mach->numaMemSupported, mach->defaultRAM= id); + mach->numaMemSupported, mach->defaultRAM= id, + mach->deprecated); } } } diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h index 15fc79e88b..90ce35fa5d 100644 --- a/src/qemu/qemu_capspriv.h +++ b/src/qemu/qemu_capspriv.h @@ -120,4 +120,5 @@ virQEMUCapsAddMachine(virQEMUCapsPtr qemuCaps, bool hotplugCpus, bool isDefault, bool numaMemSupported, - const char *defaultRAMid); + const char *defaultRAMid, + bool deprecated); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 67f149ebde..b0068f2a82 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1178,6 +1178,7 @@ struct _qemuMonitorMachineInfo { char *defaultCPU; bool numaMemSupported; char *defaultRAMid; + bool deprecated; }; =20 int qemuMonitorGetMachines(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 6534878d45..97c5e5b36c 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5814,6 +5814,10 @@ int qemuMonitorJSONGetMachines(qemuMonitorPtr mon, =20 info->defaultRAMid =3D g_strdup(tmp); } + + if (virJSONValueObjectHasKey(child, "deprecated") && + virJSONValueObjectGetBoolean(child, "deprecated", &info->depre= cated) < 0) + goto cleanup; } =20 ret =3D n; diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.1.0.x86_64.xml index 28a4b0ede0..b4f2092e7a 100644 --- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml @@ -859,20 +859,20 @@ - + - + - + @@ -890,7 +890,7 @@ - + @@ -1963,20 +1963,20 @@ - + - + - + @@ -1994,7 +1994,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_4.2.0.ppc64.xml index 15eaac77a6..c6c05c5383 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -649,7 +649,7 @@ - + @@ -1117,7 +1117,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.2.0.x86_64.xml index e150741f11..836255f80b 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -1114,13 +1114,13 @@ - + - + @@ -1128,7 +1128,7 @@ - + @@ -1147,7 +1147,7 @@ - + @@ -2577,13 +2577,13 @@ - + - + @@ -2591,7 +2591,7 @@ - + @@ -2610,7 +2610,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.0.0.x86_64.xml index 7c56d110f4..c6dcbf1329 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -1248,7 +1248,7 @@ - + @@ -1258,7 +1258,7 @@ - + @@ -1267,7 +1267,7 @@ - + @@ -1278,7 +1278,7 @@ - + @@ -2890,7 +2890,7 @@ - + @@ -2900,7 +2900,7 @@ - + @@ -2909,7 +2909,7 @@ - + @@ -2920,7 +2920,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.1.0.x86_64.xml index 07466093c9..cded14a96a 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml @@ -1421,7 +1421,7 @@ - + @@ -1432,7 +1432,7 @@ - + @@ -1441,7 +1441,7 @@ - + @@ -1452,7 +1452,7 @@ - + @@ -3156,7 +3156,7 @@ - + @@ -3167,7 +3167,7 @@ - + @@ -3176,7 +3176,7 @@ - + @@ -3187,7 +3187,7 @@ - + diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.2.0.x86_64.xml index 7f15bcda09..69b1484d8b 100644 --- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml @@ -1424,7 +1424,7 @@ - + @@ -1435,7 +1435,7 @@ - + @@ -1445,7 +1445,7 @@ - + @@ -1456,7 +1456,7 @@ - + @@ -3162,7 +3162,7 @@ - + @@ -3173,7 +3173,7 @@ - + @@ -3183,7 +3183,7 @@ - + @@ -3194,7 +3194,7 @@ - + diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index cea4f84b14..c2cf3be9ac 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -373,7 +373,8 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache, false, false, true, - defaultRAMid); + defaultRAMid, + false); virQEMUCapsSet(tmpCaps, QEMU_CAPS_TCG); } if (kvm_machines[i] !=3D NULL) { @@ -385,9 +386,10 @@ int qemuTestCapsCacheInsert(virFileCachePtr cache, NULL, 0, false, - false, + false, true, - defaultRAMid); + defaultRAMid, + false); virQEMUCapsSet(tmpCaps, QEMU_CAPS_KVM); } } --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1611335945; cv=none; d=zohomail.com; s=zohoarc; b=B3gBAVFvNE3jA4wvdGCcm0Ctgg6krxhNhC1z1tU5hS58eZkLOc+PIesWmdOvd8VNFF6g6sYeqScmE65dyLnrFNXo8srr2dSiC7s+aMT1z8bMytyPJp1PDYTSgR3Ob2XcTkkpef8tlQ4rSuEuhHbtLzCNA35cDicnbsYiVSBjxOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611335945; 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=wIJqiMtyfTIr+PPlYKfmgDRQ4anohLmU1nR2KwKiDxM=; b=Nt6OpB8yufosrac40gp0sFXi3I0/v839xIxCCcGkP/bxeLZyonxyeRcehTfJ23It8H8cGJh855WVOXurqm1f7sBuS2qrUw8ktNBxvC4Uug2eNkvPrmOlOJmAAOavFiBGpsWqh2xkL7C6T9zuQfb8VBHhR6VqziPwovJse69F9jM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611335945959104.59022903443986; Fri, 22 Jan 2021 09:19:05 -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-30-JMqJRWlXPt-C75UTrp0beQ-1; Fri, 22 Jan 2021 12:19:01 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A31458030A5; Fri, 22 Jan 2021 17:18:54 +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 7FFD35C232; Fri, 22 Jan 2021 17:18:54 +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 422311809C9F; Fri, 22 Jan 2021 17:18:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHIlfZ009558 for ; Fri, 22 Jan 2021 12:18:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 36E3960C66; Fri, 22 Jan 2021 17:18:47 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2586B60BF3; Fri, 22 Jan 2021 17:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611335944; 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=wIJqiMtyfTIr+PPlYKfmgDRQ4anohLmU1nR2KwKiDxM=; b=Nnhswtsf7o8D8jM36PFFTsvWdtLyQje6LdCFWIKUS+mgsL+feYCYy+HfmrG98Fvbr2A6kE p9SROq50KtzDpX55P1isPQMgh8BXsOm7bLNqcOzmqkuaKOrE+3jek1mwmvDpJf3HtSi6Cw HB0QyDKHY+lS5LL/j+P+1+t4jE0z3V0= X-MC-Unique: JMqJRWlXPt-C75UTrp0beQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 03/16] conf: introduce new taint flag for deprecated configuration Date: Fri, 22 Jan 2021 17:18:23 +0000 Message-Id: <20210122171836.3523210-4-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Hypervisors are capable of reporting that some features are deprecated. This should be used to mark a domain as tainted. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fcf332fe44..5346c40a81 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -87,6 +87,7 @@ VIR_ENUM_IMPL(virDomainTaint, "custom-dtb", "custom-ga-command", "custom-hypervisor-feature", + "deprecated-config", ); =20 VIR_ENUM_IMPL(virDomainVirt, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d514f6360f..55abbec0fe 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2757,6 +2757,7 @@ typedef enum { VIR_DOMAIN_TAINT_CUSTOM_DTB, /* Custom device tree blob was spec= ified */ VIR_DOMAIN_TAINT_CUSTOM_GA_COMMAND, /* Custom guest agent command */ VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, /* custom hypervisor featu= re control */ + VIR_DOMAIN_TAINT_DEPRECATED_CONFIG, /* Configuration that is marked d= eprecated */ =20 VIR_DOMAIN_TAINT_LAST } virDomainTaintFlags; --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1611335951; cv=none; d=zohomail.com; s=zohoarc; b=hmDhnVxcJsxcWs/2WAMulBiViEo0RFy0x9e2qt0NXM5Bvf/K+c7Vg1ias/EeEwMx61STWPNqsFwNjPFmUOEVlIlLJHjgO8pbGUoyZRVsInO4T699XjecWEFg/q9qLEyw5AAs9dtivFTSzaX/OUYxyawTwMzTgpRa8Nq6VvtOF4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611335951; 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=BC6bdUHIYKosNziUFO5vQhForU5NCTGjlndK1DM50z8=; b=PPq0rU9zHVmueRa+Fwl58jGB+QFvYlVHigIGWEElQ7ullx7waI9Bp9/llCTBojn9xIgY/lmmuj2SAPfLTS7HtiBn2h1Bem2p7sSXHSLwkItCcwV7uDsp0MVKfyEkIjzxY/HxQCCPIDtsKs9IwKHyHrdB4xAhp8QKvkJJlwTyGBU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 161133595112452.411800695927695; Fri, 22 Jan 2021 09:19:11 -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-327-xKvJ5Q3lMZagE9uGMLzw4w-1; Fri, 22 Jan 2021 12:19:07 -0500 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 63FC18030A7; Fri, 22 Jan 2021 17:19:01 +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 42C676EF40; Fri, 22 Jan 2021 17:19:01 +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 0A1901809CA4; Fri, 22 Jan 2021 17:19:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHIxM3009619 for ; Fri, 22 Jan 2021 12:18:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 98D2C60C6B; Fri, 22 Jan 2021 17:18:59 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09BF460BF3; Fri, 22 Jan 2021 17:18:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611335950; 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=BC6bdUHIYKosNziUFO5vQhForU5NCTGjlndK1DM50z8=; b=R7X+JIglz6QTcjojxTxU3mo+yvZH+Jaz4pg867q9sunJF5YMOwzUzUfWYOK9/DKyJrk9R5 DhBgWWeraDDWM9iAFTn+j+oS2Z9EQnhs1yBYo6nU/9bc1+PKs6Io8skUFPZD2nx//njumK E7BdOnVMZnR6MSYARlcBwKdsVZ3lf7o= X-MC-Unique: xKvJ5Q3lMZagE9uGMLzw4w-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 04/16] qemu: add ability to associate a string message with taint warning Date: Fri, 22 Jan 2021 17:18:24 +0000 Message-Id: <20210122171836.3523210-5-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 49 ++++++++++++++++++++++++++++++++++-------- src/qemu/qemu_domain.h | 7 ++++++ 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index dd79cfd9d9..e63bea8b32 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6166,22 +6166,51 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, virDomainTaintFlags taint, qemuDomainLogContextPtr logCtxt) +{ + qemuDomainObjTaintMsg(driver, obj, taint, logCtxt, NULL); +} + +void qemuDomainObjTaintMsg(virQEMUDriverPtr driver, + virDomainObjPtr obj, + virDomainTaintFlags taint, + qemuDomainLogContextPtr logCtxt, + const char *fmt, ...) { virErrorPtr orig_err =3D NULL; g_autofree char *timestamp =3D NULL; char uuidstr[VIR_UUID_STRING_BUFLEN]; int rc; - - if (!virDomainObjTaint(obj, taint)) - return; + g_autofree char *extra =3D NULL; + const char *extraprefix =3D ""; + const char *extramsg =3D ""; + const char *extrasuffix =3D ""; + va_list args; + + if (virDomainObjTaint(obj, taint)) { + /* If an extra message was given we must always + * emit the taint warning, otherwise it is a + * one-time only warning per VM + */ + if (!fmt) + return; + } =20 virUUIDFormat(obj->def->uuid, uuidstr); =20 - VIR_WARN("Domain id=3D%d name=3D'%s' uuid=3D%s is tainted: %s", + if (fmt) { + va_start(args, fmt); + extraprefix =3D " ("; + extramsg =3D extra =3D g_strdup_vprintf(fmt, args); + extrasuffix =3D ")"; + va_end(args); + } + + VIR_WARN("Domain id=3D%d name=3D'%s' uuid=3D%s is tainted: %s%s%s%s", obj->def->id, obj->def->name, uuidstr, - virDomainTaintTypeToString(taint)); + virDomainTaintTypeToString(taint), + extraprefix, extramsg, extrasuffix); =20 /* We don't care about errors logging taint info, so * preserve original error, and clear any error that @@ -6193,16 +6222,18 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver, =20 if (logCtxt) { rc =3D qemuDomainLogContextWrite(logCtxt, - "%s: Domain id=3D%d is tainted: %s\= n", + "%s: Domain id=3D%d is tainted: %s%= s%s%s\n", timestamp, obj->def->id, - virDomainTaintTypeToString(taint)); + virDomainTaintTypeToString(taint), + extraprefix, extramsg, extrasuffix); } else { rc =3D qemuDomainLogAppendMessage(driver, obj, - "%s: Domain id=3D%d is tainted: %s= \n", + "%s: Domain id=3D%d is tainted: %s= %s%s%s\n", timestamp, obj->def->id, - virDomainTaintTypeToString(taint)); + virDomainTaintTypeToString(taint), + extraprefix, extramsg, extrasuffix= ); } =20 if (rc < 0) diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 154339ef8f..7453881a31 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -565,6 +565,13 @@ void qemuDomainObjTaint(virQEMUDriverPtr driver, virDomainTaintFlags taint, qemuDomainLogContextPtr logCtxt); =20 +void qemuDomainObjTaintMsg(virQEMUDriverPtr driver, + virDomainObjPtr obj, + virDomainTaintFlags taint, + qemuDomainLogContextPtr logCtxt, + const char *msg, + ...) G_GNUC_PRINTF(5, 6); + void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, qemuDomainLogContextPtr logCtxt, --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1611335966; cv=none; d=zohomail.com; s=zohoarc; b=W2ulaF/+341Xt4/N6qEPq2GS08J7nWPm1fJA3mcoNv0HJ3WjsILQg1s/scnzBEWnLTbFsZNJxVMMHQBYWuD+679bkmR5p4S4XQF7gwppzdpfAVmKk/MSXLsipbC84PMNzL5K7rmJJUnz5oftB6ubWzBgI+tGHdllP+O6eU2W6wc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611335966; 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=Q0A738hmgwqqdeqEg1cyX5VDaIPiUu0EB0W7ma75bYU=; b=LwO5PNcdQQ6HEm7uM7ngEjEz0z1AL6jWxZxUCsO58K29VTU9XcZkM8bqQDNmyJ1aKHSgoLMxl0FdbJEN9jqypQGlR4cubQqIQNY2iEpCLdiacxgdmeE7ODXbWIBeE0sfLVBPNZHv3m6Cxn4Ilby1rNttd4HnyXqzeSkBQgQW1SM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611335966379891.7659909995646; Fri, 22 Jan 2021 09:19:26 -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-302-bY3wvXR3P3iBoGww1vTBDw-1; Fri, 22 Jan 2021 12:19:22 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87E64107ACFA; Fri, 22 Jan 2021 17:19: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 67D7850DE3; Fri, 22 Jan 2021 17:19: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 314381809CA0; Fri, 22 Jan 2021 17:19:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHJFx8009808 for ; Fri, 22 Jan 2021 12:19:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8744F60C66; Fri, 22 Jan 2021 17:19:15 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7514560C62; Fri, 22 Jan 2021 17:19:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611335965; 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=Q0A738hmgwqqdeqEg1cyX5VDaIPiUu0EB0W7ma75bYU=; b=OKEs6Or3mFcqWF1B3PNHouvd72Gq49L18ZVieM+xvwH0MjNcPcNBhYNb4Hi4t95rJPH/8D 5tvIVlniJA3vptxhB5+u+1oFWtshOg2sQpmjZTvl6SanlzEU1O9AZ+faNfDkR5drc1TQUB PxYHwza7LDJISonjnUVXFVgKwLYHl6M= X-MC-Unique: bY3wvXR3P3iBoGww1vTBDw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 05/16] qemu: taint the VM if it is using a deprecated CPU model Date: Fri, 22 Jan 2021 17:18:25 +0000 Message-Id: <20210122171836.3523210-6-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_capabilities.c | 17 +++++++++++++++++ src/qemu/qemu_capabilities.h | 3 +++ src/qemu/qemu_domain.c | 37 ++++++++++++++++++++++++++++++++---- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index e3d1de0779..f6d7a222c4 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2437,6 +2437,23 @@ virQEMUCapsGetMachineDefaultCPU(virQEMUCapsPtr qemuC= aps, } =20 =20 +bool +virQEMUCapsIsCPUDeprecated(virQEMUCapsPtr qemuCaps, + virDomainVirtType type, + const char *model) +{ + virQEMUCapsAccelPtr accel =3D virQEMUCapsGetAccel(qemuCaps, type); + qemuMonitorCPUDefsPtr defs =3D accel->cpuModels; + size_t i; + + for (i =3D 0; i < defs->ncpus; i++) { + if (STREQ_NULLABLE(defs->cpus[i].name, model)) + return defs->cpus[i].deprecated; + } + return false; +} + + bool virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps, virDomainVirtType virtType, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index a14a78f959..a6270edb0e 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -686,6 +686,9 @@ bool virQEMUCapsGetMachineHotplugCpus(virQEMUCapsPtr qe= muCaps, const char *virQEMUCapsGetMachineDefaultCPU(virQEMUCapsPtr qemuCaps, const char *name, virDomainVirtType type); +bool virQEMUCapsIsCPUDeprecated(virQEMUCapsPtr qemuCaps, + virDomainVirtType type, + const char *model); bool virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps, virDomainVirtType virtType, const char *name); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index e63bea8b32..ed5fd6aa0d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6243,6 +6243,37 @@ void qemuDomainObjTaintMsg(virQEMUDriverPtr driver, virErrorRestore(&orig_err); } =20 +static void +qemuDomainObjCheckCPUTaint(virQEMUDriverPtr driver, + virDomainObjPtr obj, + qemuDomainLogContextPtr logCtxt, + bool incomingMigration) +{ + qemuDomainObjPrivatePtr priv =3D obj->privateData; + virQEMUCapsPtr qemuCaps =3D priv->qemuCaps; + + switch (obj->def->cpu->mode) { + case VIR_CPU_MODE_HOST_PASSTHROUGH: + if (incomingMigration) + qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HOST_CPU, log= Ctxt); + break; + case VIR_CPU_MODE_CUSTOM: + if (obj->def->cpu->model && + virQEMUCapsIsCPUDeprecated(qemuCaps, + obj->def->virtType, + obj->def->cpu->model)) { + qemuDomainObjTaintMsg(driver, obj, VIR_DOMAIN_TAINT_DEPRECATED= _CONFIG, logCtxt, + _("CPU model '%s'"), + obj->def->cpu->model); + } + break; + case VIR_CPU_MODE_HOST_MODEL: + case VIR_CPU_MODE_LAST: + default: + break; + } +} + =20 void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, @@ -6276,10 +6307,8 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, log= Ctxt); } =20 - if (obj->def->cpu && - obj->def->cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH && - incomingMigration) - qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HOST_CPU, logCtxt= ); + if (obj->def->cpu) + qemuDomainObjCheckCPUTaint(driver, obj, logCtxt, incomingMigration= ); =20 for (i =3D 0; i < obj->def->ndisks; i++) qemuDomainObjCheckDiskTaint(driver, obj, obj->def->disks[i], logCt= xt); --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1611335981; cv=none; d=zohomail.com; s=zohoarc; b=ckSPvTejmdo43yE2wuvrtp679E9aR7NzPNN6+i9GKVjkmlciD+T+S8+putgi3MUAA3n4UFN5lQEUuHODhZCvNn6IuKXnBDvZQ7hAWHrDpYRYjQGYZrHErucuSO1+U9fFQ9tgbP86pNgFN0EtKIROLw/MTiXk9G1LTK5RnOK4x8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611335981; 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=wMv8neYriUJclBWYnupGyPzq0S21ARczDWl2qGpTAtk=; b=KkAYVple1LqHPUpdnjRC+I+lMEIY00R+84tJ0bsKBX/42lo0KpYBLmsqDYIsnjboH/Uon0qkISYAhjqK6d4xcYOTuANiXLDweL5Rmx2eHuWQ3jEFuCtZcAViJXa3vzya4B4IKW3T19Tq3DNrXs0eiBaiu5O2lZuWOyew2isOmJg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1611335981063214.36394243993414; Fri, 22 Jan 2021 09:19:41 -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-333-AAFTlWzqM5iwAUqguWCvIg-1; Fri, 22 Jan 2021 12:19:37 -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 0A779806661; Fri, 22 Jan 2021 17:19:31 +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 9A2695DA30; Fri, 22 Jan 2021 17:19:29 +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 D0EC55002C; Fri, 22 Jan 2021 17:19:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHJR4w009888 for ; Fri, 22 Jan 2021 12:19:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 676FF60C6C; Fri, 22 Jan 2021 17:19:27 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id D142560C43; Fri, 22 Jan 2021 17:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611335980; 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=wMv8neYriUJclBWYnupGyPzq0S21ARczDWl2qGpTAtk=; b=NZQw6QZ7CjWuTDenBC9Q8kU/mFYclp70H/G4o8bwkDO54Zh8P1iUiwCPmMCp3eJH8KKeFU PH0tasMBuIWhAzORqn7r6/7IJ3LjBSpWT8RBkJYEwABQWn//uqMBUT/3gjfg5esv2pmfu7 /qTaTEvPwgDUXh2agx7+jpxVcfoMno8= X-MC-Unique: AAFTlWzqM5iwAUqguWCvIg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 06/16] qemu: taint the VM if it is using a deprecated machine type Date: Fri, 22 Jan 2021 17:18:26 +0000 Message-Id: <20210122171836.3523210-7-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_capabilities.c | 16 ++++++++++++++++ src/qemu/qemu_capabilities.h | 3 +++ src/qemu/qemu_domain.c | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f6d7a222c4..b6d4c09e7e 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2454,6 +2454,22 @@ virQEMUCapsIsCPUDeprecated(virQEMUCapsPtr qemuCaps, } =20 =20 +bool +virQEMUCapsIsMachineDeprecated(virQEMUCapsPtr qemuCaps, + virDomainVirtType type, + const char *machine) +{ + virQEMUCapsAccelPtr accel =3D virQEMUCapsGetAccel(qemuCaps, type); + size_t i; + + for (i =3D 0; i < accel->nmachineTypes; i++) { + if (STREQ_NULLABLE(accel->machineTypes[i].name, machine)) + return accel->machineTypes[i].deprecated; + } + return false; +} + + bool virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps, virDomainVirtType virtType, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index a6270edb0e..19e2cd1fff 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -689,6 +689,9 @@ const char *virQEMUCapsGetMachineDefaultCPU(virQEMUCaps= Ptr qemuCaps, bool virQEMUCapsIsCPUDeprecated(virQEMUCapsPtr qemuCaps, virDomainVirtType type, const char *model); +bool virQEMUCapsIsMachineDeprecated(virQEMUCapsPtr qemuCaps, + virDomainVirtType type, + const char *machine); bool virQEMUCapsGetMachineNumaMemSupported(virQEMUCapsPtr qemuCaps, virDomainVirtType virtType, const char *name); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ed5fd6aa0d..f00e8d9384 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6243,6 +6243,24 @@ void qemuDomainObjTaintMsg(virQEMUDriverPtr driver, virErrorRestore(&orig_err); } =20 +static void +qemuDomainObjCheckMachineTaint(virQEMUDriverPtr driver, + virDomainObjPtr obj, + qemuDomainLogContextPtr logCtxt) +{ + qemuDomainObjPrivatePtr priv =3D obj->privateData; + virQEMUCapsPtr qemuCaps =3D priv->qemuCaps; + + if (virQEMUCapsIsMachineDeprecated(qemuCaps, + obj->def->virtType, + obj->def->os.machine)) { + qemuDomainObjTaintMsg(driver, obj, VIR_DOMAIN_TAINT_DEPRECATED_CON= FIG, logCtxt, + _("machine type '%s'"), + obj->def->os.machine); + } +} + + static void qemuDomainObjCheckCPUTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, @@ -6307,6 +6325,8 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, log= Ctxt); } =20 + qemuDomainObjCheckMachineTaint(driver, obj, logCtxt); + if (obj->def->cpu) qemuDomainObjCheckCPUTaint(driver, obj, logCtxt, incomingMigration= ); =20 --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1611335994; cv=none; d=zohomail.com; s=zohoarc; b=SheFFuxv6wk1HdlUaquu+T1MPHbnOjHvFHbJyMCXclDs2UPKs8RrIJcZ2jz7b8RX0uNF7Es/MESi1kdb0e8OlWtbW/jj+6aOw6nhE569Dzfv0dYtaTVfYKPQSj+5iDhVV6VSpNNxsZNZS/EAmX9dHa4opqtw/pue54VfrSGmaPg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611335994; 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=xAV1r3OXbCacFBGGrSSJEEtthkEbN0IjUYui5XbsxUI=; b=gc8CCnRgVrNR2IRxhViKsgEiYjAbzG7u2WUL5aoDZUe4/FCkzDPl5GNOcVUInHQKEqVQCD6k+1ngdsJgTB5DcTOPg0nhgYfQTBMKXFmujhHJoYcW/xZBOgEyQ4SATXXbTQrx4X8IzvBhFyBKDpHMRf67AWMjbCQdUpMjhlMwvdI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611335994694747.2735317888731; Fri, 22 Jan 2021 09:19:54 -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-336-cAHC6uVVN0qXNe1IztdVQA-1; Fri, 22 Jan 2021 12:19:51 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 491C210054FF; Fri, 22 Jan 2021 17:19:45 +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 250FB1992D; Fri, 22 Jan 2021 17:19:45 +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 DDA471809CA4; Fri, 22 Jan 2021 17:19:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHJhXx009998 for ; Fri, 22 Jan 2021 12:19:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id BF82560C43; Fri, 22 Jan 2021 17:19:43 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA1AE60C66; Fri, 22 Jan 2021 17:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611335993; 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=xAV1r3OXbCacFBGGrSSJEEtthkEbN0IjUYui5XbsxUI=; b=XndjAGp+ZnVBhJGa9qsN+mFhD+Uy4/pzjJQnV1aZ4IapfKzRsmwdBq40VfA79wcSW5YBFR M6hQhXlmjXGcpbwSOjjIgW468drEGnjk1PFv5gQP2pXRwagdMhVTQAo9ajjfg2QhOzD+He 0yizraFR846N8V7tK1sYG4TjhF+CYQI= X-MC-Unique: cAHC6uVVN0qXNe1IztdVQA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 07/16] conf: record deprecation messages against the domain Date: Fri, 22 Jan 2021 17:18:27 +0000 Message-Id: <20210122171836.3523210-8-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) These messages will be stored in the live status XML. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 28 +++++++++++++++++++++++++--- src/conf/domain_conf.h | 4 ++++ src/libvirt_private.syms | 1 + 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5346c40a81..86c4639bda 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1774,6 +1774,15 @@ bool virDomainObjTaint(virDomainObjPtr obj, } =20 =20 +void virDomainObjDeprecation(virDomainObjPtr obj, + const char *msg) +{ + obj->deprecations =3D g_renew(char *, obj->deprecations, + obj->ndeprecations + 1); + obj->deprecations[obj->ndeprecations++] =3D g_strdup(msg); +} + + static void virDomainGraphicsAuthDefClear(virDomainGraphicsAuthDefPtr def) { @@ -21205,7 +21214,8 @@ virDomainObjParseXML(xmlDocPtr xml, int reason =3D 0; void *parseOpaque =3D NULL; g_autofree char *tmp =3D NULL; - g_autofree xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *taintNodes =3D NULL; + g_autofree xmlNodePtr *depNodes =3D NULL; =20 if (!(obj =3D virDomainObjNew(xmlopt))) return NULL; @@ -21252,10 +21262,10 @@ virDomainObjParseXML(xmlDocPtr xml, } obj->pid =3D (pid_t)val; =20 - if ((n =3D virXPathNodeSet("./taint", ctxt, &nodes)) < 0) + if ((n =3D virXPathNodeSet("./taint", ctxt, &taintNodes)) < 0) goto error; for (i =3D 0; i < n; i++) { - char *str =3D virXMLPropString(nodes[i], "flag"); + char *str =3D virXMLPropString(taintNodes[i], "flag"); if (str) { int flag =3D virDomainTaintTypeFromString(str); if (flag < 0) { @@ -21269,6 +21279,13 @@ virDomainObjParseXML(xmlDocPtr xml, } } =20 + if ((n =3D virXPathNodeSet("./deprecation", ctxt, &depNodes)) < 0) + goto error; + for (i =3D 0; i < n; i++) { + g_autofree char *str =3D virXMLNodeContentString(depNodes[i]); + virDomainObjDeprecation(obj, str); + } + if (xmlopt->privateData.parse && xmlopt->privateData.parse(ctxt, obj, &xmlopt->config) < 0) goto error; @@ -29073,6 +29090,11 @@ virDomainObjFormat(virDomainObjPtr obj, virDomainTaintTypeToString(i)); } =20 + for (i =3D 0; i < obj->ndeprecations; i++) { + virBufferEscapeString(&buf, "%s\n", + obj->deprecations[i]); + } + if (xmlopt->privateData.format && xmlopt->privateData.format(&buf, obj) < 0) return NULL; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 55abbec0fe..9ae1bd3eeb 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2799,6 +2799,8 @@ struct _virDomainObj { void (*privateDataFreeFunc)(void *); =20 int taint; + size_t ndeprecations; + char **deprecations; =20 unsigned long long original_memlock; /* Original RLIMIT_MEMLOCK, zero = if no * restore will be required later= */ @@ -3056,6 +3058,8 @@ void virDomainObjEndAPI(virDomainObjPtr *vm); =20 bool virDomainObjTaint(virDomainObjPtr obj, virDomainTaintFlags taint); +void virDomainObjDeprecation(virDomainObjPtr obj, + const char *msg); =20 void virDomainObjBroadcast(virDomainObjPtr vm); int virDomainObjWait(virDomainObjPtr vm); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c325040b60..7a73943ba0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -547,6 +547,7 @@ virDomainObjAssignDef; virDomainObjBroadcast; virDomainObjCheckActive; virDomainObjCopyPersistentDef; +virDomainObjDeprecation; virDomainObjEndAPI; virDomainObjFormat; virDomainObjGetDefs; --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1611336008; cv=none; d=zohomail.com; s=zohoarc; b=T2hwRFS3FyKnr+JbFZ92WcomdjTsD0+u/Hr4ovhpseqyJEXxaOnhENQROMcBSDJqhdthzkT3Mot1Iy1EXlwVvI2n7NOkzPXBYlREPT22hEb92n/tNSDhV+ja+tbby0kpiy/f0w0AOTvlYbM92fO5VTNdClzlcoMplsBdLsjaJcE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611336008; 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=1imwEMZyoHPQXHf+7NLOx5dya/mfmBaz5ZMVtZ+E4NU=; b=iYdrWZZM0A+WWFLwcRjKQCIDq7KZ4O8iaGlH0ovazHAS2kFWbSkeA/Do5ZhJXQfNYTJJcV796T8l5D6Utos5heUKASkIW4+kSJ8qKp6F6KT8TVybDBfv6n41Jy2ytxJ1NzH+PFc22/Fka0wyoy4gzmrdLN+QnHA4TnPlmst53P8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611336008894151.57414750058524; Fri, 22 Jan 2021 09:20: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-158--AcaXfS5MtGRkqK-L34Mvg-1; Fri, 22 Jan 2021 12:20:05 -0500 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 D3EF2107B460; Fri, 22 Jan 2021 17:19:59 +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 B14935D746; Fri, 22 Jan 2021 17:19:59 +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 7E0C0180954D; Fri, 22 Jan 2021 17:19:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHJwtw010088 for ; Fri, 22 Jan 2021 12:19:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id D8CF160C6B; Fri, 22 Jan 2021 17:19:58 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B84060C13; Fri, 22 Jan 2021 17:19:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336007; 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=1imwEMZyoHPQXHf+7NLOx5dya/mfmBaz5ZMVtZ+E4NU=; b=ZYUUmxF+rTCMBf0QHTCg+haly43ur436WD3XJudwAV4RhauvBhltZCLPfsKdYe/U6LKrnE OgYWTpFfjSlyAisRWaBFhBiKcKFnN0g4FYnoPbeYStW8sToPzhfK4WrGnl+4tN1kSIm6On QeFX8U4LozbDxg+IXv0Wg917KEZH8jQ= X-MC-Unique: -AcaXfS5MtGRkqK-L34Mvg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 08/16] qemu: record deprecation messages against the domain Date: Fri, 22 Jan 2021 17:18:28 +0000 Message-Id: <20210122171836.3523210-9-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) These messages are only valid while the domain is running. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 5 +++++ src/qemu/qemu_process.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f00e8d9384..64dc7b5eff 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6205,6 +6205,11 @@ void qemuDomainObjTaintMsg(virQEMUDriverPtr driver, va_end(args); } =20 + if (taint =3D=3D VIR_DOMAIN_TAINT_DEPRECATED_CONFIG && + extramsg) { + virDomainObjDeprecation(obj, extramsg); + } + VIR_WARN("Domain id=3D%d name=3D'%s' uuid=3D%s is tainted: %s%s%s%s", obj->def->id, obj->def->name, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 202d867289..4a34e5ab9f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7856,6 +7856,11 @@ void qemuProcessStop(virQEMUDriverPtr driver, } } =20 + for (i =3D 0; i < vm->ndeprecations; i++) + g_free(vm->deprecations[i]); + g_free(vm->deprecations); + vm->ndeprecations =3D 0; + vm->deprecations =3D NULL; vm->taint =3D 0; vm->pid =3D -1; virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason); --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1611336023; cv=none; d=zohomail.com; s=zohoarc; b=ZZ+yK+tVU4nSPleYe6a/FV7M+rydZvywErQP1Dp7kzZ4vlziToTN9C4AV+fVjEphmXcYDpcXtsCpK27UC+pj5nxh6zei5V1G6Vlnj0+hm4bDGT91JufVpFzH7fd0dIi9FI4eSekNcmgYDBSMQKF30mmSRkyTSzABzy1o2JRaXJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611336023; 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=fG7zmIRR5SkVaJFv07iXKogOqJKe23gUi5Gw6DV6ENM=; b=jwwv3ztwZNt60SnnWbnmqU0UGrXqV+xjS2S1rjcJlSWpPC/uz/Mrivh7ESIIOflZg7nH5XrM6KKMhEjAfEDBy2T9Vec50QYXUJfXyIvHJFMPgaZxHLv4pTrw6noHaoeCc/nVptlyxNPkGDYGWn5bi+pQWb11inN/1jAKjR3+t7E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611336023630891.6658908011135; Fri, 22 Jan 2021 09:20:23 -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-420-MA9ift-7NDmTvwsu7iyg1w-1; Fri, 22 Jan 2021 12:20:19 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2D384107ACF5; Fri, 22 Jan 2021 17:20:13 +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 036BBE15F; Fri, 22 Jan 2021 17:20:13 +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 B760B5002C; Fri, 22 Jan 2021 17:20:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHKBxC010169 for ; Fri, 22 Jan 2021 12:20:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id D54C560C62; Fri, 22 Jan 2021 17:20:11 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 857AC60C13; Fri, 22 Jan 2021 17:19:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336022; 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=fG7zmIRR5SkVaJFv07iXKogOqJKe23gUi5Gw6DV6ENM=; b=JT8pNvkytZmaZhHwAV8cwj/TAn7t5ubSn71QLFbexf9QYApDM4TPyribOUufrDKPZ5E3eN nPPuzTnI9VvFA6BZlvgep4zRsaqCtBciAo67pvGgQM6zVJ0oKdIsbzaVcILYNOy3sgbZzf IyG7DDuwF5ib75g5tO5A1a1zO8Jiglk= X-MC-Unique: MA9ift-7NDmTvwsu7iyg1w-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 09/16] src: define virDomainGetDeprecations API Date: Fri, 22 Jan 2021 17:18:29 +0000 Message-Id: <20210122171836.3523210-10-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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.84 on 10.5.11.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) This API allows fetching a list of deprecation messages against the domain. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- include/libvirt/libvirt-domain.h | 4 +++ src/driver-hypervisor.h | 6 ++++ src/libvirt-domain.c | 47 ++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 ++++ 4 files changed, 62 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index de2456812c..cef16e6361 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -5119,4 +5119,8 @@ int virDomainAuthorizedSSHKeysSet(virDomainPtr domain, unsigned int nkeys, unsigned int flags); =20 +int virDomainGetDeprecations(virDomainPtr domain, + char ***msgs, + unsigned int flags); + #endif /* LIBVIRT_DOMAIN_H */ diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 9e8fe89921..2f804dba1f 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1400,6 +1400,11 @@ typedef int unsigned int nkeys, unsigned int flags); =20 +typedef int +(*virDrvDomainGetDeprecations)(virDomainPtr domain, + char ***msgs, + unsigned int flags); + typedef struct _virHypervisorDriver virHypervisorDriver; typedef virHypervisorDriver *virHypervisorDriverPtr; =20 @@ -1665,4 +1670,5 @@ struct _virHypervisorDriver { virDrvDomainBackupGetXMLDesc domainBackupGetXMLDesc; virDrvDomainAuthorizedSSHKeysGet domainAuthorizedSSHKeysGet; virDrvDomainAuthorizedSSHKeysSet domainAuthorizedSSHKeysSet; + virDrvDomainGetDeprecations domainGetDeprecations; }; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index c9f8ffdb56..9e3b118483 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -13102,3 +13102,50 @@ virDomainAuthorizedSSHKeysSet(virDomainPtr domain, virDispatchError(conn); return -1; } + + +/** + * virDomainGetDeprecations: + * @domain: a domain object + * @msgs: pointer to a variable to store deprecation messages + * @flags: extra flags; not used yet, so callers should always pass 0 + * + * Fetch a list of all deprecation messages for the VM and + * store them into @msgs array which is allocated upon + * successful return and is NULL terminated. The caller is + * responsible for freeing @msgs when no longer needed. + * + * Note that some hypervisors may only report deprecation + * messages while the VM is in a running state. + * + * Returns: number of messages stored in @msgs, + * -1 otherwise. + */ +int +virDomainGetDeprecations(virDomainPtr domain, + char ***msgs, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "msgs=3D%p, flags=3D0x%x", msgs, flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn =3D domain->conn; + virCheckNonNullArgGoto(msgs, error); + + if (conn->driver->domainGetDeprecations) { + int ret; + ret =3D conn->driver->domainGetDeprecations(domain, msgs, flags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + error: + virDispatchError(conn); + return -1; +} diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index cf31f937d5..345c5685bf 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -879,4 +879,9 @@ LIBVIRT_6.10.0 { virDomainAuthorizedSSHKeysSet; } LIBVIRT_6.0.0; =20 +LIBVIRT_7.1.0 { + global: + virDomainGetDeprecations; +} LIBVIRT_6.10.0; + # .... define new API here using predicted next version number .... --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1611336038; cv=none; d=zohomail.com; s=zohoarc; b=VHPLhJ/Oawf7+QJo4L5KYr2s4PkIdwEtCDHtF/5ydOBndehwvY6Pby3EV0bYT5gxmUInHIe1htuU9Mk1RMC8ZGWqd0x2D9YErWA/ivz9keRbjMkOAwNwXiCoftJJ20ZRSBN8EKVTTPv+OlwoUwqkbusxolVLgL7hrAHJ9nZX7xQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611336038; 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=VphmwH5LlL/JP9pRA6FBksXOfbikYrtvb2eSYGV1Ry0=; b=SXXwYep/+Sp0JDyhoG5NJaF7O95FEVfSNpj2adYs5G68DhVEbdAsOFvnAC9o4Sg0n7QLTeAnfdqucpk/x/KRWsf55YqkW9RElJDDoEo0vu0qY9ykNKSiE+rQjOIop5Z3liKMVezYBYSmjrOXR+JBf7BMEKjJaJ73Vuf8xQZSLzE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611336038028913.9149713947362; Fri, 22 Jan 2021 09:20:38 -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-186-oK8mCKcWNo-xen-EODOjHw-1; Fri, 22 Jan 2021 12:20:32 -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 95B3D80667A; Fri, 22 Jan 2021 17:20:27 +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 73D8A60BF3; Fri, 22 Jan 2021 17:20:27 +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 419D95002D; Fri, 22 Jan 2021 17:20:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHKPjh010253 for ; Fri, 22 Jan 2021 12:20:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5EFA060C43; Fri, 22 Jan 2021 17:20:25 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A4AA60BF3; Fri, 22 Jan 2021 17:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336037; 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=VphmwH5LlL/JP9pRA6FBksXOfbikYrtvb2eSYGV1Ry0=; b=RIX6HpIwMD1O0wwC+l+6njGvHDue7h/KizuVOyWF29klxthIShcsVm0MTyTMtbdn1myf8r t9bdIC6zV/lQM4QYN1PpUuUkEF+paLfMjRXg44l0kXI5oNkKxdgAFN4PjTA39S/JcDPVeR AaE1JTN3PqPx9Q1iyV/oqK1t9J9r6qI= X-MC-Unique: oK8mCKcWNo-xen-EODOjHw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 10/16] remote: add RPC support for the virDomainGetDeprecations API Date: Fri, 22 Jan 2021 17:18:30 +0000 Message-Id: <20210122171836.3523210-11-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/remote/remote_daemon_dispatch.c | 45 +++++++++++++++++++++++++++++ src/remote/remote_driver.c | 44 ++++++++++++++++++++++++++++ src/remote/remote_protocol.x | 21 +++++++++++++- 3 files changed, 109 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 46683aa4a7..aa6a088222 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -7463,3 +7463,48 @@ remoteDispatchDomainAuthorizedSshKeysSet(virNetServe= rPtr server G_GNUC_UNUSED, =20 return rv; } + +static int +remoteDispatchDomainGetDeprecations(virNetServerPtr server G_GNUC_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg G_GNUC_UNUSED, + virNetMessageErrorPtr rerr, + remote_domain_get_deprecations_args *a= rgs, + remote_domain_get_deprecations_ret *re= t) +{ + int rv =3D -1; + virConnectPtr conn =3D remoteGetHypervisorConn(client); + int nmsgs =3D 0; + char **msgs =3D NULL; + virDomainPtr dom =3D NULL; + + if (!conn) + goto cleanup; + + if (!(dom =3D get_nonnull_domain(conn, args->dom))) + goto cleanup; + + if ((nmsgs =3D virDomainGetDeprecations(dom, &msgs, args->flags)) < 0) + goto cleanup; + + if (nmsgs > REMOTE_DOMAIN_DEPRECATIONS_MAX) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Number of msgs %d, which exceeds max limit: %d"), + nmsgs, REMOTE_DOMAIN_DEPRECATIONS_MAX); + goto cleanup; + } + + ret->msgs.msgs_val =3D g_steal_pointer(&msgs); + ret->msgs.msgs_len =3D nmsgs; + + rv =3D nmsgs; + + cleanup: + if (rv < 0) + virNetMessageSaveError(rerr); + if (nmsgs > 0) + virStringListFreeCount(msgs, nmsgs); + virObjectUnref(dom); + + return rv; +} diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 1b784e61c7..009df01a54 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8098,6 +8098,49 @@ remoteDomainAuthorizedSSHKeysSet(virDomainPtr domain, } =20 =20 +static int +remoteDomainGetDeprecations(virDomainPtr domain, + char ***msgs, + unsigned int flags) +{ + int rv =3D -1; + size_t i; + struct private_data *priv =3D domain->conn->privateData; + remote_domain_get_deprecations_args args; + remote_domain_get_deprecations_ret ret; + + remoteDriverLock(priv); + + make_nonnull_domain(&args.dom, domain); + args.flags =3D flags; + memset(&ret, 0, sizeof(ret)); + + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_DEPRECATIONS, + (xdrproc_t) xdr_remote_domain_get_deprecations_args, (char *)= &args, + (xdrproc_t) xdr_remote_domain_get_deprecations_ret, (char *)&= ret) =3D=3D -1) { + goto cleanup; + } + + if (ret.msgs.msgs_len > REMOTE_DOMAIN_DEPRECATIONS_MAX) { + virReportError(VIR_ERR_RPC, "%s", + _("remoteDomainGetDeprecations: " + "returned number of msgs exceeds limit")); + goto cleanup; + } + + *msgs =3D g_new0(char *, ret.msgs.msgs_len + 1); + for (i =3D 0; i < ret.msgs.msgs_len; i++) + (*msgs)[i] =3D g_strdup(ret.msgs.msgs_val[i]); + + rv =3D ret.msgs.msgs_len; + + cleanup: + remoteDriverUnlock(priv); + xdr_free((xdrproc_t)xdr_remote_domain_get_deprecations_ret, + (char *) &ret); + return rv; +} + /* get_nonnull_domain and get_nonnull_network turn an on-wire * (name, uuid) pair into virDomainPtr or virNetworkPtr object. * These can return NULL if underlying memory allocations fail, @@ -8531,6 +8574,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainBackupGetXMLDesc =3D remoteDomainBackupGetXMLDesc, /* 6.0.0 */ .domainAuthorizedSSHKeysGet =3D remoteDomainAuthorizedSSHKeysGet, /* 6= .10.0 */ .domainAuthorizedSSHKeysSet =3D remoteDomainAuthorizedSSHKeysSet, /* 6= .10.0 */ + .domainGetDeprecations =3D remoteDomainGetDeprecations, /* 7.1.0 */ }; =20 static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 2df38cef77..4ddfb09631 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -283,6 +283,9 @@ const REMOTE_NETWORK_PORT_PARAMETERS_MAX =3D 16; /* Upper limit on number of SSH keys */ const REMOTE_DOMAIN_AUTHORIZED_SSH_KEYS_MAX =3D 2048; =20 +/* Upper limit on number of deprecation messages */ +const REMOTE_DOMAIN_DEPRECATIONS_MAX =3D 2048; + =20 /* UUID. VIR_UUID_BUFLEN definition comes from libvirt.h */ typedef opaque remote_uuid[VIR_UUID_BUFLEN]; @@ -3799,6 +3802,16 @@ struct remote_domain_authorized_ssh_keys_set_args { unsigned int flags; }; =20 +struct remote_domain_get_deprecations_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + +struct remote_domain_get_deprecations_ret { + remote_nonnull_string msgs; +}; + + /*----- Protocol. -----*/ =20 /* Define the program number, protocol version and procedure numbers here.= */ @@ -6714,5 +6727,11 @@ enum remote_procedure { * @generate: none * @acl: domain:write */ - REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_SET =3D 425 + REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_SET =3D 425, + + /** + * @generate: none + * @acl: domain:read + */ + REMOTE_PROC_DOMAIN_GET_DEPRECATIONS =3D 426 }; --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1611336043; cv=none; d=zohomail.com; s=zohoarc; b=fNC48sPxVKdHs9akRbTQ0GRCRtG7duWmbRu5nZTdjCa31gQgdguKtTBMBtl1k5SICMPMA181fr7Vbfjey/htEXlBaYO12YobzKuUrMvUgPXClIzL08q4Izxmwm9U/Dho1EUQsOsz8O+1Ofl0jERgbbEiQVJHJFnwfgNH85ApNuU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611336043; 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=VpdUwL9Fn/di6y1CwPE2KypOFz9aeMXj7cT55p4cHAo=; b=B2F6B/1HkRsnDy1HnoV+J+00L6YDIMluZjHJLQ4N0SzHFERLBQoCXj+JQDg9BGB1ic+CDV3zEP9l2RBTu2FMY6tg17lIG+pL8AoKB4vzQqqZKr+V+MzSPdGccgi4vwfLhwZqwD6t0N4OtCOtf/MjtxH1+ZPFF51p2eme+Oqj2+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611336043196994.8129378858208; Fri, 22 Jan 2021 09:20:43 -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-476-VyoNeLgDMxqbtqy1si0K6A-1; Fri, 22 Jan 2021 12:20:39 -0500 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 6B0141005D4E; Fri, 22 Jan 2021 17:20:34 +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 49AF15D722; Fri, 22 Jan 2021 17:20:34 +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 1347F5002F; Fri, 22 Jan 2021 17:20:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHKXfV010308 for ; Fri, 22 Jan 2021 12:20:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3C00D60C6B; Fri, 22 Jan 2021 17:20:33 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45DBE60BF3; Fri, 22 Jan 2021 17:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336042; 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=VpdUwL9Fn/di6y1CwPE2KypOFz9aeMXj7cT55p4cHAo=; b=cEKgBwqB4oA2Ubcql9AQ52ZeI9Ky2jTpot+1D7V085cxYz2ZpgbBmAktbvAAVZx2MJhO8N VO2vQ3nTkuF6uiO3r+iLaYAJZE3jYMrtti3sTluY2TQnZULwtTZPU2L+3SLCXAExaGKIPf zLeiw69ZvMs/00JCwgxKYpPjL/rYa4s= X-MC-Unique: VyoNeLgDMxqbtqy1si0K6A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 11/16] qemu: implement virDomainGetDeprecations API Date: Fri, 22 Jan 2021 17:18:31 +0000 Message-Id: <20210122171836.3523210-12-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 027617deef..43cdb53f22 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20316,6 +20316,36 @@ qemuDomainAuthorizedSSHKeysSet(virDomainPtr dom, } =20 =20 +static int +qemuDomainGetDeprecations(virDomainPtr dom, + char ***msgs, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + int rv =3D -1; + size_t i; + + virCheckFlags(0, -1); + + if (!(vm =3D qemuDomainObjFromDomain(dom))) + return -1; + + if (virDomainGetDeprecationsEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + *msgs =3D g_new0(char *, vm->ndeprecations + 1); + for (i =3D 0; i < vm->ndeprecations; i++) { + (*msgs)[i] =3D g_strdup(vm->deprecations[i]); + } + (*msgs)[vm->ndeprecations] =3D NULL; + rv =3D vm->ndeprecations; + + cleanup: + virDomainObjEndAPI(&vm); + return rv; +} + + static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, .connectURIProbe =3D qemuConnectURIProbe, @@ -20557,6 +20587,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainBackupGetXMLDesc =3D qemuDomainBackupGetXMLDesc, /* 6.0.0 */ .domainAuthorizedSSHKeysGet =3D qemuDomainAuthorizedSSHKeysGet, /* 6.1= 0.0 */ .domainAuthorizedSSHKeysSet =3D qemuDomainAuthorizedSSHKeysSet, /* 6.1= 0.0 */ + .domainGetDeprecations =3D qemuDomainGetDeprecations, /* 7.1.0 */ }; =20 =20 --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1611336046; cv=none; d=zohomail.com; s=zohoarc; b=ImRHqdtpuU/ns62c2GilLLVXaep5FeCx9VrSe43ER5X4YIXeoG2mFRCbZ2pSA7SkMTt9TjbjvRnNYKTbmXgfhLp2lZs8TheZ1YZ+j7ZYcfrp2hFE2Pyo71LuYDgVMibMr9z9eQfUtIM8R9Z8ecHRfhNDJJoganotDz7f41l8Sr4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611336046; 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=nOlSLn+HAf7v8EPSv7HiiSWqtqhO9TaGGcWBNpaZHIk=; b=gASlx5/IdgF9ay01vDNDN7Rkf2/xlS2V1tvhK/e1sc1jGCh9r+Y7TVPzFosvqSExjnM10rNFd7e0DoEUlGER9fyu34X0hyWskjJ18v9jvJNZ1BNKVL3zcDxLJU+3VwNwf+CUFMXyKLCUutFxf+LgHJUIZ5Jw4lffbRQoe8HsvZM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611336046365423.9855223977605; Fri, 22 Jan 2021 09:20:46 -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-160-hnVT5zGjOU64Gok5VOysqA-1; Fri, 22 Jan 2021 12:20:42 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6821B806673; Fri, 22 Jan 2021 17:20:37 +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 44FA519CBD; Fri, 22 Jan 2021 17:20:37 +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 0103E50031; Fri, 22 Jan 2021 17:20:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHKZqi010336 for ; Fri, 22 Jan 2021 12:20:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id D596D60C6B; Fri, 22 Jan 2021 17:20:35 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9B3A60BF3; Fri, 22 Jan 2021 17:20:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336045; 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=nOlSLn+HAf7v8EPSv7HiiSWqtqhO9TaGGcWBNpaZHIk=; b=Er2XuWdmsPSJs33tAXKN1OKXuCDVO4Agec+JgspYdcV//it/K2XiR8lAmsF3xBDJdjLm0m yOO6YGDnz1iz/9VdN6VqBFQG8SyPrDgubkDdqGTDK1v3ruzHHneTnLxTNER06HNnv7Rzvo 7qqbhUJHhE0UlsX8K8C/+jnn97sq/Ds= X-MC-Unique: hnVT5zGjOU64Gok5VOysqA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 12/16] tools: report deprecations for 'dominfo' command Date: Fri, 22 Jan 2021 17:18:32 +0000 Message-Id: <20210122171836.3523210-13-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) $ virsh dominfo demo Id: 2 Name: demo UUID: eadf8ef0-bf14-4c5f-9708-4a19bacf9e81 OS Type: hvm State: running CPU(s): 2 CPU time: 15.8s Max memory: 1536000 KiB Used memory: 1536000 KiB Persistent: yes Autostart: disable Managed save: no Security model: selinux Security DOI: 0 Security label: unconfined_u:unconfined_r:svirt_t:s0:c443,c956 (permissive) Deprecations: machine type 'pc-1.3' CPU model 'Icelake-Client' Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-monitor.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 5d0a03afa9..6b39b60339 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1291,6 +1291,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) char *str, uuid[VIR_UUID_STRING_BUFLEN]; int has_managed_save =3D 0; virshControlPtr priv =3D ctl->privData; + char **deprecations =3D NULL; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; @@ -1391,6 +1392,18 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) VIR_FREE(seclabel); } } + + if (virDomainGetDeprecations(dom, &deprecations, 0) > 0) { + size_t i; + for (i =3D 0; deprecations[i] !=3D NULL; i++) { + if (i =3D=3D 0) { + vshPrint(ctl, "%-15s %s\n", _("Deprecations:"), deprecatio= ns[i]); + } else { + vshPrint(ctl, "%-15s %s\n", "", deprecations[i]); + } + } + } + virshDomainFree(dom); return ret; } --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1611336069; cv=none; d=zohomail.com; s=zohoarc; b=XoyePm4AQleE/g7pnha/Y/jE8mrv+AQKHWkTii0VR8JmNklUnmQVZCxCN7XEjj2plEbhmmQ0JqSMzJqzuhPVo+gMIgts7t5aLdDXMZ1cf1kgMq1SpETuxjM0ma8Q56fR9J7HOnS8dNadgO6wbL9s1OSGZHXREA7VkULWhw50XP8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611336069; 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=ScvhfzOgnrqBQsqT7/Rv8TYW92P5n5D55LNp5tY9byA=; b=XZP8Gul5zPdmoPCrBV3X7B1DddY7cFVgiiijnezZxnDo5Zp0EB2Ewz2pTB4dN3Z2uquDUZkRlEknp+SeuzjJiBtxDi9Or8cHEJh2lR0p2vGx4JYG8nFNDHcTY7AqOqI4Vq8eMEV6VjlizVn8pFM1e8xvu0r5qb0cRhC/0hZY700= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1611336069811638.9977494791796; Fri, 22 Jan 2021 09:21:09 -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-256-KFZoKxTrPwyvyJy_fgrlpQ-1; Fri, 22 Jan 2021 12:20:45 -0500 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 ECE291005D51; Fri, 22 Jan 2021 17:20:39 +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 CBFF8709AE; Fri, 22 Jan 2021 17:20:39 +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 99BC51809C9F; Fri, 22 Jan 2021 17:20:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHKbFg010356 for ; Fri, 22 Jan 2021 12:20:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 910F060C61; Fri, 22 Jan 2021 17:20:37 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41A2B60BF3; Fri, 22 Jan 2021 17:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336066; 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=ScvhfzOgnrqBQsqT7/Rv8TYW92P5n5D55LNp5tY9byA=; b=HnUuYtAZA6G7ACEMPrNRZ1Z79HRVfueodtC6MbckPHFZSoOgo/v43CxcW+3h0t554q8jbo FAvgqYxRlgibcWSW/q3xh8IfPpJz8DYPlcrzBJ5aLBbjsjhzJ4nwgjJpbSxIZsJSjm7BCr /wA8mkp2ydV5Q0hiy+Cyjn2Knkrzjc8= X-MC-Unique: KFZoKxTrPwyvyJy_fgrlpQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 13/16] src: define virDomainGetTainting API Date: Fri, 22 Jan 2021 17:18:33 +0000 Message-Id: <20210122171836.3523210-14-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) This API allows fetching a list of tainting codes against the domain. Internally tainting is defined as a bitmask with enum fields. Most, but not all, of the fields are somewhat QEMU specific in reality though. The idea of exposing the enum in the public API thus feels a little questionable. This API takes the approach of exposing the the string format of the enum codes and declaring the string codes are (potentially) hypervisor specific. IOW, callers of the API can display the codes but should treat them as a opaque strings. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- include/libvirt/libvirt-domain.h | 3 ++ src/driver-hypervisor.h | 5 ++++ src/libvirt-domain.c | 48 ++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + 4 files changed, 57 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index cef16e6361..d04140bf60 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -5122,5 +5122,8 @@ int virDomainAuthorizedSSHKeysSet(virDomainPtr domain, int virDomainGetDeprecations(virDomainPtr domain, char ***msgs, unsigned int flags); +int virDomainGetTainting(virDomainPtr domain, + char ***codes, + unsigned int flags); =20 #endif /* LIBVIRT_DOMAIN_H */ diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 2f804dba1f..96111cd10a 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1404,6 +1404,10 @@ typedef int (*virDrvDomainGetDeprecations)(virDomainPtr domain, char ***msgs, unsigned int flags); +typedef int +(*virDrvDomainGetTainting)(virDomainPtr domain, + char ***codes, + unsigned int flags); =20 typedef struct _virHypervisorDriver virHypervisorDriver; typedef virHypervisorDriver *virHypervisorDriverPtr; @@ -1671,4 +1675,5 @@ struct _virHypervisorDriver { virDrvDomainAuthorizedSSHKeysGet domainAuthorizedSSHKeysGet; virDrvDomainAuthorizedSSHKeysSet domainAuthorizedSSHKeysSet; virDrvDomainGetDeprecations domainGetDeprecations; + virDrvDomainGetTainting domainGetTainting; }; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 9e3b118483..c053f35d3e 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -13149,3 +13149,51 @@ virDomainGetDeprecations(virDomainPtr domain, virDispatchError(conn); return -1; } + + +/** + * virDomainGetTainting: + * @domain: a domain object + * @codes: pointer to a variable to store tainting codes + * @flags: extra flags; not used yet, so callers should always pass 0 + * + * Fetch a list of all tainting codes for the VM and + * store them into @msgs array which is allocated upon + * successful return and is NULL terminated. The caller is + * responsible for freeing @msgs when no longer needed. + * + * Note that some hypervisors may only report tainting + * codes while the VM is in a running state. The list + * tainting codes is also hypervisor specific. + * + * Returns: number of messages stored in @msgs, + * -1 otherwise. + */ +int +virDomainGetTainting(virDomainPtr domain, + char ***codes, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "codes=3D%p, flags=3D0x%x", codes, flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn =3D domain->conn; + virCheckNonNullArgGoto(codes, error); + + if (conn->driver->domainGetTainting) { + int ret; + ret =3D conn->driver->domainGetTainting(domain, codes, flags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + error: + virDispatchError(conn); + return -1; +} diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 345c5685bf..246fbaf1dc 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -882,6 +882,7 @@ LIBVIRT_6.10.0 { LIBVIRT_7.1.0 { global: virDomainGetDeprecations; + virDomainGetTainting; } LIBVIRT_6.10.0; =20 # .... define new API here using predicted next version number .... --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1611336052; cv=none; d=zohomail.com; s=zohoarc; b=mApbqIGALAG7X61OXva77tEQRX+Lg5co3Shw7hBmZRrSFqDQOwbqAMRf+gm6fGUzsr6I6coPAqoQGLKDcZQg/zRdMPMne9Puqs9B93s/togJj8N6ehKU9LshGiLgz/nReEN58e4gbFdV6HW9Nf9wbRgEFxMzCZfvnTlxdbreA68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611336052; 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=X2QsgktDgekkqiiW/mv7Q+X7dv/DbRHOHCTGGkHaWbE=; b=lcFtp1ZW5xPnjvuDeAfLDfixXCe4Y+XbagbYUgVBTZ9dgr3lc43r+Dcak8Kp1Lbin8L9CcJReSPsUYA3CzL47iPSKfm6oOLJMatOLNmLHN1QohX6MvjGwYfK7tdVAqcqdonaoIfSS6Baxko8tYyXPKDSMlO8GwaGxUZhWK3yfnY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1611336052393251.45132960380965; Fri, 22 Jan 2021 09:20:52 -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-329-Ml3uGBE7P8qa6xH9oKeTMw-1; Fri, 22 Jan 2021 12:20:47 -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 52D77107ACE8; Fri, 22 Jan 2021 17:20:41 +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 31DC85DA38; Fri, 22 Jan 2021 17:20:41 +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 F16C050032; Fri, 22 Jan 2021 17:20:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHKdv0010382 for ; Fri, 22 Jan 2021 12:20:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 884B460C61; Fri, 22 Jan 2021 17:20:39 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 120CE60BF3; Fri, 22 Jan 2021 17:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336051; 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=X2QsgktDgekkqiiW/mv7Q+X7dv/DbRHOHCTGGkHaWbE=; b=N3NRuBtGzlgA9EvyaQNb4JG6HTEuoKwHk9ZyZSzfIFDxczeR6xnhCKNpQzKGtfWL1GlyD7 1NVr7smvOzPWGLTM9g1JOG5bQ0eABT7Kpk6f3ivZfVIhkZmqod6lz8GWctO8Z5gVc+YeRw //eyt4FR16LEysvlHGUI+jOE8bar3zI= X-MC-Unique: Ml3uGBE7P8qa6xH9oKeTMw-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 14/16] remote: add RPC support for the virDomainGetTainting API Date: Fri, 22 Jan 2021 17:18:34 +0000 Message-Id: <20210122171836.3523210-15-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/remote/remote_daemon_dispatch.c | 46 +++++++++++++++++++++++++++++ src/remote/remote_driver.c | 44 +++++++++++++++++++++++++++ src/remote/remote_protocol.x | 20 ++++++++++++- 3 files changed, 109 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index aa6a088222..f2249dfa0f 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -7508,3 +7508,49 @@ remoteDispatchDomainGetDeprecations(virNetServerPtr = server G_GNUC_UNUSED, =20 return rv; } + + +static int +remoteDispatchDomainGetTainting(virNetServerPtr server G_GNUC_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg G_GNUC_UNUSED, + virNetMessageErrorPtr rerr, + remote_domain_get_tainting_args *args, + remote_domain_get_tainting_ret *ret) +{ + int rv =3D -1; + virConnectPtr conn =3D remoteGetHypervisorConn(client); + int ncodes =3D 0; + char **codes =3D NULL; + virDomainPtr dom =3D NULL; + + if (!conn) + goto cleanup; + + if (!(dom =3D get_nonnull_domain(conn, args->dom))) + goto cleanup; + + if ((ncodes =3D virDomainGetTainting(dom, &codes, args->flags)) < 0) + goto cleanup; + + if (ncodes > REMOTE_DOMAIN_TAINTING_MAX) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Number of codes %d, which exceeds max limit: %d"= ), + ncodes, REMOTE_DOMAIN_TAINTING_MAX); + goto cleanup; + } + + ret->codes.codes_val =3D g_steal_pointer(&codes); + ret->codes.codes_len =3D ncodes; + + rv =3D ncodes; + + cleanup: + if (rv < 0) + virNetMessageSaveError(rerr); + if (ncodes > 0) + virStringListFreeCount(codes, ncodes); + virObjectUnref(dom); + + return rv; +} diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 009df01a54..c3cdb751f6 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8141,6 +8141,49 @@ remoteDomainGetDeprecations(virDomainPtr domain, return rv; } =20 +static int +remoteDomainGetTainting(virDomainPtr domain, + char ***codes, + unsigned int flags) +{ + int rv =3D -1; + size_t i; + struct private_data *priv =3D domain->conn->privateData; + remote_domain_get_tainting_args args; + remote_domain_get_tainting_ret ret; + + remoteDriverLock(priv); + + make_nonnull_domain(&args.dom, domain); + args.flags =3D flags; + memset(&ret, 0, sizeof(ret)); + + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_TAINTING, + (xdrproc_t) xdr_remote_domain_get_tainting_args, (char *)&arg= s, + (xdrproc_t) xdr_remote_domain_get_tainting_ret, (char *)&ret)= =3D=3D -1) { + goto cleanup; + } + + if (ret.codes.codes_len > REMOTE_DOMAIN_TAINTING_MAX) { + virReportError(VIR_ERR_RPC, "%s", + _("remoteDomainGetTainting: " + "returned number of codes exceeds limit")); + goto cleanup; + } + + *codes =3D g_new0(char *, ret.codes.codes_len + 1); + for (i =3D 0; i < ret.codes.codes_len; i++) + (*codes)[i] =3D g_strdup(ret.codes.codes_val[i]); + + rv =3D ret.codes.codes_len; + + cleanup: + remoteDriverUnlock(priv); + xdr_free((xdrproc_t)xdr_remote_domain_get_tainting_ret, + (char *) &ret); + return rv; +} + /* get_nonnull_domain and get_nonnull_network turn an on-wire * (name, uuid) pair into virDomainPtr or virNetworkPtr object. * These can return NULL if underlying memory allocations fail, @@ -8575,6 +8618,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainAuthorizedSSHKeysGet =3D remoteDomainAuthorizedSSHKeysGet, /* 6= .10.0 */ .domainAuthorizedSSHKeysSet =3D remoteDomainAuthorizedSSHKeysSet, /* 6= .10.0 */ .domainGetDeprecations =3D remoteDomainGetDeprecations, /* 7.1.0 */ + .domainGetTainting =3D remoteDomainGetTainting, /* 7.1.0 */ }; =20 static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 4ddfb09631..bcb15b251f 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -286,6 +286,9 @@ const REMOTE_DOMAIN_AUTHORIZED_SSH_KEYS_MAX =3D 2048; /* Upper limit on number of deprecation messages */ const REMOTE_DOMAIN_DEPRECATIONS_MAX =3D 2048; =20 +/* Upper limit on number of tainting codes */ +const REMOTE_DOMAIN_TAINTING_MAX =3D 2048; + =20 /* UUID. VIR_UUID_BUFLEN definition comes from libvirt.h */ typedef opaque remote_uuid[VIR_UUID_BUFLEN]; @@ -3811,6 +3814,15 @@ struct remote_domain_get_deprecations_ret { remote_nonnull_string msgs; }; =20 +struct remote_domain_get_tainting_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + +struct remote_domain_get_tainting_ret { + remote_nonnull_string codes; +}; + =20 /*----- Protocol. -----*/ =20 @@ -6733,5 +6745,11 @@ enum remote_procedure { * @generate: none * @acl: domain:read */ - REMOTE_PROC_DOMAIN_GET_DEPRECATIONS =3D 426 + REMOTE_PROC_DOMAIN_GET_DEPRECATIONS =3D 426, + + /** + * @generate: none + * @acl: domain:read + */ + REMOTE_PROC_DOMAIN_GET_TAINTING =3D 427 }; --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1611336054; cv=none; d=zohomail.com; s=zohoarc; b=d86QrTWl3PBouHKK1HBx5ntRa3AhVampH09bLSwXs0WXERZgPbCTEawS815+L5zn0AaDIbwoe3OykICirzpUtoCk9TbfMMEwrQ/LFBzKUV41s7dGb54f88qFQ8eL3Z0SiirSnd3olSqJNNqSW54GmeVJHNlzZx9mmwVQz8CewW8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611336054; 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=IlY7M2FFyX4TTfta5U2a8s79HXTK4wN1+54x8dQWNMU=; b=N8aTSLOmEYAXUqC+EYvuSaA3EcqcJ0xfj6iTIhimCc4oD6WgRsHQ7pN+RBjJ1aevQszWvw9MWDLLuZpLG4Vri1jv/Ye5FjBvhnuD735fyb3fVj1QWlBxFWvBErTzO06cc3IFfmY06U/W+dpK6sg9XP8BDpiJYKtr4PZr7i+ZfYw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 16113360544407.210963278002964; Fri, 22 Jan 2021 09:20:54 -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-83-Nh14-sImPKanTf2QsMoGLg-1; Fri, 22 Jan 2021 12:20:49 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2754E1005D57; Fri, 22 Jan 2021 17:20:43 +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 03B2271CA2; Fri, 22 Jan 2021 17:20:43 +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 C2D4B50035; Fri, 22 Jan 2021 17:20:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHKgEl010403 for ; Fri, 22 Jan 2021 12:20:42 -0500 Received: by smtp.corp.redhat.com (Postfix) id 456FA60C66; Fri, 22 Jan 2021 17:20:42 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43DE160C13; Fri, 22 Jan 2021 17:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336053; 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=IlY7M2FFyX4TTfta5U2a8s79HXTK4wN1+54x8dQWNMU=; b=TS1Fe7uIBPtCNjgKGHgMVjAYA9uP6PfJPXPLcPtZlnYG3Ixuc+4jYghxTPF9imp+Je3vi6 2qZg2EKTSFH3lyQlutCElZ6X7KPTZo6rU38I2HWk2t7DCvTWCLvfe9qgM9+leVwIYA1JZo 1gIQ+jsDfIcRtkIcNPvhX51r1LDcNBI= X-MC-Unique: Nh14-sImPKanTf2QsMoGLg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 15/16] qemu: implement virDomainGetTainting API Date: Fri, 22 Jan 2021 17:18:35 +0000 Message-Id: <20210122171836.3523210-16-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 43cdb53f22..48d2dafb2f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20346,6 +20346,40 @@ qemuDomainGetDeprecations(virDomainPtr dom, } =20 =20 +static int +qemuDomainGetTainting(virDomainPtr dom, + char ***codes, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + int rv =3D -1; + size_t i, n; + size_t ntaint; + + virCheckFlags(0, -1); + + if (!(vm =3D qemuDomainObjFromDomain(dom))) + return -1; + + if (virDomainGetTaintingEnsureACL(dom->conn, vm->def) < 0) + goto cleanup; + + ntaint =3D __builtin_popcount(vm->taint); + *codes =3D g_new0(char *, ntaint + 1); + for (i =3D 0, n =3D 0; i < VIR_DOMAIN_TAINT_LAST && n < ntaint; i++) { + if (vm->taint & (1 << i)) { + (*codes)[n++] =3D g_strdup(virDomainTaintTypeToString(i)); + } + } + (*codes)[n] =3D NULL; + rv =3D ntaint; + + cleanup: + virDomainObjEndAPI(&vm); + return rv; +} + + static virHypervisorDriver qemuHypervisorDriver =3D { .name =3D QEMU_DRIVER_NAME, .connectURIProbe =3D qemuConnectURIProbe, @@ -20588,6 +20622,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainAuthorizedSSHKeysGet =3D qemuDomainAuthorizedSSHKeysGet, /* 6.1= 0.0 */ .domainAuthorizedSSHKeysSet =3D qemuDomainAuthorizedSSHKeysSet, /* 6.1= 0.0 */ .domainGetDeprecations =3D qemuDomainGetDeprecations, /* 7.1.0 */ + .domainGetTainting =3D qemuDomainGetTainting, /* 7.1.0 */ }; =20 =20 --=20 2.29.2 From nobody Sun Apr 28 18:47:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1611336089; cv=none; d=zohomail.com; s=zohoarc; b=FmFPzTzmvDjnq3MuGwm7LsHJeQWaXuiqzKoTNU2fkF1+OUdiMDm2GdYu9anKeiAIAMJ7NbRZDlr1xIDVWJN0yi5sEaoTwCjRWBab+lYlJ6pTIj/C3b7udh1X8P/tX/6yYIXX/HJlhiry5yDKCiW28c5sn65fI/l/VfL4aRflIkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611336089; 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=UdKE1Tfe99CrqK7CJgCxVr1q7BR9G3t1kR6/Hlcb0Q8=; b=VZZioXBQcrbeX1HuCknRHrIbUUkXiOtZhezmjrRtfhjn/vqaDz9paXmp139G8xee1E5GsAC+XMdCzNEzhWsBqlHbBh+l3FCQdCsEGCnI/JLYpwK3nCAI+F1vkCwwMpweuhl3W1tRF0CXSMLc+rWOofWVRNNq0flzTSNoqfBXnVs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 161133608901879.95641853418226; Fri, 22 Jan 2021 09:21:29 -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-159-THACicdUOeOazCzCWsewiA-1; Fri, 22 Jan 2021 12:20:51 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 80029107ACFC; Fri, 22 Jan 2021 17:20:45 +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 5D7BF10190AA; Fri, 22 Jan 2021 17:20:45 +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 2AD671809CA1; Fri, 22 Jan 2021 17:20:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10MHKi6P010427 for ; Fri, 22 Jan 2021 12:20:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 52CB860C61; Fri, 22 Jan 2021 17:20:44 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-108.ams2.redhat.com [10.36.115.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id BE9B360C13; Fri, 22 Jan 2021 17:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336054; 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=UdKE1Tfe99CrqK7CJgCxVr1q7BR9G3t1kR6/Hlcb0Q8=; b=gWaN+NdEGebSwKhSvO4XuNAy2KYb1dbd1VSkZCHVnL1Se3zCiK3HkAQ08iz8b5JIC3JigF OWh74BUqtWNabqypoHeiGJU0ym3B9uan02bOsUWy/Ok3RZ6n/PdTIqQwlnMJHRaflcGQyK cC4lb5YmwJwlPMfYWahM4CxPYdk4c4w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611336087; 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=UdKE1Tfe99CrqK7CJgCxVr1q7BR9G3t1kR6/Hlcb0Q8=; b=i3wXCynWeM7JFxOMb54dQSoS+YZtzrczFFadF3i+ocxsP+eciL6pk6S4w7M4W8qA/viTLo uKMi63yskNGqE9WKKnPfgIrBcuLJE4OSg1FDrvxVUcrywNZeq+eEPQuiroLpSDpBFV3bwq otcCh0eruiRBw2Dz981MkTEITpKp+Z0= X-MC-Unique: THACicdUOeOazCzCWsewiA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 16/16] tools: report tainting for 'dominfo' command Date: Fri, 22 Jan 2021 17:18:36 +0000 Message-Id: <20210122171836.3523210-17-berrange@redhat.com> In-Reply-To: <20210122171836.3523210-1-berrange@redhat.com> References: <20210122171836.3523210-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Eduardo Habkost 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.84 on 10.5.11.22 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) $ virsh dominfo demo Id: 2 Name: demo UUID: eadf8ef0-bf14-4c5f-9708-4a19bacf9e81 OS Type: hvm State: running CPU(s): 2 CPU time: 15.8s Max memory: 1536000 KiB Used memory: 1536000 KiB Persistent: yes Autostart: disable Managed save: no Security model: selinux Security DOI: 0 Security label: unconfined_u:unconfined_r:svirt_t:s0:c443,c956 (permissive) Tainting: custom-monitor deprecated-config Deprecations: machine type 'pc-1.3' CPU model 'Icelake-Client' Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: J=C3=A1n Tomko --- tools/virsh-domain-monitor.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index 6b39b60339..ca85851810 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1292,6 +1292,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) int has_managed_save =3D 0; virshControlPtr priv =3D ctl->privData; char **deprecations =3D NULL; + char **tainting =3D NULL; =20 if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) return false; @@ -1393,6 +1394,17 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) } } =20 + if (virDomainGetTainting(dom, &tainting, 0) > 0) { + size_t i; + for (i =3D 0; tainting[i] !=3D NULL; i++) { + if (i =3D=3D 0) { + vshPrint(ctl, "%-15s %s\n", _("Tainting:"), tainting[i]); + } else { + vshPrint(ctl, "%-15s %s\n", "", tainting[i]); + } + } + } + if (virDomainGetDeprecations(dom, &deprecations, 0) > 0) { size_t i; for (i =3D 0; deprecations[i] !=3D NULL; i++) { --=20 2.29.2