From nobody Mon Feb 9 16:13:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; 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 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 1656432685698903.9307813354266; Tue, 28 Jun 2022 09:11:25 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-135-WtoTaPvxPfi--UAxuOqgWQ-1; Tue, 28 Jun 2022 12:10:07 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E0F898339DF; Tue, 28 Jun 2022 16:09:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA51540CFD0B; Tue, 28 Jun 2022 16:09:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 43BA31947067; Tue, 28 Jun 2022 16:09:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EE3B31947058 for ; Tue, 28 Jun 2022 16:09:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DD5B02166B2A; Tue, 28 Jun 2022 16:09:52 +0000 (UTC) Received: from work.fritz.box (unknown [10.39.193.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BCF52166B26; Tue, 28 Jun 2022 16:09:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656432684; 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=2cs+CLulVJeXU8wi6nTrBYiWX4XaTVaB17oaE+cnnnE=; b=EW3AZtCBmQk33Doq4pov1lb/5r/z0bK9VqccGbkY3YXM1XQYTPifssxnWYJaXkixKhPVVM RFkljnbARucAXw8EW2TLaboucQr4Pl9Ex9sjFEJ8ozB2PSUT/Jd/R+wJ1bkOcjtXkjxB8Z c1VoW1TJOEoALjSqvBxg3UGni00iuC4= X-MC-Unique: WtoTaPvxPfi--UAxuOqgWQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 7/9] remote: Add support for the virConnectGetHypervisorCPUModelDefinition API Date: Tue, 28 Jun 2022 18:09:44 +0200 Message-Id: <20220628160946.61028-8-twiederh@redhat.com> In-Reply-To: <20220628160946.61028-1-twiederh@redhat.com> References: <20220628160946.61028-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim Wiederhake Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1656432687545100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Tim Wiederhake --- src/remote/remote_daemon_dispatch.c | 32 ++++++++++++++++++++++ src/remote/remote_driver.c | 41 +++++++++++++++++++++++++++++ src/remote/remote_protocol.x | 20 +++++++++++++- src/remote_protocol-structs | 11 ++++++++ 4 files changed, 103 insertions(+), 1 deletion(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 9011977e18..bc30cb819c 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -5913,6 +5913,38 @@ remoteDispatchConnectGetHypervisorCPUModelNames(virN= etServer *server G_GNUC_UNUS } =20 =20 +static int +remoteDispatchConnectGetHypervisorCPUModelDefinition(virNetServer *server = G_GNUC_UNUSED, + virNetServerClient *c= lient, + virNetMessage *msg G_= GNUC_UNUSED, + struct virNetMessageE= rror *rerr, + remote_connect_get_hy= pervisor_cpu_model_definition_args *args, + remote_connect_get_hy= pervisor_cpu_model_definition_ret *ret) +{ + int rv =3D -1; + virConnectPtr conn =3D remoteGetHypervisorConn(client); + g_autofree char *xml =3D NULL; + + if (!conn) + goto cleanup; + + rv =3D virConnectGetHypervisorCPUModelDefinition(conn, args->arch, + args->machine, args->na= me, + &xml, args->flags); + if (rv < 0) + goto cleanup; + + ret->xml =3D g_steal_pointer(&xml); + rv =3D 0; + + cleanup: + ret->ret =3D rv; + if (rv < 0) + virNetMessageSaveError(rerr); + return rv; +} + + static int remoteDispatchDomainCreateXMLWithFiles(virNetServer *server G_GNUC_UNUSED, virNetServerClient *client, diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 8dca23a7eb..7aec988746 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -6451,6 +6451,46 @@ remoteConnectGetHypervisorCPUModelNames(virConnectPt= r conn, } =20 =20 +static int +remoteConnectGetHypervisorCPUModelDefinition(virConnectPtr conn, + const char *arch, + const char *machine, + const char *name, + char **xmlCPU, + unsigned int flags) +{ + int rv =3D -1; + remote_connect_get_hypervisor_cpu_model_definition_args args; + remote_connect_get_hypervisor_cpu_model_definition_ret ret; + + struct private_data *priv =3D conn->privateData; + + remoteDriverLock(priv); + + args.arch =3D (char *) arch; + args.machine =3D (char *) machine; + args.name =3D (char *) name; + args.flags =3D flags; + + memset(&ret, 0, sizeof(ret)); + if (call(conn, priv, 0, REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_D= EFINITION, + (xdrproc_t) xdr_remote_connect_get_hypervisor_cpu_model_defin= ition_args, + (char *) &args, + (xdrproc_t) xdr_remote_connect_get_hypervisor_cpu_model_defin= ition_ret, + (char *) &ret) < 0) + goto done; + + *xmlCPU =3D g_steal_pointer(&ret.xml); + rv =3D ret.ret; + + xdr_free((xdrproc_t) xdr_remote_connect_get_hypervisor_cpu_model_defin= ition_ret, + (char *) &ret); + + done: + remoteDriverUnlock(priv); + return rv; +} + static int remoteDomainOpenGraphics(virDomainPtr dom, unsigned int idx, @@ -8711,6 +8751,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainStartDirtyRateCalc =3D remoteDomainStartDirtyRateCalc, /* 7.2.0= */ .domainSetLaunchSecurityState =3D remoteDomainSetLaunchSecurityState, = /* 8.0.0 */ .connectGetHypervisorCPUModelNames =3D remoteConnectGetHypervisorCPUMo= delNames, /* 8.5.0 */ + .connectGetHypervisorCPUModelDefinition =3D remoteConnectGetHypervisor= CPUModelDefinition, /* 8.5.0 */ }; =20 static virNetworkDriver network_driver =3D { diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index a5c60399c7..2d7d6277c6 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -3314,6 +3314,18 @@ struct remote_connect_get_hypervisor_cpu_model_names= _ret { int ret; }; =20 +struct remote_connect_get_hypervisor_cpu_model_definition_args { + remote_nonnull_string arch; + remote_nonnull_string machine; + remote_nonnull_string name; + unsigned int flags; +}; + +struct remote_connect_get_hypervisor_cpu_model_definition_ret { + remote_nonnull_string xml; + int ret; +}; + struct remote_connect_network_event_register_any_args { int eventID; remote_network net; @@ -6976,5 +6988,11 @@ enum remote_procedure { * @generate: none * @acl: connect:read */ - REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_NAMES =3D 443 + REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_NAMES =3D 443, + + /** + * @generate: none + * @acl: connect:read + */ + REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_DEFINITION =3D 444 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index c6afb92aad..0fdc1e8800 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -2686,6 +2686,16 @@ struct remote_connect_get_hypervisor_cpu_model_names= _ret { } aliases; int ret; }; +struct remote_connect_get_hypervisor_cpu_model_definition_args { + remote_nonnull_string arch; + remote_nonnull_string machine; + remote_nonnull_string name; + u_int flags; +}; +struct remote_connect_get_hypervisor_cpu_model_definition_ret { + remote_nonnull_string xml; + int ret; +}; struct remote_connect_network_event_register_any_args { int eventID; remote_network net; @@ -3727,4 +3737,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_RESTORE_PARAMS =3D 441, REMOTE_PROC_DOMAIN_ABORT_JOB_FLAGS =3D 442, REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_NAMES =3D 443, + REMOTE_PROC_CONNECT_GET_HYPERVISOR_CPU_MODEL_DEFINITION =3D 444, }; --=20 2.31.1