From nobody Sun May 5 19:37:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1583223608; cv=none; d=zohomail.com; s=zohoarc; b=F7kRW43tSIxVwjBT3TzbkVli7hadtJaFZcDPaV//IHLaBlwebn2MxZvr1DMuMmz2tRh61ghM2Zi/8XDArmzTrz0oTKDkAc0DjC+jwrvVyJHdCU9BWT5A6Ss2HaQE597GMWlMbDIfBi1usVTChX+6tTMYA9V0aNyKQletqlrhvf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583223608; 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; bh=AdZ1+UaHWGNA39ff4twFn54sd9rEyWU2XSWwZwnXYrs=; b=GoTzBa9XMqLMPcPx8/ffJm8JINU4DtdAJLuprRgAMj01ybvHPXjAj1bNXCWc7t5PFIRNbruCj3dVSMtcKlWw0rUsYlI2+IKpIWXXJDPgwZkLCYHB0P67jLt9EG7GyByEmsL38xWo5jcuVjYs5pl/pqxiP+uhj8wrABRkOMZIq2A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1583223608349951.120216468542; Tue, 3 Mar 2020 00:20:08 -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-271-L843l6JTPPyI1uGdgpBiLQ-1; Tue, 03 Mar 2020 03:20:05 -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 69D4210CE786; Tue, 3 Mar 2020 08:19:59 +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 333B92719C; Tue, 3 Mar 2020 08:19:59 +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 BD76D84499; Tue, 3 Mar 2020 08:19:58 +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 0238Jl6K003654 for ; Tue, 3 Mar 2020 03:19:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 563F62063205; Tue, 3 Mar 2020 08:19:47 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F7DF2063206 for ; Tue, 3 Mar 2020 08:19:44 +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 C7451800307 for ; Tue, 3 Mar 2020 08:19:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-170-MySjQIYRPiaDVGyVK5pFUg-1; Tue, 03 Mar 2020 03:19:42 -0500 Received: from dhcp-172-16-24-106.sw.ru ([172.16.24.106] helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j92mA-0002uR-Ss for libvir-list@redhat.com; Tue, 03 Mar 2020 11:19:38 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583223607; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AdZ1+UaHWGNA39ff4twFn54sd9rEyWU2XSWwZwnXYrs=; b=WdLp6lx6VVgVyTZ81Lg4SojrSbUS8Qw242Y4rEBfHy47KbxgubHN7qW0IL/a2Z7+d5e6sm KAKDae9kX2lKLvlkKATHO46Ud1v45C5p88Yl2GH2M0O4qVmlg4mWrhX5Vu6rzs3gzlkdWF MJ8L5SpQuCBT9bHpPrKdB+DsBQTmEEc= X-MC-Unique: L843l6JTPPyI1uGdgpBiLQ-1 X-MC-Unique: MySjQIYRPiaDVGyVK5pFUg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 1/8] qemu: remove duplicate code for removing remnant files Date: Tue, 3 Mar 2020 11:19:15 +0300 Message-Id: <20200303081922.9157-2-nshirokovskiy@virtuozzo.com> In-Reply-To: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> References: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0238Jl6K003654 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This also fixes issue of removing both new and old cfg files if unlinking old autostart link fails. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_domain.c | 27 +++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 5 +++++ src/qemu/qemu_driver.c | 39 ++++++--------------------------------- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3dfa71650d..ff48744f39 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -16722,3 +16722,30 @@ qemuDomainInitializePflashStorageSource(virDomainO= bjPtr vm) =20 return 0; } + + +int +qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr cfg, + const char *name, + bool reportError) +{ + 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) + VIR_WARN("Failed to unlink '%s'", cfg_file); + + if (virFileIsLink(autostart_link) =3D=3D 1 && + unlink(autostart_link) < 0) { + if (reportError) { + virReportError(errno, _("Failed to unlink '%s'"), autostart_li= nk); + return -1; + } + } + + return 0; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f8fb48f2ff..5a59d04f24 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -1263,3 +1263,8 @@ qemuDomainMakeCPUMigratable(virCPUDefPtr cpu); =20 int qemuDomainInitializePflashStorageSource(virDomainObjPtr vm); + +int +qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr cfg, + const char *name, + bool reportError); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 35ade1ef37..d2226fcf45 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -21999,25 +21999,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_new =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_DEFINED, @@ -22025,25 +22007,16 @@ qemuDomainRenameCallback(virDomainObjPtr vm, ret =3D 0; =20 cleanup: - virObjectEventStateQueue(driver->domainEventState, event_old); - virObjectEventStateQueue(driver->domainEventState, event_new); - 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; + qemuDomainNamePathsCleanup(cfg, ret < 0 ? new_dom_name : old_dom_name,= false); + virObjectEventStateQueue(driver->domainEventState, event_old); + virObjectEventStateQueue(driver->domainEventState, event_new); + return ret; } =20 static int qemuDomainRename(virDomainPtr dom, --=20 2.23.0 From nobody Sun May 5 19:37:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1583223617; cv=none; d=zohomail.com; s=zohoarc; b=TfvsOX3lddZfQpH/H05QNoIeg8YADu7AS+IveQJHL0g5pmp0oHnMDwiacJbMaAd5nPXJYUHK4JPNkDnKyBrC10kXqa8ULS3nr2p5rkriZtHYaaH1l5DdPDrfPlJujNPTAOibLckrstYqZ0riuqUtNUXNP+G6B30ogTcKtA6vxTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583223617; 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; bh=TMWymgMlRRvdM7d/1LJStQhdjofF0dCVDoHEf0hR1pg=; b=ISZNqX3C/v3FjbBYxKhg45bVrDTxTW4cuWH2M0dQGhEFth6Gcdx9MLbKi+Fy6e/1OEbh4y/Iz65aBD1snr3Qf0ekmPaURfTgWaTtj1jtvFzm4DJmsxUSez0mAvnJFDhkZsybtmAVk12+GSHWkssaoNHIS/IAMIVJU6JfDWO2c0s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1583223617543296.76102715337936; Tue, 3 Mar 2020 00:20:17 -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-23-9w71bjmGNVyaps2nA4UIUA-1; Tue, 03 Mar 2020 03:20:14 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 342F119067ED; Tue, 3 Mar 2020 08:20:07 +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 D87248D577; Tue, 3 Mar 2020 08:20:06 +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 31AD718089D8; Tue, 3 Mar 2020 08:20:06 +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 0238JkFh003629 for ; Tue, 3 Mar 2020 03:19:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id A4DDE1004C49; Tue, 3 Mar 2020 08:19: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 9F15410E60E6 for ; Tue, 3 Mar 2020 08:19:44 +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 6F67C80028B for ; Tue, 3 Mar 2020 08:19:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-189-RikIUgznMwKoAvuy1fC5OA-1; Tue, 03 Mar 2020 03:19:42 -0500 Received: from dhcp-172-16-24-106.sw.ru ([172.16.24.106] helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j92mB-0002uR-1O for libvir-list@redhat.com; Tue, 03 Mar 2020 11:19:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583223616; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=TMWymgMlRRvdM7d/1LJStQhdjofF0dCVDoHEf0hR1pg=; b=VK7jLq1m/pOKDi/LCdeORo6dlQePAc7JTUa/U6HvO8EX8oZcxLus7ghkpF0GHzVsmayufK DHcJ96crDhnLNOge6ZiTdXxQD5lgJekD/8aYpd+kTu47Q0t7krFrgwFwX/btUdGm0MThxX cB/7jg4N0TrVyLFG6sn8SzLdjhnWxhk= X-MC-Unique: 9w71bjmGNVyaps2nA4UIUA-1 X-MC-Unique: RikIUgznMwKoAvuy1fC5OA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 2/8] qemu: qemuDomainRenameCallback: fix sending false undefined event Date: Tue, 3 Mar 2020 11:19:16 +0300 Message-Id: <20200303081922.9157-3-nshirokovskiy@virtuozzo.com> In-Reply-To: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> References: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0238JkFh003629 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If saving cfg file fails we send false undefine event currently. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d2226fcf45..70cad837f2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -21989,10 +21989,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; @@ -22001,9 +21997,15 @@ qemuDomainRenameCallback(virDomainObjPtr vm, if (virDomainDefSave(vm->def, driver->xmlopt, cfg->configDir) < 0) goto cleanup; =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); + virObjectEventStateQueue(driver->domainEventState, event_old); + virObjectEventStateQueue(driver->domainEventState, event_new); + ret =3D 0; =20 cleanup: @@ -22014,8 +22016,6 @@ qemuDomainRenameCallback(virDomainObjPtr vm, } =20 qemuDomainNamePathsCleanup(cfg, ret < 0 ? new_dom_name : old_dom_name,= false); - virObjectEventStateQueue(driver->domainEventState, event_old); - virObjectEventStateQueue(driver->domainEventState, event_new); return ret; } =20 --=20 2.23.0 From nobody Sun May 5 19:37:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1583223599; cv=none; d=zohomail.com; s=zohoarc; b=dnLTLmlb8wbfceQILr753uuJXgPOWZeYEpU8CurdRsqbQnotkcfiF9ymclHZ40uUSP9gGqpd8sp5FPFnRmRUafL1P9d+WGQxmIkRCpJcCOKcwxbP5vZDzKCCLvcSd0E2mFGyN2Bysf2vPFVMtTaLpxOVs/wSxjvaVBR/C7QA18Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583223599; 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; bh=RqvALcjV7Pvx1DdHlCR2fAZLcm8OSs1bf9SADpNMXi4=; b=UALn3L9wPn+jmsKMfZmgTkYEwiS+RipMGv/sTDyI7J3VICC9IO9Q6hwosOcC3+CdpGrKtCsf0TrGS8GXIo3TtV6OH59Lzh8UBDCIf5kNyFbvD2b39nqZYBuFtvsVnwZnIAoTfJ/6XRT5tQwptWeOTJlZFz7sJFERoujmU06XKMw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1583223599001121.76924090759007; Tue, 3 Mar 2020 00:19:59 -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-191-NPbvTnArPbyTniI15anVHQ-1; Tue, 03 Mar 2020 03:19:56 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5363E19067E0; Tue, 3 Mar 2020 08:19: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 14AD78D56B; Tue, 3 Mar 2020 08:19: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 0923684479; Tue, 3 Mar 2020 08:19:48 +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 0238JkXe003628 for ; Tue, 3 Mar 2020 03:19:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id A560310EE6D4; Tue, 3 Mar 2020 08:19:46 +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 9FCAB10E60F6 for ; Tue, 3 Mar 2020 08:19:44 +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 A6CC486D723 for ; Tue, 3 Mar 2020 08:19:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-GocNcu0ANN2uW06k4NZsyg-1; Tue, 03 Mar 2020 03:19:42 -0500 Received: from dhcp-172-16-24-106.sw.ru ([172.16.24.106] helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j92mB-0002uR-4v for libvir-list@redhat.com; Tue, 03 Mar 2020 11:19:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583223598; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RqvALcjV7Pvx1DdHlCR2fAZLcm8OSs1bf9SADpNMXi4=; b=Kk46x+7jl/5C6l6GRenDLv2ldFmsRbTvatZpED39iQhGWUO/smov0vsMEw3nzLi80iwWyA WJXVQ5o1E6lZPp2rZfLvDrZ/IMpk3OvJgNOj38obaXzSdSHSuSl3aJ4t9rf94C2IZ8bZjV trtoquBU0JcS6hxPgKZgdRD0p5eVHcc= X-MC-Unique: NPbvTnArPbyTniI15anVHQ-1 X-MC-Unique: GocNcu0ANN2uW06k4NZsyg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 3/8] qemu: rename: support renaming snapshots directory Date: Tue, 3 Mar 2020 11:19:17 +0300 Message-Id: <20200303081922.9157-4-nshirokovskiy@virtuozzo.com> In-Reply-To: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> References: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0238JkXe003628 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- 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 ff48744f39..0c4cb09158 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -16731,9 +16731,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) @@ -16747,5 +16749,10 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr = cfg, } } =20 + if (virFileIsDir(snap_dir) && virFileDeleteTree(snap_dir) < 0) { + if (reportError) + return -1; + } + return 0; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 70cad837f2..6bde4d3de0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -21938,6 +21938,30 @@ qemuDomainSetUserPassword(virDomainPtr dom, } =20 =20 +struct qemuDomainMomentWriteMetadataData { + virQEMUDriverPtr driver; + virDomainObjPtr vm; +}; + + +static int +qemuDomainSnapshotWriteMetadataIter(void *payload, + const void *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, @@ -21955,6 +21979,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 @@ -21994,6 +22022,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 2.23.0 From nobody Sun May 5 19:37:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1583223609; cv=none; d=zohomail.com; s=zohoarc; b=QpcNZ9fABvNrqDpP4aCiVnwMxxJZ1ZVhkV/9wwIa2hnWhC73kYzE7WpGDCClIqwoBONveoekD1e7vzGBjIrnPH0d+Oh9Mt6HtV47YSaNOVArgmKi330d1PfNeWpefYQADj5FEETOSX/3b5qYXsUERWxCjfseRhH4mglEuBCtQkI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583223609; 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; bh=Ew++0t1pywe/LHmknCKf1n/Xf16TBQNczL7e8c2Iqgo=; b=P4wWxxpTVN7uOr5Fbn0jYbPjMuaTUBPFGu+Uk5zV4D0EQwlDSXdPOSndE0Xg8Y3J45Vafk73ODhzMeSJOXbyAJSdxJ5wyWOPGWlyRMk5XBkPQOfwiCJ4va1LnI8GMa8mx5s1JcQ3GqcXuviRRDtIaTWJILiHij4TmllQxlVo4VU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583223609234118.75461375000293; Tue, 3 Mar 2020 00:20:09 -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-144-bjamGeubNFifdoypsH-54w-1; Tue, 03 Mar 2020 03:20:05 -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 A3E0C800D50; Tue, 3 Mar 2020 08:19:59 +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 7722E91D67; Tue, 3 Mar 2020 08:19:59 +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 1DA5A18089D6; Tue, 3 Mar 2020 08:19:59 +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 0238JkeM003627 for ; Tue, 3 Mar 2020 03:19:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id A7E6310E60E6; Tue, 3 Mar 2020 08:19:46 +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 A2A4B1004C5A for ; Tue, 3 Mar 2020 08:19:44 +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 7E078867B18 for ; Tue, 3 Mar 2020 08:19:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-170-QiexFCPOM_G82rVO2W-Gaw-1; Tue, 03 Mar 2020 03:19:42 -0500 Received: from dhcp-172-16-24-106.sw.ru ([172.16.24.106] helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j92mB-0002uR-8A for libvir-list@redhat.com; Tue, 03 Mar 2020 11:19:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583223608; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ew++0t1pywe/LHmknCKf1n/Xf16TBQNczL7e8c2Iqgo=; b=LDmCtKyh9vwXoAEgb1RJKvNjX/WXUDqAgoMuu+ycp6eFO0i0FtV92FCxmkAiYv4iaZa7vc ek2kd+/AIHvkDb1xd83l6ZCkQnJAq2UC8I14r8PWfWgwbneI66ETK41AP7sw8cFPmEFf0H hW0vHnjQ1EibhA2SnQ44PZhPhbq67Os= X-MC-Unique: bjamGeubNFifdoypsH-54w-1 X-MC-Unique: QiexFCPOM_G82rVO2W-Gaw-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 4/8] qemu: rename: support renaming checkpoints directory Date: Tue, 3 Mar 2020 11:19:18 +0300 Message-Id: <20200303081922.9157-5-nshirokovskiy@virtuozzo.com> In-Reply-To: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> References: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0238JkeM003627 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- 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 c06bfe6a21..c13a005403 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 cf1e9e46cb..10e1198897 100644 --- a/src/qemu/qemu_checkpoint.h +++ b/src/qemu/qemu_checkpoint.h @@ -80,3 +80,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 0c4cb09158..45dbc1c7da 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -16732,10 +16732,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) @@ -16754,5 +16756,10 @@ qemuDomainNamePathsCleanup(virQEMUDriverConfigPtr = cfg, return -1; } =20 + if (virFileIsDir(chk_dir) && virFileDeleteTree(chk_dir) < 0) { + if (reportError) + return -1; + } + return 0; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 6bde4d3de0..288067dd67 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -21962,6 +21962,24 @@ qemuDomainSnapshotWriteMetadataIter(void *payload, } =20 =20 +static int +qemuDomainCheckpointWriteMetadataIter(void *payload, + const void *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, @@ -22027,6 +22045,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 2.23.0 From nobody Sun May 5 19:37:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1583223607; cv=none; d=zohomail.com; s=zohoarc; b=dboOG4/PVDiHsZuSc7zWGChb0xF1XLV2rJ3Ak+sKOlgRlnif2yRnrxu6+1aa7j5EYTMdAbCuMjG3HspYha0oyx+/f7O9Ffg5J8lgbL6BQaOtzfQEuvB9+rK2SfoJdSjvNTYWEZwoQc/z0aHC21zPb+cF03l22WWpbFgTgnXkZF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583223607; 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; bh=q1fHEO319jLj9XwVBPqGoxAm4WMlNTuKWbGW5h8XiYY=; b=Y+E+xICbMlaJ2zq/M8ATnevhI3Wy8oFkDw0A55jk+28tUkskLbVdTLtOZcvWxbU2i87tZdFBTju7XnSaJCrwYNB7O1Xcf4HRtMgunf/SbnVCix57E5rSHcCZSkcrdbKFr3MRck00Zgpc9dOBUR0QEZIbZEf9X9YksnxUDaq/GKc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1583223607557453.5527461463978; Tue, 3 Mar 2020 00:20:07 -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-148-YFW4Cw2gNqeJP_WlY8N3ww-1; Tue, 03 Mar 2020 03:20:04 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2121C1005516; Tue, 3 Mar 2020 08:19:59 +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 D8A5E60C80; Tue, 3 Mar 2020 08:19:58 +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 7C0FE18089D6; Tue, 3 Mar 2020 08:19:58 +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 0238JkQd003624 for ; Tue, 3 Mar 2020 03:19:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 841D22166B34; Tue, 3 Mar 2020 08:19:46 +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 7B4062166B2E for ; Tue, 3 Mar 2020 08:19:44 +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 71DC68007D4 for ; Tue, 3 Mar 2020 08:19:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-403-mJOCQp9eOsGguPcRG3Ptdg-1; Tue, 03 Mar 2020 03:19:42 -0500 Received: from dhcp-172-16-24-106.sw.ru ([172.16.24.106] helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j92mB-0002uR-Ck for libvir-list@redhat.com; Tue, 03 Mar 2020 11:19:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583223606; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=q1fHEO319jLj9XwVBPqGoxAm4WMlNTuKWbGW5h8XiYY=; b=I5J/AO222LbxModFdL/MIVdcpJXQNQGlvvnGqwlInSLh2NXB0Y3w4+rc40Dp+1q3peXdGY atW4k5Pfg3Ts26crdW+6ewezI8rk6xs7MkUx6qgcNVyAgITWlDclZNT+OLun3vjOwzqSsf 4JEM9domdkhlJJTfuzO3+yEBS7I95/0= X-MC-Unique: YFW4Cw2gNqeJP_WlY8N3ww-1 X-MC-Unique: mJOCQp9eOsGguPcRG3Ptdg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 5/8] qemu: update name on reverting from snapshot Date: Tue, 3 Mar 2020 11:19:19 +0300 Message-Id: <20200303081922.9157-6-nshirokovskiy@virtuozzo.com> In-Reply-To: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> References: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0238JkQd003624 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.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If domain name is changed since snapshot we need to update it to current in config taken from snapshot. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 288067dd67..875b665cdf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16326,6 +16326,11 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr sn= apshot, 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) { @@ -16333,6 +16338,11 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr sn= apshot, 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 2.23.0 From nobody Sun May 5 19:37:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1583223599; cv=none; d=zohomail.com; s=zohoarc; b=OXoh1hrPYFlKiJ+Jvm8TsTh2bbekkUWe2FtXIgxNQeZwMtsajNg0YjbtLeK+tCXT1R9XS1Y7VjGoOX1jF2Khs+yx+k8giMHw+jPNrUgXyLxg2swmyyGhOaQsxDkmOPK1McoouGTDX8oBn4sXwPXI3f1hwCfuzwL5F8lotCsedGk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583223599; 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; bh=930KJkiTg8YVzWLLBzjmCabsNb6u3ctvWoQ5t7wxf0Y=; b=J2A16gvMleicuzqiuFW4Fy5fQucLXSHSJsnkNAA6E39ulOHJ25zPOaQqY7tBV+A0N4LAkSijmZPEMOMEbJ+SMBrGJ8m4aebrpAxSvsyZZ2RUljRVU3KUVyg8LXuBTfs2QKy02KBDwV2kU5if+K6TVq6aZsvpaJe49tXEGOzWEQg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1583223599729455.42814695274194; Tue, 3 Mar 2020 00:19:59 -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-212-noV4EzbIMWCPx9vIlxRjVg-1; Tue, 03 Mar 2020 03:19:56 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55BCC107ACC7; Tue, 3 Mar 2020 08:19:50 +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 8B35F60BF3; Tue, 3 Mar 2020 08:19:49 +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 2210918089CF; Tue, 3 Mar 2020 08:19:48 +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 0238JkmV003625 for ; Tue, 3 Mar 2020 03:19:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 850CE2166B35; Tue, 3 Mar 2020 08:19:46 +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 7E3B62166B30 for ; Tue, 3 Mar 2020 08:19:44 +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 5B605185A793 for ; Tue, 3 Mar 2020 08:19:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-4-49cvexjsM_CI0a4reozs-A-1; Tue, 03 Mar 2020 03:19:42 -0500 Received: from dhcp-172-16-24-106.sw.ru ([172.16.24.106] helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j92mB-0002uR-Gm for libvir-list@redhat.com; Tue, 03 Mar 2020 11:19:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583223598; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=930KJkiTg8YVzWLLBzjmCabsNb6u3ctvWoQ5t7wxf0Y=; b=A9df4ZTKAWzvP3NQzbqrROy8el7mvH6mGjwgE4mwFrRYtp8cKakZxiG9HprMI9TOOLz461 LpaRViq4JJ2XDei8bJRUq05DAIyW8S6cU4UCbsX2wY94EiWFZfx8pP3OgpsKGtVfnKrk3u Q2CdkTULMMfHKPqw6KDyZ4MJSHBLT/E= X-MC-Unique: noV4EzbIMWCPx9vIlxRjVg-1 X-MC-Unique: 49cvexjsM_CI0a4reozs-A-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 6/8] qemu: rename: remove snapshot/checkpoint restriction Date: Tue, 3 Mar 2020 11:19:20 +0300 Message-Id: <20200303081922.9157-7-nshirokovskiy@virtuozzo.com> In-Reply-To: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> References: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0238JkmV003625 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.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- 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 875b665cdf..4553ebfb80 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -22128,18 +22128,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 2.23.0 From nobody Sun May 5 19:37:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1583223622; cv=none; d=zohomail.com; s=zohoarc; b=nd2wYgn97FVkOzwK/Q9QsSueyzo0duBfUNcs9DpRPTE5bYFdVVTbhQAkW255zZPJGnPmPHY2mHOsfSyhJX/mOHQpwMQ0G3UDgB6B8zrd43UnMOUhBTIQhZh+rcTU4443RhgQn8wtGeasKtPT1Iuyd8t5g5z4GwjQq04Yq3fo1FM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583223622; 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; bh=5JV+/WR0f2oeZK/UmxVdvIQWMFimz/deTzhNmpVebFc=; b=RKwuUcTytH6o8zwfco9xWU3+RnnlijkpmgDRqcDJAx90gISPNSpEzccS1jIcns+Qm6ChRYCU3Yilhmq3ieTt1cJ3e0pafB4c21BiWdKKuwmCqj58oep4epV046M4cuJKywSzaRqo1Urqifqr2w2C1Q2dHwXzm26ojKrDh9p/8Cg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1583223622176209.2505353904446; Tue, 3 Mar 2020 00:20:22 -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-225-4uNSnnNBNcKBy2lRaTC2bQ-1; Tue, 03 Mar 2020 03:20:19 -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 081EC19067E0; Tue, 3 Mar 2020 08:20:13 +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 CFDCB5C1D6; Tue, 3 Mar 2020 08:20:12 +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 706D21808878; Tue, 3 Mar 2020 08:20:12 +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 0238JllN003655 for ; Tue, 3 Mar 2020 03:19:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 56FA12063211; Tue, 3 Mar 2020 08:19:47 +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 4FBDE206320C for ; Tue, 3 Mar 2020 08:19:44 +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 90B81185A78E for ; Tue, 3 Mar 2020 08:19:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-452-kwn-3pK4Ok6zcPE_vGS9iw-1; Tue, 03 Mar 2020 03:19:42 -0500 Received: from dhcp-172-16-24-106.sw.ru ([172.16.24.106] helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j92mB-0002uR-Lf for libvir-list@redhat.com; Tue, 03 Mar 2020 11:19:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583223621; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5JV+/WR0f2oeZK/UmxVdvIQWMFimz/deTzhNmpVebFc=; b=dTTiH98qW6sV02XJ5JAJUyy3KMBDrXsqPy1ifMQUj17OEAL3/XGOOkq4kTG1PZr8DfVx07 d4dm6hkhqvdxjCouDK5oW27IjDIbnWcmRqajchIb8ZZiNhXS/9bBNkJHZmVffd+114oaLd TWP861MF/bo+6JXtjW8Z0yoqlohGVUo= X-MC-Unique: 4uNSnnNBNcKBy2lRaTC2bQ-1 X-MC-Unique: kwn-3pK4Ok6zcPE_vGS9iw-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 7/8] qemu: refactor qemuDomainDefineXMLFlags Date: Tue, 3 Mar 2020 11:19:21 +0300 Message-Id: <20200303081922.9157-8-nshirokovskiy@virtuozzo.com> In-Reply-To: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> References: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0238JllN003655 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Let's move objlist restoring to cleanup section so that we can handle failure of actions between virDomainObjListAdd and virDomainDefSave. Signed-off-by: Nikolay Shirokovskiy --- 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 4553ebfb80..e1b9240893 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7630,7 +7630,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; @@ -7644,10 +7644,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 (!def) { if (oldDef) { /* There is backup so this VM was defined before. * Just restore the backup. */ @@ -7660,22 +7673,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 2.23.0 From nobody Sun May 5 19:37:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1583223628; cv=none; d=zohomail.com; s=zohoarc; b=dk+FctloAsj555iCD615q/cjcZbidUZuDKOEjPlRSVlbgSpK7nyEn/o2CU7qDqjrllC1DOrY80E4RcPU9SkLeJGs+s8EWfDUIU9WI4oHI2qvPKe9HTNNUk+7LA1psIUQxzg6tHsyyuisjGX3eLNbI8xtmaf/vOmjZqN0M0rx4s8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583223628; 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; bh=4KyBTLwu5HvsFzTiwodnNzam+l4b5gGpLxCMvG0shM0=; b=NLaW4L8zQ/yP+bm6P287SH9Jlh3GjgXQEpLS2vhrlPyOTBfRwt/3rn2wjjTNocgU7ha7Drvl9j5LOW6DCgEOMUSlunLsHgBf3igaEP+ac287l0RQ/shYNPVj9MgBSGatqV7bos4jIL08Cpc3kupi4MAKhp6twKJVaP+DAAx5OtU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1583223628836751.3092087269032; Tue, 3 Mar 2020 00:20:28 -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-328-Rg2c4Q74NkibNGxocY2OTg-1; Tue, 03 Mar 2020 03:20:23 -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 17DC2140B; Tue, 3 Mar 2020 08:20:18 +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 D98B528998; Tue, 3 Mar 2020 08:20:17 +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 801AC86A05; Tue, 3 Mar 2020 08:20:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0238JnCV003664 for ; Tue, 3 Mar 2020 03:19:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8CE4CEB32E; Tue, 3 Mar 2020 08:19:49 +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 87EE6EB347 for ; Tue, 3 Mar 2020 08:19:44 +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 B77CD1019E10 for ; Tue, 3 Mar 2020 08:19:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-_r0Z9d_YNki_ZA0Vs_P9hA-1; Tue, 03 Mar 2020 03:19:42 -0500 Received: from dhcp-172-16-24-106.sw.ru ([172.16.24.106] helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1j92mB-0002uR-P9 for libvir-list@redhat.com; Tue, 03 Mar 2020 11:19:39 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583223625; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=4KyBTLwu5HvsFzTiwodnNzam+l4b5gGpLxCMvG0shM0=; b=i+mHkSKoUhG2oJ5TJ/ew4itFbfHqOq/N2hAqNPj5A4G3tuIkrre19PVlGqQSqs7oXVYlp8 YsIXjRtts9oLvvmUII3HbWpkXCJATpw2JTMChbozSiMXQxzpLOOxUWDZljkN+DwfoCDI7S 3Yczmd1ad2t2wAbLYWE/ke2WxI8u7lg= X-MC-Unique: Rg2c4Q74NkibNGxocY2OTg-1 X-MC-Unique: _r0Z9d_YNki_ZA0Vs_P9hA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 8/8] qemu: qemu: remove remnant files on define Date: Tue, 3 Mar 2020 11:19:22 +0300 Message-Id: <20200303081922.9157-9-nshirokovskiy@virtuozzo.com> In-Reply-To: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> References: <20200303081922.9157-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0238JnCV003664 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 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Due to failures on previous rename/undefine we can already have autolink etc files for the domain to be defined. Remove them. Signed-off-by: Nikolay Shirokovskiy --- 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 e1b9240893..f534f8ec99 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7644,6 +7644,9 @@ qemuDomainDefineXMLFlags(virConnectPtr conn, goto cleanup; def =3D NULL; =20 + if (!oldDef && qemuDomainNamePathsCleanup(cfg, vm->def->name, true) < = 0) + goto cleanup; + if (virDomainDefSave(vm->newDef ? vm->newDef : vm->def, driver->xmlopt, cfg->configDir) < 0) goto cleanup; @@ -22030,6 +22033,9 @@ qemuDomainRenameCallback(virDomainObjPtr vm, vm->def->name))) goto cleanup; =20 + if (qemuDomainNamePathsCleanup(cfg, new_name, true) < 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 3fc5388d6a..2e49e466f2 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4915,6 +4915,9 @@ qemuMigrationDstPersist(virQEMUDriverPtr driver, priv->qemuCaps))) goto error; =20 + if (!oldDef && qemuDomainNamePathsCleanup(cfg, vmdef->name, true) < 0) + goto error; + if (virDomainDefSave(vmdef, driver->xmlopt, cfg->configDir) < 0 && !ignoreSaveError) goto error; --=20 2.23.0