From nobody Fri May 3 00:16:45 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 1531673476722210.68430649113304; Sun, 15 Jul 2018 09:51:16 -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 57C68308402A; Sun, 15 Jul 2018 16:51: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 28CDC16D27; Sun, 15 Jul 2018 16:51: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 1501318037ED; Sun, 15 Jul 2018 16:51:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6FGmbKv032377 for ; Sun, 15 Jul 2018 12:48:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 66E2A5D969; Sun, 15 Jul 2018 16:48:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FD1A5D967 for ; Sun, 15 Jul 2018 16:48:34 +0000 (UTC) Received: from mail-vk0-f54.google.com (mail-vk0-f54.google.com [209.85.213.54]) (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 8BFB83084023 for ; Sun, 15 Jul 2018 16:48:23 +0000 (UTC) Received: by mail-vk0-f54.google.com with SMTP id b14-v6so20504529vke.13 for ; Sun, 15 Jul 2018 09:48:23 -0700 (PDT) Received: from localhost.localdomain ([177.83.73.15]) by smtp.gmail.com with ESMTPSA id v5-v6sm10005973uav.40.2018.07.15.09.48.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Jul 2018 09:48:22 -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=PzZGwLWjFIJWpG3Vdi9ob2bvUBBLcXYZHK9NfyZu/0k=; b=ICjn1rCktci+YM5RM87CyiAPeHk7KRVR7UUK4cnEKokLk4o+P/VI7cRtpmthuRQw7G 08dbD+2Kjb/c2zF6LD85AY1r+mGhLXmnJpKxveWvqCC3QjI82v2YzWfd0rKuxhWWVhDh +yLjzRYA9AZ0C2XbfaCxn83Z2AnRe4oBHj/BovJ2kEI8gLaSkpHJzXS5POK13lIfEQEf YOQT59NNQWZItunyoHzUkVCfinsC4cgGfXrilnRj7GaKnlqpa5/qtMb9JSNZg3PZ89ZS GAiEIMEJqkFj6uzJ6Nqgd4jr0Lxk9PDsqaZD7V0enRZAYmzHaSMkZgk+gK5S1piJrAg8 Cfpg== 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=PzZGwLWjFIJWpG3Vdi9ob2bvUBBLcXYZHK9NfyZu/0k=; b=H1xkwuDQOHRfXpaE2JbwGMPNHlyouR5T/eKN2NdR6FNLZv4YnnFarswYOyLOjQDRYB l2FhOE/B5XiWSlqBD5/t4wlWI0XEaBWE1KLyJS/WZry9XxCNpCrw62lxzIuiUnHAZm0m KQOrWMe3kQ2DiMxTxPhW/KnyLmrMVV/gRRZPc42I4DYl0GbUyGSJW/O4Kg/Div+dGWKK 64x5ILzdmbzlAjxqtvTW6uYFp+3izSp0n0fhDcpCOvR5t5RUO1+p3WppW1IyHK4i1Oy7 EG2BvICl1wpYelmimexNsd9lqX6x9cVs1CjgHPX26R/t+zEfbfwQ2VH4ofga+vP0rybc Hxkw== X-Gm-Message-State: AOUpUlG84DRX0n5SvmqLsY8bGxJ++r3LYYhvgIQ8Snwhn+ypPyR1Covl MQLaN+qhMQuLWnpoB4o1+fi9sQ== X-Google-Smtp-Source: AAOMgpc755WwZZbfV9aHjWrnzPl7zpIYGx6xd1eJoHypLRweVjlOAjcI2v2aUw1LsZYRQjpy3uUKew== X-Received: by 2002:a1f:654:: with SMTP id 81-v6mr7675367vkg.159.1531673302496; Sun, 15 Jul 2018 09:48:22 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Sun, 15 Jul 2018 13:48:11 -0300 Message-Id: <20180715164811.8555-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Sun, 15 Jul 2018 16:48:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Sun, 15 Jul 2018 16:48:23 +0000 (UTC) for IP:'209.85.213.54' DOMAIN:'mail-vk0-f54.google.com' HELO:'mail-vk0-f54.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.54 mail-vk0-f54.google.com 209.85.213.54 mail-vk0-f54.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2] 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.40]); Sun, 15 Jul 2018 16:51:15 +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..a4df482c9e 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