From nobody Fri Apr 19 08:15:10 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565968704; cv=none; d=zoho.com; s=zohoarc; b=SWoWk/2S/XvoPKTtnn36z/6h9/H5Fj5R2ktI1qZXhabLlmSfxkrkmAfGrFyxGQ52gB0weCpm3guIsYGA+Ld14Ha8BytZmaSlnmhX1IKNADD01WT+vWhbZ6j7Da6+teGszBdXsHKMSg6+v4XBjExB2fSRP1Xa7a3AGFkuC4obwVI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565968704; 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:ARC-Authentication-Results; bh=/T0oxA1XKIqizsvEclmY7gHXZ7iwbPg0bL9vg8YKhXE=; b=A/PEEkoXLb/TZQUQ+6qbwCDWXFpzGAS+5i8609Oz0G8tXKz9SoxazjEu6sxbz/805dmZjc0tS8fwa0jsBqOA0S6x1guDE3KQBwWksmBnpInWlmr2dMPXcnIXhnivcheo6esbsHAB2wZdw6cYm0Pg7myC2TzGtwpxxFF7pH3E7VY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565968704139223.92866933381765; Fri, 16 Aug 2019 08:18:24 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id D5F052CD811; Fri, 16 Aug 2019 15:18:22 +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 9250C95A4D; Fri, 16 Aug 2019 15:18:22 +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 CB90C24F2F; Fri, 16 Aug 2019 15:18:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7GFIIOe032437 for ; Fri, 16 Aug 2019 11:18:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 06D1F17AD8; Fri, 16 Aug 2019 15:18:18 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8673917AA7 for ; Fri, 16 Aug 2019 15:18:14 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 16 Aug 2019 17:18:14 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: alias: Generate 'qomName' of disk with useraliases 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 16 Aug 2019 15:18:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Commit fb64e176f4f forgot to delete the check that short-circuits the disk alias creation if the alias is already present. The side efect of this is that the creation qomName which is necessary to be able to refer to disk frontends when -blockdev is used was skipped when user aliases are used. Fix it by deleting the check. Also prevent any potential memory leaks from calling this function repeatedly by creating the qomName only when it's not present. https://bugzilla.redhat.com/show_bug.cgi?id=3D1741838 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_alias.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_alias.c b/src/qemu/qemu_alias.c index 585cc972ba..216a18d0d9 100644 --- a/src/qemu/qemu_alias.c +++ b/src/qemu/qemu_alias.c @@ -182,9 +182,6 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr def, const char *prefix =3D virDomainDiskBusTypeToString(disk->bus); int controllerModel =3D -1; - if (disk->info.alias) - return 0; - if (!disk->info.alias) { if (disk->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SCSI) { @@ -220,7 +217,8 @@ qemuAssignDeviceDiskAlias(virDomainDefPtr def, * on the alias in qemu. While certain disk types use just the alias, = some * need the full path into /machine/peripheral as a historical artifac= t. */ - if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { + if (!diskPriv->qomName && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV)) { switch ((virDomainDiskBus) disk->bus) { case VIR_DOMAIN_DISK_BUS_FDC: case VIR_DOMAIN_DISK_BUS_IDE: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list