From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404966; cv=none; d=zohomail.com; s=zohoarc; b=kKTchOz1bT4qDc6KFPtG1aXYY8/6UyAZ5R69o+X3qozHgDDh4ybQKgr2lFyshxFKA28oGh50bNjQBN357QAoBcMTDXLZoOqX4tNAulZBaEUTbeALnmJ0PvnqG4PYucudWEvhd9c6J2QrR4FeM32RXoQPo8Bor/ht6xqodIm32dQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404966; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=7Nkudo/lmPTdnPIYCsSxGy1PNNxhtn+oeDosnFV4GA4=; b=Lf/daz0d8xWNnsz10JYGJs+VCOAVqqPaHwi1nFV7JU7td3NZgo8T7XGpt+G41ZRI6lJdrzrkZWV2ItQ6ldfV2GmB5fRml1TmxLH/CjlmN9+61T/GKaLPkx995m6ph5zM9CUuOQWkxLD3hBIJGrKDDFzRXn9PpJVMIh3E1Q4ykC4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1604404966897168.337952064541; Tue, 3 Nov 2020 04:02:46 -0800 (PST) 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-115-puhYsLN8OQ-x0qhktLENZg-1; Tue, 03 Nov 2020 07:01:11 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 180441099F6C; Tue, 3 Nov 2020 12:01:03 +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 DFB815D9CC; Tue, 3 Nov 2020 12:01:02 +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 6E78A8C7C7; Tue, 3 Nov 2020 12:01:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A3C10u4011415 for ; Tue, 3 Nov 2020 07:01:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id BCA652156720; Tue, 3 Nov 2020 12:01:00 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B84DC2156708 for ; Tue, 3 Nov 2020 12:00:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (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 6BD661021F7F for ; Tue, 3 Nov 2020 12:00:58 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-109-1usg3sBvMkO1gmC1c8OK9g-1; Tue, 03 Nov 2020 07:00:55 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZuzI-007EMR-AW for libvir-list@redhat.com; Tue, 03 Nov 2020 15:00:32 +0300 X-MC-Unique: puhYsLN8OQ-x0qhktLENZg-1 X-MC-Unique: 1usg3sBvMkO1gmC1c8OK9g-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 01/10] qemu: qemuDomainRenameCallback: fix sending false undefined event Date: Tue, 3 Nov 2020 14:59:59 +0300 Message-Id: <1604404808-825155-2-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" For example if saving config file with new name fails we send false undefine event currently. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index cb56fbb..2f2a55f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19152,10 +19152,6 @@ qemuDomainRenameCallback(virDomainObjPtr vm, } } =20 - event_old =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_UNDEFINED, - VIR_DOMAIN_EVENT_UNDEFINED_REN= AMED); - /* Switch name in domain definition. */ old_dom_name =3D vm->def->name; vm->def->name =3D new_dom_name; @@ -19182,6 +19178,9 @@ qemuDomainRenameCallback(virDomainObjPtr vm, } } =20 + event_old =3D virDomainEventLifecycleNew(vm->def->id, old_dom_name, vm= ->def->uuid, + VIR_DOMAIN_EVENT_UNDEFINED, + VIR_DOMAIN_EVENT_UNDEFINED_RENA= MED); event_new =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, VIR_DOMAIN_EVENT_DEFINED_REN= AMED); --=20 1.8.3.1 From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404884; cv=none; d=zohomail.com; s=zohoarc; b=SGxqDXZZviExXhHMjFa5DV4GEE44nYXKDAHLNgQcxl8ew4kO34Dzb9BpebFQz3REX44/pMulZCjP/BfT/8Y1RclrFxWCli70+LCQ/V1TD8+XZCkTA3rk04LmGtsvvjjCQ6lG8Tdp/30F3bW3l3dANtDt6ZHBjcPX7hTm+RZo40Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404884; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Ps38amW5RKLEFszhoNWSfsYljkwn9OzJX8EKAbzUO6g=; b=YcPVFo58Ym9uxuLuws3oE1GvcJUKyVAwWyNNZTrixmUej0bcSe9ouTq1Q8fFJlooSsnhLIXR+BDVSIu0bI70EGaLZQx9CfL/fJBBW2YL9jYmi7of/rz6whuQKy0SsuBe3RSVzP+3I4OTrkZId0cfUKtbsoM43lYnobDThEvnyWw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 160440488424359.56764447534454; Tue, 3 Nov 2020 04:01:24 -0800 (PST) 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-245-flVATyGrO-WbpsCUTBlE1A-1; Tue, 03 Nov 2020 07:01:19 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A14C876ECF; Tue, 3 Nov 2020 12:01:13 +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 175FC261A0; Tue, 3 Nov 2020 12:01:13 +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 D18D68C7AE; Tue, 3 Nov 2020 12:01:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A3C1AFW011455 for ; Tue, 3 Nov 2020 07:01:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id D1BA7215671F; Tue, 3 Nov 2020 12:01:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD5032156708 for ; Tue, 3 Nov 2020 12:01:10 +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 AB0C386CB95 for ; Tue, 3 Nov 2020 12:01:10 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-258-cKzIM5ddM0G6WIFFlNSgIg-1; Tue, 03 Nov 2020 07:01:06 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZuzU-007EMR-77 for libvir-list@redhat.com; Tue, 03 Nov 2020 15:00:44 +0300 X-MC-Unique: flVATyGrO-WbpsCUTBlE1A-1 X-MC-Unique: cKzIM5ddM0G6WIFFlNSgIg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 02/10] qemu: rename: send events only on success Date: Tue, 3 Nov 2020 15:00:00 +0300 Message-Id: <1604404808-825155-3-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We can simplify cleanup section by moving sending events to success path on= ly because only on sucess path events are not NULL. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2f2a55f..22df0f6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19184,11 +19184,11 @@ qemuDomainRenameCallback(virDomainObjPtr vm, event_new =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, VIR_DOMAIN_EVENT_DEFINED_REN= AMED); + virObjectEventStateQueue(driver->domainEventState, event_old); + virObjectEventStateQueue(driver->domainEventState, event_new); ret =3D 0; =20 cleanup: - virObjectEventStateQueue(driver->domainEventState, event_old); - virObjectEventStateQueue(driver->domainEventState, event_new); return ret; =20 rollback: --=20 1.8.3.1 From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404897; cv=none; d=zohomail.com; s=zohoarc; b=iUFDRTu1aimpQJB8YZYxt2zpW5CD4synSIFnbvCXZcvk18uTXnuy0QvW6s7Y7kQCzRZ2sQkgP7CdzR5Jt9STqfEgm2SUtvu31qSuCmCLxcPDcUmrcJo4NHVc1nTDNToph5OfTqUD2d3v7mYDr6lGgIwH7zvJySsXuMgwTrrQlh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404897; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=XjQRzp9pp+kjPkXYc1jXuTXm0SqmiKULMrtyFmwsDA0=; b=AL9kvrtiyDzxMnXWIFimX8m+qPF/YiY8P6TyeU9B7gbKLazJPf9G9Vsr3yqkxcqMVkuhN9vGF7Tj/hjwWx5m5h6/cxxiEz6RtoakWD7gGS+LgZP/npytOe7vxkKADkT+J8Zoah/V6VHIDM07hVPLV2vrGZy1BFAe4VuFFjBUZKg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604404897471200.18904160867692; Tue, 3 Nov 2020 04:01:37 -0800 (PST) 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-168-sfC13MN5MkaBjNM-je19Cw-1; Tue, 03 Nov 2020 07:01:31 -0500 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 0C0F88015FB; Tue, 3 Nov 2020 12:01:26 +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 DBFE35576E; Tue, 3 Nov 2020 12:01:25 +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 A6339181A050; Tue, 3 Nov 2020 12:01:25 +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 0A3C1Orq011530 for ; Tue, 3 Nov 2020 07:01:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 73B63201C0DC; Tue, 3 Nov 2020 12:01:24 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6EC79202348E for ; Tue, 3 Nov 2020 12:01:21 +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 2458D185A7A2 for ; Tue, 3 Nov 2020 12:01:21 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-322-bq6199dhPXuM0rH4a9pfqA-1; Tue, 03 Nov 2020 07:01:18 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZuzg-007EMR-8R for libvir-list@redhat.com; Tue, 03 Nov 2020 15:00:56 +0300 X-MC-Unique: sfC13MN5MkaBjNM-je19Cw-1 X-MC-Unique: bq6199dhPXuM0rH4a9pfqA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 03/10] qemu: rename: return instead of goto if no cleanup required Date: Tue, 3 Nov 2020 15:00:01 +0300 Message-Id: <1604404808-825155-4-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Going to cleanup label is mere return -1 thus let's just return instead of goto to this label. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 22df0f6..621facc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19135,20 +19135,20 @@ qemuDomainRenameCallback(virDomainObjPtr vm, new_dom_name)) || !(old_dom_cfg_file =3D virDomainConfigFile(cfg->configDir, vm->def->name))) - goto cleanup; + return -1; =20 if (vm->autostart) { if (!(new_dom_autostart_link =3D virDomainConfigFile(cfg->autostar= tDir, new_dom_name)) || !(old_dom_autostart_link =3D virDomainConfigFile(cfg->autostar= tDir, vm->def->name))) - goto cleanup; + return -1; =20 if (symlink(new_dom_cfg_file, new_dom_autostart_link) < 0) { virReportSystemError(errno, _("Failed to create symlink '%s to '%s'"), new_dom_autostart_link, new_dom_cfg_file); - goto cleanup; + return -1; } } =20 --=20 1.8.3.1 From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404908; cv=none; d=zohomail.com; s=zohoarc; b=lXyniVGmDK0TIiUN2ruhmtA5xGgXH8uM0/Salh3WWC4hcTV9tT89NeaLwCYzqXPh+c2wddK/bZJcmW1JWHK5kBy2i4xU2tnTEkMp5s17lEXL/BctTJ8wlx8HsH/XLU17mEgOBx0hsCYXsxinydjuMe3KP3S5fyehpyc0FzjSANE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404908; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=mE2ob7ygtuHdx9TXp15nhVrB4pb/3GmUF5WF0YHdLfs=; b=DU1hPpkq4fpyi6PUAnm1kVEd9dhndit3jvUma2t0KI8SZKJ0f5iMVBI8ibl7j2w9N/kSCwxw7E4GtGKG7kE7Xzut3a4fC1K9PUn3/GGnfleGgDbBmJ+DnQWxb8cu+ygYcMr4yCgt4cb519UwogaU/wtEFihYjz3wnCIeCwWup7s= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604404908770178.44729218626253; Tue, 3 Nov 2020 04:01:48 -0800 (PST) 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-536-ddpbtoCrPp-4fjkWEmw1NQ-1; Tue, 03 Nov 2020 07:01:43 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E75BF10A0B81; Tue, 3 Nov 2020 12:01:37 +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 C3B8C1002D48; Tue, 3 Nov 2020 12:01:37 +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 8B87C181A06C; Tue, 3 Nov 2020 12:01:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A3C1ZXh011594 for ; Tue, 3 Nov 2020 07:01:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 991F7110E9B8; Tue, 3 Nov 2020 12:01:35 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9559C110E9B6 for ; Tue, 3 Nov 2020 12:01:33 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 41E00185A78B for ; Tue, 3 Nov 2020 12:01:33 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-RzMrQYa0NRaDoCa28ZAYqQ-1; Tue, 03 Nov 2020 07:01:30 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZuzs-007EMR-0t for libvir-list@redhat.com; Tue, 03 Nov 2020 15:01:08 +0300 X-MC-Unique: ddpbtoCrPp-4fjkWEmw1NQ-1 X-MC-Unique: RzMrQYa0NRaDoCa28ZAYqQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 04/10] qemu: remove duplicate code for removing remnant files Date: Tue, 3 Nov 2020 15:00:02 +0300 Message-Id: <1604404808-825155-5-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch also changes functionality a bit. First if unlinking of old config file is failed we rollback and return error previously and now we return success. I don't think this makes much differe= nce. I guess in both cases on libvirtd restart we have to deal with both new and= old config existing on disk with different names but same uuid. Second if unlinking of old autolink is failed we rollback previously which was not right as at this point we already unlink old config file. So this is fixed now. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 29 +++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 5 +++++ src/qemu/qemu_driver.c | 39 ++++++++------------------------------- 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d7dbca4..7b2c165 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11094,3 +11094,32 @@ qemuDomainInterfaceSetDefaultQDisc(virQEMUDriverPt= r driver, =20 return 0; } + + +int +qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr cfg, + const char *name, + bool bestEffort) +{ + g_autofree char *cfg_file =3D NULL; + g_autofree char *autostart_link =3D NULL; + + cfg_file =3D virDomainConfigFile(cfg->configDir, name); + autostart_link =3D virDomainConfigFile(cfg->autostartDir, name); + + if (virFileExists(cfg_file) && + unlink(cfg_file) < 0) { + virReportSystemError(errno, _("Failed to unlink '%s'"), cfg_file); + if (!bestEffort) + return -1; + } + + if (virFileIsLink(autostart_link) =3D=3D 1 && + unlink(autostart_link) < 0) { + virReportSystemError(errno, _("Failed to unlink '%s'"), autostart_= link); + if (!bestEffort) + return -1; + } + + return 0; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index fc69678..a2dfe86 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1050,3 +1050,8 @@ qemuDomainFileWrapperFDClose(virDomainObjPtr vm, int qemuDomainInterfaceSetDefaultQDisc(virQEMUDriverPtr driver, virDomainNetDefPtr net); + +int +qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr cfg, + const char *name, + bool bestEffort); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 621facc..52c42cf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19112,6 +19112,7 @@ qemuDomainRenameCallback(virDomainObjPtr vm, virObjectEventPtr event_new =3D NULL; virObjectEventPtr event_old =3D NULL; int ret =3D -1; + virErrorPtr err =3D NULL; g_autofree char *new_dom_name =3D NULL; g_autofree char *old_dom_name =3D NULL; g_autofree char *new_dom_cfg_file =3D NULL; @@ -19158,25 +19159,7 @@ qemuDomainRenameCallback(virDomainObjPtr vm, new_dom_name =3D NULL; =20 if (virDomainDefSave(vm->def, driver->xmlopt, cfg->configDir) < 0) - goto rollback; - - if (virFileExists(old_dom_cfg_file) && - unlink(old_dom_cfg_file) < 0) { - virReportSystemError(errno, - _("cannot remove old domain config file %s"), - old_dom_cfg_file); - goto rollback; - } - - if (vm->autostart) { - if (virFileIsLink(old_dom_autostart_link) && - unlink(old_dom_autostart_link) < 0) { - virReportSystemError(errno, - _("Failed to delete symlink '%s'"), - old_dom_autostart_link); - goto rollback; - } - } + goto cleanup; =20 event_old =3D virDomainEventLifecycleNew(vm->def->id, old_dom_name, vm= ->def->uuid, VIR_DOMAIN_EVENT_UNDEFINED, @@ -19189,23 +19172,17 @@ qemuDomainRenameCallback(virDomainObjPtr vm, ret =3D 0; =20 cleanup: - return ret; - - rollback: - if (old_dom_name) { + if (old_dom_name && ret < 0) { new_dom_name =3D vm->def->name; vm->def->name =3D old_dom_name; old_dom_name =3D NULL; } =20 - if (virFileExists(new_dom_cfg_file)) - unlink(new_dom_cfg_file); - - if (vm->autostart && - virFileExists(new_dom_autostart_link)) - unlink(new_dom_autostart_link); - - goto cleanup; + if (ret < 0) + virErrorPreserveLast(&err); + qemuDomainNamePathsCleanup(cfg, ret < 0 ? new_dom_name : old_dom_name,= true); + virErrorRestore(&err); + return ret; } =20 static int qemuDomainRename(virDomainPtr dom, --=20 1.8.3.1 From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404920; cv=none; d=zohomail.com; s=zohoarc; b=McNWX1ugErTjdW37MY2zrxHpLk31MkNouwfYCXaThWf8DSgkpDygDd0CyCEQoNCrYI+QM9RqjOWMdMkQG3tx38r7LPmd3XzMeat+x8ePLEv0EGyq7pw98cK0/qZ8LhqtEgRQY9OKHS5V5n2kC+aFAeeQbRD7XEzoPdHIPh65zTQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404920; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=+Vrnio3KpIloe/npqO0bJiichRxwExgQdMLXN6eAuy0=; b=SJPWP3qlLJmHNaA2uZLUjJ+pbtrY2Krd+fbvpnWN3Oz3S6FWjYf7c/4l9bw1T/F0I7WO68e4DkdDyWJEGzuH4VfGcGdncI+OU8edOp2W+7t4hbK2soer2m3OLXKIaJCRUj6fN0VR6+sYXal/BI2lNatVmAqwSHuiIEINLcQnCbQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604404920593286.43275082449907; Tue, 3 Nov 2020 04:02:00 -0800 (PST) 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-398-yAAa-8O1OjSHMujMkv12jQ-1; Tue, 03 Nov 2020 07:01:53 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id E2C6A802B69; Tue, 3 Nov 2020 12:01: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 BE8805C629; Tue, 3 Nov 2020 12:01: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 89D63181A06E; Tue, 3 Nov 2020 12:01:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A3C1jE8011635 for ; Tue, 3 Nov 2020 07:01:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id C138C110E9B6; Tue, 3 Nov 2020 12:01:45 +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 BD1C0110E9B5 for ; Tue, 3 Nov 2020 12:01:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 9730490E42E for ; Tue, 3 Nov 2020 12:01:45 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-82-gfNLTqCrMk-AkdioByULpw-1; Tue, 03 Nov 2020 07:01:42 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZv03-007EMR-R7 for libvir-list@redhat.com; Tue, 03 Nov 2020 15:01:19 +0300 X-MC-Unique: yAAa-8O1OjSHMujMkv12jQ-1 X-MC-Unique: gfNLTqCrMk-AkdioByULpw-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 05/10] qemu: rename: support renaming snapshots directory Date: Tue, 3 Nov 2020 15:00:03 +0300 Message-Id: <1604404808-825155-6-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This is basically just saves snapshots metadata on disk after name is chang= ed in memory as path to domain snapshot directory depends on name. After that old snapshot directory is deleted with snapshot metadata files. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_domain.c | 7 +++++++ src/qemu/qemu_driver.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7b2c165..258c8c5 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11103,9 +11103,11 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr = cfg, { g_autofree char *cfg_file =3D NULL; g_autofree char *autostart_link =3D NULL; + g_autofree char *snap_dir =3D NULL; =20 cfg_file =3D virDomainConfigFile(cfg->configDir, name); autostart_link =3D virDomainConfigFile(cfg->autostartDir, name); + snap_dir =3D g_strdup_printf("%s/%s", cfg->snapshotDir, name); =20 if (virFileExists(cfg_file) && unlink(cfg_file) < 0) { @@ -11121,5 +11123,10 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr = cfg, return -1; } =20 + if (virFileIsDir(snap_dir) && + virFileDeleteTree(snap_dir) < 0 && + !bestEffort) + return -1; + return 0; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 52c42cf..2664603 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19101,6 +19101,30 @@ qemuDomainSetUserPassword(virDomainPtr dom, } =20 =20 +struct qemuDomainMomentWriteMetadataData { + virQEMUDriverPtr driver; + virDomainObjPtr vm; +}; + + +static int +qemuDomainSnapshotWriteMetadataIter(void *payload, + const char *name G_GNUC_UNUSED, + void *opaque) +{ + struct qemuDomainMomentWriteMetadataData *data =3D opaque; + virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(data->driver); + int ret; + + ret =3D qemuDomainSnapshotWriteMetadata(data->vm, payload, + data->driver->xmlopt, + cfg->snapshotDir); + + virObjectUnref(cfg); + return ret; +} + + static int qemuDomainRenameCallback(virDomainObjPtr vm, const char *new_name, @@ -19119,6 +19143,10 @@ qemuDomainRenameCallback(virDomainObjPtr vm, g_autofree char *old_dom_cfg_file =3D NULL; g_autofree char *new_dom_autostart_link =3D NULL; g_autofree char *old_dom_autostart_link =3D NULL; + struct qemuDomainMomentWriteMetadataData data =3D { + .driver =3D driver, + .vm =3D vm, + }; =20 virCheckFlags(0, ret); =20 @@ -19158,6 +19186,11 @@ qemuDomainRenameCallback(virDomainObjPtr vm, vm->def->name =3D new_dom_name; new_dom_name =3D NULL; =20 + if (virDomainSnapshotForEach(vm->snapshots, + qemuDomainSnapshotWriteMetadataIter, + &data) < 0) + goto cleanup; + if (virDomainDefSave(vm->def, driver->xmlopt, cfg->configDir) < 0) goto cleanup; =20 --=20 1.8.3.1 From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404934; cv=none; d=zohomail.com; s=zohoarc; b=VYtmy4Kd6oGyDu8ABYYj3CJpzch5r7Ltcnqmbr+/p02AeMIeQ7DpCLDEuizyU+TlJqNmibAlknmi4arBAMKwaLGlahhVXzbbOdF+ldZg19r1wrW2NIGUgxvwbIvDmTYGBEngQjO/d6VLLacbodbVe3UuvHoTxDd03QfA1ZehE4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404934; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=YMMuu4QeCwKDaHQ0LnB6jPSXJb8xnuLFsAHz4ywdfUw=; b=k1cSHprnHvPvto+i0f5q3eG5D//zlUwKXL42sbNdpLijdcD//vOzvG5j0hlzTcLRm8L9p++veJRkGsGoaVV+DpMEuRr101I03uq6fYtBvDpeg66NaU+I9/sTF/4R6dJUg+UJHUIT/rK+jnUi7L0f6IUOA2DpGslAuUkiDdO6a4U= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1604404934359789.1438951941011; Tue, 3 Nov 2020 04:02:14 -0800 (PST) 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-3-cbe8H7VKOfq-9B19EMnQtg-1; Tue, 03 Nov 2020 07:02:08 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C25441868412; Tue, 3 Nov 2020 12:02:02 +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 95A121002D49; Tue, 3 Nov 2020 12:02:02 +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 5C7C0181A06B; Tue, 3 Nov 2020 12:02:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A3C21AP011717 for ; Tue, 3 Nov 2020 07:02:01 -0500 Received: by smtp.corp.redhat.com (Postfix) id 221C721568B0; Tue, 3 Nov 2020 12:02:01 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1CD3A215688E for ; Tue, 3 Nov 2020 12:01:56 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (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 838D1803531 for ; Tue, 3 Nov 2020 12:01:56 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162--TN7hLLrNOuQIj0EuA35eg-1; Tue, 03 Nov 2020 07:01:54 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZv0F-007EMR-LE for libvir-list@redhat.com; Tue, 03 Nov 2020 15:01:31 +0300 X-MC-Unique: cbe8H7VKOfq-9B19EMnQtg-1 X-MC-Unique: -TN7hLLrNOuQIj0EuA35eg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 06/10] qemu: rename: support renaming checkpoints directory Date: Tue, 3 Nov 2020 15:00:04 +0300 Message-Id: <1604404808-825155-7-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This is basically just saves checkpoints metadata on disk after name is cha= nged in memory as path to domain checkpoints directory depends on name. After th= at old checkpoint directory is deleted with checkpoint metadata files. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_checkpoint.c | 2 +- src/qemu/qemu_checkpoint.h | 6 ++++++ src/qemu/qemu_domain.c | 7 +++++++ src/qemu/qemu_driver.c | 23 +++++++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index fb76c21..4a496d5 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -76,7 +76,7 @@ qemuCheckpointObjFromCheckpoint(virDomainObjPtr vm, } =20 =20 -static int +int qemuCheckpointWriteMetadata(virDomainObjPtr vm, virDomainMomentObjPtr checkpoint, virDomainXMLOptionPtr xmlopt, diff --git a/src/qemu/qemu_checkpoint.h b/src/qemu/qemu_checkpoint.h index 0d267a1..d58657e 100644 --- a/src/qemu/qemu_checkpoint.h +++ b/src/qemu/qemu_checkpoint.h @@ -79,3 +79,9 @@ qemuCheckpointDiscardDiskBitmaps(virStorageSourcePtr src, virJSONValuePtr actions, const char *diskdst, GSList **reopenimages); + +int +qemuCheckpointWriteMetadata(virDomainObjPtr vm, + virDomainMomentObjPtr checkpoint, + virDomainXMLOptionPtr xmlopt, + const char *checkpointDir); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 258c8c5..422b534 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11104,10 +11104,12 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr= cfg, g_autofree char *cfg_file =3D NULL; g_autofree char *autostart_link =3D NULL; g_autofree char *snap_dir =3D NULL; + g_autofree char *chk_dir =3D NULL; =20 cfg_file =3D virDomainConfigFile(cfg->configDir, name); autostart_link =3D virDomainConfigFile(cfg->autostartDir, name); snap_dir =3D g_strdup_printf("%s/%s", cfg->snapshotDir, name); + chk_dir =3D g_strdup_printf("%s/%s", cfg->checkpointDir, name); =20 if (virFileExists(cfg_file) && unlink(cfg_file) < 0) { @@ -11128,5 +11130,10 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr = cfg, !bestEffort) return -1; =20 + if (virFileIsDir(chk_dir) && + virFileDeleteTree(chk_dir) < 0 && + !bestEffort) + return -1; + return 0; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2664603..4e0186b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19126,6 +19126,24 @@ qemuDomainSnapshotWriteMetadataIter(void *payload, =20 =20 static int +qemuDomainCheckpointWriteMetadataIter(void *payload, + const char *name G_GNUC_UNUSED, + void *opaque) +{ + struct qemuDomainMomentWriteMetadataData *data =3D opaque; + virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(data->driver); + int ret; + + ret =3D qemuCheckpointWriteMetadata(data->vm, payload, + data->driver->xmlopt, + cfg->snapshotDir); + + virObjectUnref(cfg); + return ret; +} + + +static int qemuDomainRenameCallback(virDomainObjPtr vm, const char *new_name, unsigned int flags, @@ -19191,6 +19209,11 @@ qemuDomainRenameCallback(virDomainObjPtr vm, &data) < 0) goto cleanup; =20 + if (virDomainCheckpointForEach(vm->checkpoints, + qemuDomainCheckpointWriteMetadataIter, + &data) < 0) + goto cleanup; + if (virDomainDefSave(vm->def, driver->xmlopt, cfg->configDir) < 0) goto cleanup; =20 --=20 1.8.3.1 From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404945; cv=none; d=zohomail.com; s=zohoarc; b=XWGINYDja7AnNoPgLbVA0migDVIRh+mYnjOtB3YcliZeAVzMAFVzPCPjnh5hbClizNDabNcTVeO9QkqULUrBxTq39q/uZd9qVQVyvJZ5Kj5DvHl7Z+qhDkZc0nqxn8NqjXOz/jtWLedk/dKeJs3OYOSFfxkdMH8E80pEMKxyVmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404945; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=bEGmDzIPw3//ssG59ZOa3555UnqdUoO47/4bx0RFbIs=; b=a82fEUyZUALToNXo+1qUutBhG35OjHphskxm/CzZ3zPRXBIbHUsZ0o7MJpbiasLT4ALlNYzZllFXcA1hpHZkh3V9cqOmO/aH1uY4FI1lcSHzTUqF47xx0GazmYpDJYx9slEcOm5TPqG8Db4bTpr8rR1oLsjJx6dXUzZRnRKU5BY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1604404945861917.8700759104848; Tue, 3 Nov 2020 04:02:25 -0800 (PST) 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-531-0qdx6YAoPQizDtkj90ZOGg-1; Tue, 03 Nov 2020 07:02:20 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0284B10A0B8A; Tue, 3 Nov 2020 12:02:15 +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 D2B706EF7E; Tue, 3 Nov 2020 12:02:14 +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 9E51644A43; Tue, 3 Nov 2020 12:02:14 +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 0A3C2CbD011807 for ; Tue, 3 Nov 2020 07:02:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9D6CA201E72B; Tue, 3 Nov 2020 12:02:12 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 98FA72016F2C for ; Tue, 3 Nov 2020 12:02:09 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 3F1308582A1 for ; Tue, 3 Nov 2020 12:02:09 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-153-rHNSjrzSMOeNMSM0sSCmtQ-1; Tue, 03 Nov 2020 07:02:06 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZv0R-007EMR-Ff for libvir-list@redhat.com; Tue, 03 Nov 2020 15:01:43 +0300 X-MC-Unique: 0qdx6YAoPQizDtkj90ZOGg-1 X-MC-Unique: rHNSjrzSMOeNMSM0sSCmtQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 07/10] qemu: update name on reverting from snapshot Date: Tue, 3 Nov 2020 15:00:05 +0300 Message-Id: <1604404808-825155-8-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If domain name is changed since snapshot we need to update it to current in config taken from snapshot. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_snapshot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index a6241ab..c9f2be0 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -1924,6 +1924,11 @@ qemuSnapshotRevert(virDomainObjPtr vm, driver->xmlopt, priv->qemuCaps, true); if (!config) goto endjob; + + if (STRNEQ(config->name, vm->def->name)) { + VIR_FREE(config->name); + config->name =3D g_strdup(vm->def->name); + } } =20 if (snap->def->inactiveDom) { @@ -1931,6 +1936,11 @@ qemuSnapshotRevert(virDomainObjPtr vm, driver->xmlopt, priv->qemuCaps, = true); if (!inactiveConfig) goto endjob; + + if (STRNEQ(inactiveConfig->name, vm->def->name)) { + VIR_FREE(inactiveConfig->name); + inactiveConfig->name =3D g_strdup(vm->def->name); + } } else { /* Inactive domain definition is missing: * - either this is an old active snapshot and we need to copy the --=20 1.8.3.1 From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404954; cv=none; d=zohomail.com; s=zohoarc; b=b9CiMiuEvB+gCr1Kk14ObNLc0sGfIo/DFzj/4L+qWkaAm37Ay4piv/nyBSm0FYuP4ZeskmS1ugyAipCrPdQLSScMQJrNOTgYfuFJ7NbLVXQLm1dKW+vQYREENq5v4Y0NGUkb4sG/Oh5JnNvXddPrAtjbVXYBtULBJ64k4/+ed1k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404954; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ze+6fWtz0DNThGAFQivtGjVwmm4GYchm/ADCdIe74XQ=; b=jlFzgvh4dMgBOvie4UlXaH6+ND9ekg2FYDtuWbAxU2OY7NY7GghuxvEJPNO5o0u1Q3FZ7/yT7LHh/Ij3ighNuKrpUH/AVxA6fauq+HOgKmT0UBiC9S1Cm9r3i0UiAcadnpJEPP5vyzHry/V++m7d3zSkINwmYWuz23FdUfw0Kbw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604404954356997.7039339802566; Tue, 3 Nov 2020 04:02:34 -0800 (PST) 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-378-l0Ce1pyfPH2BfJZnAuwkwA-1; Tue, 03 Nov 2020 07:02:29 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0E1998015F7; Tue, 3 Nov 2020 12:02:24 +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 DCC3621E8C; Tue, 3 Nov 2020 12:02:23 +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 A2F99181A07B; Tue, 3 Nov 2020 12:02:23 +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 0A3C2LBB011846 for ; Tue, 3 Nov 2020 07:02:21 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4C5F5202348E; Tue, 3 Nov 2020 12:02:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47DB920235B9 for ; Tue, 3 Nov 2020 12:02:21 +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 275FA1842081 for ; Tue, 3 Nov 2020 12:02:21 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-212-mN5Ul1DOM8642Q4YlJobOw-1; Tue, 03 Nov 2020 07:02:17 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZv0d-007EMR-9T for libvir-list@redhat.com; Tue, 03 Nov 2020 15:01:55 +0300 X-MC-Unique: l0Ce1pyfPH2BfJZnAuwkwA-1 X-MC-Unique: mN5Ul1DOM8642Q4YlJobOw-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 08/10] qemu: rename: remove snapshot/checkpoint restriction Date: Tue, 3 Nov 2020 15:00:06 +0300 Message-Id: <1604404808-825155-9-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4e0186b..86ff74f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19284,18 +19284,6 @@ static int qemuDomainRename(virDomainPtr dom, goto endjob; } =20 - if (virDomainSnapshotObjListNum(vm->snapshots, NULL, 0) > 0) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot rename domain with snapshots")); - goto endjob; - } - - if (virDomainListCheckpoints(vm->checkpoints, NULL, dom, NULL, flags) = > 0) { - virReportError(VIR_ERR_OPERATION_INVALID, - "%s", _("cannot rename domain with checkpoints")); - goto endjob; - } - if (virDomainObjListRename(driver->domains, vm, new_name, flags, qemuDomainRenameCallback, driver) < 0) goto endjob; --=20 1.8.3.1 From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404978; cv=none; d=zohomail.com; s=zohoarc; b=Q9IZhMDScHb6aBNP1cTrPrRYNeR3MNnfrz8IQbXhRdmG/vUeG/HN+VAZ7JVWZc6Cs0fQQrTXHZnilH2j4HDiIBSIOIH1lDmaQbVj+KGwRf/8ZfUhT6yAed8XV7PCMbpA15TgZfh3kiobHjxUISaHw8P+WVfQPjw3/7uwIHLOWyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404978; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=L/ioupDdQcbykVncIiMwYTH9n6rspZ7oMaDrvtBRkKw=; b=WYTruCMlTP0NjmYWgTb/7PLyv5CdwmPXfNpLQiuXIqknKFEdRzqy0J98MKZMO1vtt/051FA7sQUe+UlwwepsMG0bkIJ/pTLIWIPhC35wQmSHj3GAvsrtmIrgBO0lwxdSIABMkUc5cqqUb25G+9pYVQaJvybCRpgITrlx07/gqQM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1604404978293692.2675844872302; Tue, 3 Nov 2020 04:02:58 -0800 (PST) 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-206-LXGwBWpoNCqYSg3zxMLOxA-1; Tue, 03 Nov 2020 07:02:52 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1A1B71007466; Tue, 3 Nov 2020 12:02: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 ED19C5DA71; Tue, 3 Nov 2020 12:02:46 +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 BAF32181A050; Tue, 3 Nov 2020 12:02:46 +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 0A3C2cbQ011915 for ; Tue, 3 Nov 2020 07:02:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 64ACC207A53C; Tue, 3 Nov 2020 12:02:38 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FFBF2068FE5 for ; Tue, 3 Nov 2020 12:02:31 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (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 D966B801224 for ; Tue, 3 Nov 2020 12:02:31 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-573-Dr3g47n2OrCePU6sWr5gTA-1; Tue, 03 Nov 2020 07:02:29 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZv0p-007EMR-3w for libvir-list@redhat.com; Tue, 03 Nov 2020 15:02:07 +0300 X-MC-Unique: LXGwBWpoNCqYSg3zxMLOxA-1 X-MC-Unique: Dr3g47n2OrCePU6sWr5gTA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 09/10] qemu: qemuDomainDefineXMLFlags: move cleanup logic to cleanup section Date: Tue, 3 Nov 2020 15:00:07 +0300 Message-Id: <1604404808-825155-10-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Let's move objlist restoring to cleanup section so that we can handle failu= re of actions between virDomainObjListAdd and virDomainDefSave. We are going to add such actions in next patch. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 86ff74f..6c353a5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6705,7 +6705,7 @@ qemuDomainDefineXMLFlags(virConnectPtr conn, =20 if (!(def =3D virDomainDefParseString(xml, driver->xmlopt, NULL, parse_flags))) - goto cleanup; + return NULL; =20 if (virXMLCheckIllegalChars("name", def->name, "\n") < 0) goto cleanup; @@ -6719,10 +6719,23 @@ qemuDomainDefineXMLFlags(virConnectPtr conn, goto cleanup; def =3D NULL; =20 + if (virDomainDefSave(vm->newDef ? vm->newDef : vm->def, + driver->xmlopt, cfg->configDir) < 0) + goto cleanup; + vm->persistent =3D 1; =20 - if (virDomainDefSave(vm->newDef ? vm->newDef : vm->def, - driver->xmlopt, cfg->configDir) < 0) { + event =3D virDomainEventLifecycleNewFromObj(vm, + VIR_DOMAIN_EVENT_DEFINED, + !oldDef ? + VIR_DOMAIN_EVENT_DEFINED_ADDED : + VIR_DOMAIN_EVENT_DEFINED_UPDATED); + + VIR_INFO("Creating domain '%s'", vm->def->name); + dom =3D virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id); + + cleanup: + if (!dom && !def) { if (oldDef) { /* There is backup so this VM was defined before. * Just restore the backup. */ @@ -6735,22 +6748,9 @@ qemuDomainDefineXMLFlags(virConnectPtr conn, } else { /* Brand new domain. Remove it */ VIR_INFO("Deleting domain '%s'", vm->def->name); - vm->persistent =3D 0; qemuDomainRemoveInactiveJob(driver, vm); } - goto cleanup; } - - event =3D virDomainEventLifecycleNewFromObj(vm, - VIR_DOMAIN_EVENT_DEFINED, - !oldDef ? - VIR_DOMAIN_EVENT_DEFINED_ADDED : - VIR_DOMAIN_EVENT_DEFINED_UPDATED); - - VIR_INFO("Creating domain '%s'", vm->def->name); - dom =3D virGetDomain(conn, vm->def->name, vm->def->uuid, vm->def->id); - - cleanup: virDomainDefFree(oldDef); virDomainDefFree(def); virDomainObjEndAPI(&vm); --=20 1.8.3.1 From nobody Mon Apr 29 19:52:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1604404984; cv=none; d=zohomail.com; s=zohoarc; b=ksew5djTQz+t9UmmwlMiWIDrN8U1Kz91CLjRvGVw6nP2G5qTAUWA0HXMrKqy+yt3XWJN/8d8DN9TXxMJRHVTgb0nVbyjfusx78pPYzdVkMmYrkLYcs1llYFneBaH4YKOMUGgCwze3K4UfukjTyr+j9L3gTzr5oCRcdbxbrqIgcA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404984; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=dcyrd8lrUWE803OMjZORJPygHTptIwldCEprXNAvDYY=; b=TSU5m6AV+SRM4azCouqDpRlyyLCLSNbVDE3k/SnSoX15LVmDbe/SuZdIP0fHHF/m+adsCKDqcU9bog0VdC35ROD6w9hbzeBJ/nRiG2Bk5FvDS9EF36CE22VzGr1BdR3ifc1YQBT7NS/DoDIeTLY92oZD01QWgzCltvhlNFtKMhU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 160440498496380.52526135248377; Tue, 3 Nov 2020 04:03:04 -0800 (PST) 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-105-Mox03aRhNtiUVapa9DASbA-1; Tue, 03 Nov 2020 07:02:58 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E7B4809DE3; Tue, 3 Nov 2020 12:02:50 +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 07F121002D49; Tue, 3 Nov 2020 12:02:50 +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 C92125813E; Tue, 3 Nov 2020 12:02:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A3C2kVw011949 for ; Tue, 3 Nov 2020 07:02:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 35E04110DBC4; Tue, 3 Nov 2020 12:02:46 +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 323C6110DBC2 for ; Tue, 3 Nov 2020 12:02:43 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.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 CFDB090E429 for ; Tue, 3 Nov 2020 12:02:43 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-155--NcnsFN-PNufv70TZYvCqA-1; Tue, 03 Nov 2020 07:02:41 -0500 Received: from [10.28.15.159] (helo=vz7.sw.ru) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kZv10-007EMR-T4 for libvir-list@redhat.com; Tue, 03 Nov 2020 15:02:18 +0300 X-MC-Unique: Mox03aRhNtiUVapa9DASbA-1 X-MC-Unique: -NcnsFN-PNufv70TZYvCqA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH v2 10/10] qemu: remove possible garbage left from previous rename/undefine Date: Tue, 3 Nov 2020 15:00:08 +0300 Message-Id: <1604404808-825155-11-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1604404808-825155-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Due to failures to unlink on previous rename/undefine we can already have autolink etc files for the domain to be defined. Remove them. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 6 ++++++ src/qemu/qemu_migration.c | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6c353a5..3b7d1d7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6719,6 +6719,9 @@ qemuDomainDefineXMLFlags(virConnectPtr conn, goto cleanup; def =3D NULL; =20 + if (!oldDef && qemuDomainNamePathsCleanup(cfg, vm->def->name, false) <= 0) + goto cleanup; + if (virDomainDefSave(vm->newDef ? vm->newDef : vm->def, driver->xmlopt, cfg->configDir) < 0) goto cleanup; @@ -19184,6 +19187,9 @@ qemuDomainRenameCallback(virDomainObjPtr vm, vm->def->name))) return -1; =20 + if (qemuDomainNamePathsCleanup(cfg, new_name, false) < 0) + goto cleanup; + if (vm->autostart) { if (!(new_dom_autostart_link =3D virDomainConfigFile(cfg->autostar= tDir, new_dom_name)) || diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 6f764b0..b4fb586 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -5137,6 +5137,9 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver, priv->qemuCaps))) goto error; =20 + if (!oldDef && qemuDomainNamePathsCleanup(cfg, vmdef->name, false) < 0) + goto error; + if (virDomainDefSave(vmdef, driver->xmlopt, cfg->configDir) < 0 && !ignoreSaveError) goto error; --=20 1.8.3.1