From nobody Fri Apr 19 00:04:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1593122359; cv=none; d=zohomail.com; s=zohoarc; b=Y6e2z16vuzomDN+Wz5S75yUIm5sbmZk1DnSs3LSY1Ko0GrsPBlUAQ2fm9E1AKN080cVCV+GP+aLCSCjJPMCO9WlWYDQ7fnZ2/WoefkZ+c2m0E0LQLWGE6I9+en49y7VGq6L/CFCGrxbMezvTap9TjT/bSowTwVpAJiMR/XPW9YQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593122359; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=aYM5FGCQHZGM97LHugJqGzrNg7OGqtkIc5sZ3IOXjCk=; b=NVttDO0MkkBGhqsgp3+f4/WqSA+rFQ4X+kG2AWODsTay3s/o7TOr98D4hvyzqETrT8LBlQrDoeba9aprqJKhHIg1Ms8MjzB8ZIilnj8KL8r+PlhRYpjcIhjAc+R+SMGL4MzlparXbMPbmwoKS46vJP9PRgtq3Ur1MjRhhPa7vtY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1593122359091821.5787498183537; Thu, 25 Jun 2020 14:59:19 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-426-tv_1v1VEMwSRv6FmFR2UDA-1; Thu, 25 Jun 2020 17:59:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BC690A0BD7; Thu, 25 Jun 2020 21:59:09 +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 6F2B57FD0E; Thu, 25 Jun 2020 21:59:08 +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 8E0108759D; Thu, 25 Jun 2020 21:59:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05PLx2Uo022037 for ; Thu, 25 Jun 2020 17:59:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 925D32022ADF; Thu, 25 Jun 2020 21:59:02 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E09D2022ADE for ; Thu, 25 Jun 2020 21:59:00 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 50082804C9D for ; Thu, 25 Jun 2020 21:59:00 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-116-pHcg-GDQMqy-ckLyKGFesQ-1; Thu, 25 Jun 2020 17:58:58 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05PLXYWh034785 for ; Thu, 25 Jun 2020 17:58:57 -0400 Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com with ESMTP id 31vbn7my2k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Jun 2020 17:58:56 -0400 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05PLu3di002819 for ; Thu, 25 Jun 2020 21:58:55 GMT Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by ppma01dal.us.ibm.com with ESMTP id 31uuruu50y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 25 Jun 2020 21:58:55 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05PLwsa746268892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 25 Jun 2020 21:58:54 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1687C6E053 for ; Thu, 25 Jun 2020 21:58:54 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CFB336E04C for ; Thu, 25 Jun 2020 21:58:53 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.85.202.75]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP for ; Thu, 25 Jun 2020 21:58:53 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593122357; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=aYM5FGCQHZGM97LHugJqGzrNg7OGqtkIc5sZ3IOXjCk=; b=czItZcQgfY/cJxvwqIVOnhtDByP7Y/TOWbqBqhkfdttvlHOomB/G0q0FRmFN91t0FmoT+s QsBaKDkjAF5EmGh4VcCZycEQPe5pYUWzRQnTfL+7Act3PYvB9OCLlAXH6ztyhsAgqoH7ou 0HGy+SdCPerAJsAOIZlhkpMu3vfsLtI= X-MC-Unique: tv_1v1VEMwSRv6FmFR2UDA-1 X-MC-Unique: pHcg-GDQMqy-ckLyKGFesQ-1 From: Collin Walling To: libvir-list@redhat.com Subject: [PATCH v1] qemu: monitor: substitute missing model name for host-passthrough Date: Thu, 25 Jun 2020 17:58:46 -0400 Message-Id: <20200625215846.30757-1-walling@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-25_19:2020-06-25, 2020-06-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 adultscore=0 impostorscore=0 mlxscore=0 phishscore=0 priorityscore=1501 cotscore=-2147483648 suspectscore=0 bulkscore=0 clxscore=1011 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006250125 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When executing the hypervisor-cpu-compare/baseline commands and the XML file contains a CPU definition using host-passthrough and no model name, the commands will fail and return an error message from the QMP response. Let's fix this by checking for host-passthrough and a missing model name when converting a CPU definition to a JSON object. If these conditions are matched, then the JSON object will be constructed using "host" as the model name. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1850680 Signed-off-by: Collin Walling --- src/qemu/qemu_monitor_json.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3070c1e6b3..448a3a9356 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5804,9 +5804,20 @@ qemuMonitorJSONMakeCPUModel(virCPUDefPtr cpu, { virJSONValuePtr model =3D virJSONValueNewObject(); virJSONValuePtr props =3D NULL; + const char *model_name =3D cpu->model; size_t i; =20 - if (virJSONValueObjectAppendString(model, "name", cpu->model) < 0) + if (!model_name) { + if (cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH) { + model_name =3D "host"; + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("cpu parameter is missing a model name")); + goto error; + } + } + + if (virJSONValueObjectAppendString(model, "name", model_name) < 0) goto error; =20 if (cpu->nfeatures || !migratable) { --=20 2.26.2