From nobody Mon Apr 29 07:09:17 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=1556286753; cv=none; d=zoho.com; s=zohoarc; b=HSSDp1B2TCulDipmTNthomk/7wvIksPaq8DFizGVCPzOoV0bwWA2XgvV/swoi/y78ComaNdaQhbUc7as9l1faGC8+VDxIcbP9qUme3t3N4ioKZN7JWrVOolCKFuHRS6j7v8v/T5DqxS7ZJZcr1pGZcauZkwbFsQw4hKO1vGXfyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556286753; h=Content-Type:Content-Transfer-Encoding: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:ARC-Authentication-Results; bh=nil6f6DdG70uy9rjCP6dEHi8D385dOM9JYojsm8VelY=; b=lXliLbx37PI+6JvCbLBrAYu+T5mIePlpwbjLMMtnef3eAkSK/bKLNKLwOYIorADVRtL1Mh7eK27kxO/8WCImwBuiXIo3zNJIU+SMBsrdHh+Wiwyrw5xXKrq407UmBK5BwsfjhpHwyiWGQ/m2B9uSbDU9N94OAn2GmTHPa2wfwmw= 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 1556286753704195.72156387883786; Fri, 26 Apr 2019 06:52:33 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 5A41E308A9E1; Fri, 26 Apr 2019 13:52:32 +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 2D3B617CDF; Fri, 26 Apr 2019 13:52:32 +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 BA58F181B9E0; Fri, 26 Apr 2019 13:52:31 +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 x3QDqSgT025273 for ; Fri, 26 Apr 2019 09:52:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42E3260BF3; Fri, 26 Apr 2019 13:52:28 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0B1860CCD for ; Fri, 26 Apr 2019 13:52:27 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 26 Apr 2019 15:52:20 +0200 Message-Id: <08193fdbf543e4034413f3757c2eac81ce05d53d.1556286706.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/4] src: Check for virDomainDiskInsert() retval properly 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 26 Apr 2019 13:52:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Our coding style specifies that only negative values are considered as error. Check for return value of virDomainDiskInsert() properly, following the style. Not that the function can now return anything other than 0 or -1, but it just triggers my OCD. Signed-off-by: Michal Privoznik --- src/libxl/libxl_driver.c | 2 +- src/lxc/lxc_driver.c | 2 +- src/qemu/qemu_driver.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 42221cb925..e7234c1479 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3517,7 +3517,7 @@ libxlDomainAttachDeviceConfig(virDomainDefPtr vmdef, = virDomainDeviceDefPtr dev) _("target %s already exists."), disk->dst); return -1; } - if (virDomainDiskInsert(vmdef, disk)) + if (virDomainDiskInsert(vmdef, disk) < 0) return -1; /* vmdef has the pointer. Generic codes for vmdef will do all = jobs */ dev->data.disk =3D NULL; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 37002dbf23..fbdd33156a 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -3417,7 +3417,7 @@ lxcDomainAttachDeviceConfig(virDomainDefPtr vmdef, _("target %s already exists."), disk->dst); return -1; } - if (virDomainDiskInsert(vmdef, disk)) + if (virDomainDiskInsert(vmdef, disk) < 0) return -1; /* vmdef has the pointer. Generic codes for vmdef will do all jobs= */ dev->data.disk =3D NULL; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f48d9256e4..30fc335883 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8144,7 +8144,7 @@ qemuDomainAttachDeviceConfig(virDomainDefPtr vmdef, return -1; if (qemuCheckDiskConfig(disk, NULL) < 0) return -1; - if (virDomainDiskInsert(vmdef, disk)) + if (virDomainDiskInsert(vmdef, disk) < 0) return -1; /* vmdef has the pointer. Generic codes for vmdef will do all jobs= */ dev->data.disk =3D NULL; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:09:17 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=1556286761; cv=none; d=zoho.com; s=zohoarc; b=fbcM1Wx19tdx6jKN8NNSiYSO93oNrIduKLcR57y3baX1QBIWEfSIyaJ2WuL224iu1PY17b9dv6TxnD6Z9I19VdwdmDLA+IWLEsv1SpGcphKuuohsNtnHKMrKu7hhEUCud6brjC9FQMZyiJuxG5fnuNt6VBpj9B8ap18G0qgFs0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556286761; h=Content-Type:Content-Transfer-Encoding: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:ARC-Authentication-Results; bh=DZ3uEOzKgtAuKMgZ3bLfPUAR218GsokmzWKdn5M65MI=; b=bVTVbJ7uv8RjeoKfJe1g5n2gay3wrgfmkDtU5UNkXaEk4h6rLu5oIFMuuAGvVfgU76IAo5Ip4wEZI4ks0EKgfOcS3qNSl+vUYgO4JfT9KpHY2r/h0L+KTtJdTGKZYhoH0tYWw1hfWJSCiEi5EWvczP7EACI49QkBnTIhKoUBEQM= 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 1556286761872868.2496758692207; Fri, 26 Apr 2019 06:52:41 -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 C73F630BCE59; Fri, 26 Apr 2019 13:52:40 +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 A0DD360FD0; Fri, 26 Apr 2019 13:52:40 +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 6229C181B9FA; Fri, 26 Apr 2019 13:52: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 x3QDqTCw025286 for ; Fri, 26 Apr 2019 09:52:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 122F460BF3; Fri, 26 Apr 2019 13:52:29 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8FBAF60FCD for ; Fri, 26 Apr 2019 13:52:28 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 26 Apr 2019 15:52:21 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] qemuDomainAttachDeviceLiveAndConfig: Don't overwrite @ret 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.43]); Fri, 26 Apr 2019 13:52:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If we're attaching a device to both inactive and live XML then @ret is overwritten which may result in incorrect return value. For instance, if attaching to inactive XML succeeds, @ret is assigned value of zero and control proceeds to attaching the device to live XML. Here, if say virDomainDeviceValidateAliasForHotplug() fails the control jumps over to 'cleanup' label and zero is returned indicating success. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 30fc335883..2b2d531441 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8652,9 +8652,9 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr v= m, false) < 0) goto cleanup; =20 - if ((ret =3D qemuDomainAttachDeviceConfig(vmdef, devConf, caps, - parse_flags, - driver->xmlopt)) < 0) + if (qemuDomainAttachDeviceConfig(vmdef, devConf, caps, + parse_flags, + driver->xmlopt) < 0) goto cleanup; } =20 @@ -8671,28 +8671,27 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr= vm, true) < 0) goto cleanup; =20 - if ((ret =3D qemuDomainAttachDeviceLive(vm, devLive, driver)) < 0) + if (qemuDomainAttachDeviceLive(vm, devLive, driver) < 0) goto cleanup; /* * update domain status forcibly because the domain status may be * changed even if we failed to attach the device. For example, * a new controller may be created. */ - if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver-= >caps) < 0) { - ret =3D -1; + if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver-= >caps) < 0) goto cleanup; - } } =20 /* Finally, if no error until here, we can save config. */ if (flags & VIR_DOMAIN_AFFECT_CONFIG) { - ret =3D virDomainSaveConfig(cfg->configDir, driver->caps, vmdef); - if (!ret) { - virDomainObjAssignDef(vm, vmdef, false, NULL); - vmdef =3D NULL; - } + if (virDomainSaveConfig(cfg->configDir, driver->caps, vmdef) < 0) + goto cleanup; + + virDomainObjAssignDef(vm, vmdef, false, NULL); + vmdef =3D NULL; } =20 + ret =3D 0; cleanup: virDomainDefFree(vmdef); virDomainDeviceDefFree(devConf); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:09:17 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=1556286765; cv=none; d=zoho.com; s=zohoarc; b=JW0tz2ft+Qtfu6gij/gXhkwPdHUGBpRBiUb1vJE3nTLZb0fpoHpnJaP57vR1QIZwZyxuE1GU8Cw+wMttAqKzgsA+pOSxiD7UNnsHb94KbDZm2FvZTj3/NF3202FJgFGgDxjD9Zlg47NhfCJtWI3E2geHSyKqBQwjbRG9A4sHGEU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556286765; h=Content-Type:Content-Transfer-Encoding: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:ARC-Authentication-Results; bh=QYEusj5tiaqO6BsELPAtVLOwWEnmJkNUzWvBAcrp6OM=; b=hMJI7Om/hejvzt+UPv8ucXhtqlbZ8eCGyvM4T29TlzXfF9QHw+KE8vayLntku1nHWiGV+6GL25h947YrBaFSp8bobP0cQpfsxFak9q0MOL7pYMlYDyGxJQ/LaJlnunAtw5+EmZwQAJx5sBwPVE4MhPnKkQRd3N4WCqnA8Zs48nc= 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 1556286765688346.3321350289867; Fri, 26 Apr 2019 06:52:45 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 2626681DFE; Fri, 26 Apr 2019 13:52:44 +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 00C745DEC7; Fri, 26 Apr 2019 13:52: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 B82FF181B9FF; Fri, 26 Apr 2019 13:52:43 +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 x3QDqTgZ025303 for ; Fri, 26 Apr 2019 09:52:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id D5AA260CCD; Fri, 26 Apr 2019 13:52:29 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EEA560BF3 for ; Fri, 26 Apr 2019 13:52:29 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 26 Apr 2019 15:52:22 +0200 Message-Id: <57eb2936f34b789703ff610a31ac7467d588b85b.1556286706.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/4] qemu: On attach to live XML check for user alias collision only live XML 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 26 Apr 2019 13:52:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When attaching a device to live XML we don't care (well, shouldn't care) that there's already a device in inactive XML that has the same user alias. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2b2d531441..40fd8b9d2d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8663,7 +8663,8 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr v= m, driver->xmlopt, parse_flag= s))) goto cleanup; =20 - if (virDomainDeviceValidateAliasForHotplug(vm, devLive, flags) < 0) + if (virDomainDeviceValidateAliasForHotplug(vm, devLive, + VIR_DOMAIN_AFFECT_LIVE)= < 0) goto cleanup; =20 if (virDomainDefCompatibleDevice(vm->def, devLive, NULL, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 07:09:17 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=1556286768; cv=none; d=zoho.com; s=zohoarc; b=Ug89y36iuF2Tl/woDp8e9P51GAkvJhl+5uM2pYRBTmGxvlZMrRtnZ+MWvx7qfJuiXrX5nw/zM+DgqDY1XQk8iB8dkw2TjZzBwwtwe/zio0VJw5XCJdCh2t3GkhE3FYbNU490BPCSoYsWkbA0yRlQx+Y6uB11vQvHpnkA4SKaZxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556286768; h=Content-Type:Content-Transfer-Encoding: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:ARC-Authentication-Results; bh=jJtiLl5rBHD+j1yy45YFd9S8PixIAHAVDwMchLy1jaA=; b=NcjO6J0NzQPNdqBeZf+qbXdVW4vB3L8ZDqh+kJCSx4++wsLvMHCkcapeRrWySxAKPO28lD6Yu1GL8uLzGdYWiEiiJ70n8hJVyNZuFqncDm7BqsOU/vFz0GYwVaEg6oozNg3Sq3GopvTAnb/cdU1ST7O5YweZ+gRtpeKIc3Y/cvc= 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 1556286768732275.7378686567297; Fri, 26 Apr 2019 06:52:48 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 72E7F7DCE0; Fri, 26 Apr 2019 13:52:47 +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 430295D71A; Fri, 26 Apr 2019 13:52:47 +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 EF8E4181BA05; Fri, 26 Apr 2019 13:52:46 +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 x3QDqURP025312 for ; Fri, 26 Apr 2019 09:52:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id A7D2E60E3D; Fri, 26 Apr 2019 13:52:30 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EE4B60BF3 for ; Fri, 26 Apr 2019 13:52:30 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Fri, 26 Apr 2019 15:52:23 +0200 Message-Id: <572c50849c649c3d7586df01a3a0069b6d1a32af.1556286706.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] qemu: Check for user alias collisions in coldplug 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 26 Apr 2019 13:52:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" https://bugzilla.redhat.com/show_bug.cgi?id=3D1697676 If an user tries to attach a device with colliding user alias then we attach it happily and thus leave domain unable to start. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 40fd8b9d2d..c072bed1ce 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8647,6 +8647,10 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr = vm, driver->xmlopt, parse_flag= s))) goto cleanup; =20 + if (virDomainDeviceValidateAliasForHotplug(vm, devConf, + VIR_DOMAIN_AFFECT_CONFI= G) < 0) + goto cleanup; + if (virDomainDefCompatibleDevice(vmdef, devConf, NULL, VIR_DOMAIN_DEVICE_ACTION_ATTACH, false) < 0) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list