From nobody Sat May 4 21:24:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531671474602723.3834505302702; Sun, 15 Jul 2018 09:17:54 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 23CA212C01; Sun, 15 Jul 2018 16:17:51 +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 9C94B2616F; Sun, 15 Jul 2018 16:17: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 7651F4A460; Sun, 15 Jul 2018 16:17:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6FGHfh6027623 for ; Sun, 15 Jul 2018 12:17:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 491E410694E4; Sun, 15 Jul 2018 16:17:41 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3FB0C10694DE for ; Sun, 15 Jul 2018 16:17:38 +0000 (UTC) Received: from mail-vk0-f67.google.com (mail-vk0-f67.google.com [209.85.213.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 610EB308FB90 for ; Sun, 15 Jul 2018 16:17:27 +0000 (UTC) Received: by mail-vk0-f67.google.com with SMTP id 125-v6so20508094vke.11 for ; Sun, 15 Jul 2018 09:17:27 -0700 (PDT) Received: from localhost.localdomain ([177.83.73.15]) by smtp.gmail.com with ESMTPSA id z14-v6sm4903740uao.16.2018.07.15.09.17.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Jul 2018 09:17:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=7PGgkGx0GsxRE44s5rRQ74l/brC7Dw96c0wdcG2ZNv4=; b=KvaZfLZIu25dA4Zx5uAEJUBM3LkDgaaSH9rC66xyFsHTxfVha7zoy0F+GymME1zmZh uNZNeoyLwGCld2xLzbkvzRWPHocqYtQcZawUrDwiIze8Ii+h3A+gBvzXukdT0dv82Xsp JhP0YSn46vNjyoMCdhIyA9XcnUonlmM3feTlVXe9paAqy7Ih573ppZeSPlFO3IQcunIi zcs8gfLRccbjLaoVEuttBXZnFcLwjLINjGMwQ1Xokd0907oEdlzkEiD7XbAwE17vSxCj AYFcqaXPByp8Wy9QD9IGPg/lRGdMXaxwvnK0E/g1peAxe18pkGr5zHJrQdne/L+0wx1m Y/bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=7PGgkGx0GsxRE44s5rRQ74l/brC7Dw96c0wdcG2ZNv4=; b=fBnmLg4GdObsji50FOMW4unj37NOHLkVKIShIXnAbVu0yLViS1AnJqlbiHflTacTJh 1X/kXgIChhKGCFGXh1WLRPIbe48wPT45hp/EN5L1UnfuVAO499ljG87AbEGPCW3t5Ffe dAtuI7tLbdEbWA0RV7YZMPTcXHgvSIalSyu99rSYkm6/jIseUwMnLHUWB4owHXey7GlF M91164+GY8aUkmF9HcZw2o/ssdrNmJxRC2As6pAH6exLMuPskU8GCMhMBMqQd5zVi5Kx vGD+Rs8mQubiSLfgXQlvqPE9De3n0RKzenjbYPKpmlKZcDMhinXizUxMhFmvTQ+KXHzi NkkQ== X-Gm-Message-State: AOUpUlHpQ7wjlmxJr35hCj8XGP7UDHQ/2Hfmc7rmK6hJuQjygcU41iP0 JKS9gGVI5uz7whd/jHpKXuDWYg== X-Google-Smtp-Source: AAOMgpcLReHlZX7i7vrZmxlHLEhbDeTPNHSqyg/ZOn9y8qVmm57SrNXAmg1TvPeIggiH6+dmeViHxQ== X-Received: by 2002:a1f:fe47:: with SMTP id l68-v6mr7153271vki.108.1531671446266; Sun, 15 Jul 2018 09:17:26 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Sun, 15 Jul 2018 13:17:12 -0300 Message-Id: <20180715161712.28971-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Sun, 15 Jul 2018 16:17:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Sun, 15 Jul 2018 16:17:27 +0000 (UTC) for IP:'209.85.213.67' DOMAIN:'mail-vk0-f67.google.com' HELO:'mail-vk0-f67.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.281 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 209.85.213.67 mail-vk0-f67.google.com 209.85.213.67 mail-vk0-f67.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: fix broken autostart symlink after renaming domain. X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Sun, 15 Jul 2018 16:17:52 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If a domain is configured to start on boot, it has a symlink to the domain definition inside the autostart directory. If you rename this domain, the definition is renamed too. The symlink need to be pointed to this renamed file. This commit recreates the symlink after renaming the XML file. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1594985 Signed-off-by: Julio Faracco --- src/qemu/qemu_driver.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5de9aaefbb..15abb861ec 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -20914,6 +20914,8 @@ qemuDomainRenameCallback(virDomainObjPtr vm, char *old_dom_name =3D NULL; char *new_dom_cfg_file =3D NULL; char *old_dom_cfg_file =3D NULL; + char *new_dom_autostart_link =3D NULL; + char *old_dom_autostart_link =3D NULL; =20 virCheckFlags(0, ret); =20 @@ -20934,6 +20936,30 @@ qemuDomainRenameCallback(virDomainObjPtr vm, vm->def->name))) goto cleanup; =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; + + if (unlink(old_dom_autostart_link) < 0 && + errno !=3D ENOENT && + errno !=3D ENOTDIR) { + virReportSystemError(errno, + _("Failed to delete symlink '%s'"), + old_dom_autostart_link); + goto cleanup; + } + + 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_f= ile); + goto cleanup; + } + } + event_old =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_UNDEFINED, VIR_DOMAIN_EVENT_UNDEFINED_REN= AMED); @@ -20960,6 +20986,8 @@ qemuDomainRenameCallback(virDomainObjPtr vm, ret =3D 0; =20 cleanup: + VIR_FREE(old_dom_autostart_link); + VIR_FREE(new_dom_autostart_link); VIR_FREE(old_dom_cfg_file); VIR_FREE(new_dom_cfg_file); VIR_FREE(old_dom_name); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list