From nobody Thu May 15 01:09:28 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1512565763117415.4034385770045; Wed, 6 Dec 2017 05:09:23 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 1B6D47F7B9; Wed, 6 Dec 2017 13:09:22 +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 EC8C863775; Wed, 6 Dec 2017 13:09:21 +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 B17061800BDB; Wed, 6 Dec 2017 13:09:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vB6D8BO0023394 for ; Wed, 6 Dec 2017 08:08:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9DABC4D71F; Wed, 6 Dec 2017 13:08:11 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-84.phx2.redhat.com [10.3.117.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id 641D05C888 for ; Wed, 6 Dec 2017 13:08:11 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Wed, 6 Dec 2017 08:08:04 -0500 Message-Id: <20171206130806.13619-3-jferlan@redhat.com> In-Reply-To: <20171206130806.13619-1-jferlan@redhat.com> References: <20171206130806.13619-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] qemu: Use same model when adding hostdev SCSI controller 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 06 Dec 2017 13:09:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When qemuDomainFindOrCreateSCSIDiskController adds a controller, let's use the same model as a currently found controller under the assumption that the reason to add the controller in hotplug is because virDomainHostdevAssignAddress determined that there were too many devices on the existing controller, but only assigned a new controller index and did not add a new controller and we desire to use the same controller model as any existing conroller and not take a chance that qemuDomainSetSCSIControllerModel would use a default that may be incompatible. Signed-off-by: John Ferlan Reviewed-by: Eric Farman --- src/qemu/qemu_hotplug.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 9317e134a..90d50e7b1 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -587,6 +587,7 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverP= tr driver, { size_t i; virDomainControllerDefPtr cont; + virDomainControllerModelSCSI model =3D -1; =20 for (i =3D 0; i < vm->def->ncontrollers; i++) { cont =3D vm->def->controllers[i]; @@ -596,6 +597,12 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriver= Ptr driver, =20 if (cont->idx =3D=3D controller) return cont; + + /* Save off the model - if we end up creating a controller it's + * because the user didn't provide one and we need to automagically + * create one because the existing one is full - so let's be sure + * to keep the same model in that case. */ + model =3D cont->model; } =20 /* No SCSI controller present, for backward compatibility we @@ -604,11 +611,10 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDrive= rPtr driver, return NULL; cont->type =3D VIR_DOMAIN_CONTROLLER_TYPE_SCSI; cont->idx =3D controller; - cont->model =3D -1; + cont->model =3D model; =20 - VIR_INFO("No SCSI controller present, hotplugging one"); - if (qemuDomainAttachControllerDevice(driver, - vm, cont) < 0) { + VIR_INFO("No SCSI controller present, hotplugging one model=3D%d", mod= el); + if (qemuDomainAttachControllerDevice(driver, vm, cont) < 0) { VIR_FREE(cont); return NULL; } --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list