From nobody Fri May 3 06:06:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560951508; cv=none; d=zoho.com; s=zohoarc; b=V3LEkCY9XhYQexDsWuc25GskuFXZbsiv1HWZOPHxeuZLha3JaQiOh0CpLRWKJva+5U+OPLhUISQeyYI9tvOkrDdZFea/5Z3TWxqnJQ4s1fyKoEZIkJXRzvih/WuJZDrfwTZ1cZyK9JrpUOTUqh2mJNFgiwRGkMdGG61BC5cgBbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560951508; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=acKQfY+epvqbELwrAMKNT2yDDFzEpnikz2ylCLl1FyI=; b=kYnxUlnidl0lwXeNYTh8riCEOLrWLVg/6jm5IFnrHuKSmSVnB76182YIkmw+3Rz8xurqPC9sQ09XQt1+xTGe/G/pIiuPDnDTOOYW+K9HeBOTLSNc4Jq1Wm481VTf2GYlnNCXc0XVqUppJSLrJWiO9yw+/H/YJHGJ4OxCEVd36m4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560951508578888.311412825762; Wed, 19 Jun 2019 06:38:28 -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 F0FEB30BB559; Wed, 19 Jun 2019 13:38: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 B5D2519C6F; Wed, 19 Jun 2019 13:38: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 CD3FF1806B18; Wed, 19 Jun 2019 13:37:53 +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 x5JDbobj011559 for ; Wed, 19 Jun 2019 09:37:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id C035E1001DE4; Wed, 19 Jun 2019 13:37:50 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-48.ams2.redhat.com [10.36.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A893A1001B17; Wed, 19 Jun 2019 13:37:46 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 19 Jun 2019 14:37:43 +0100 Message-Id: <20190619133743.13244-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] remote: drop code for migrating config files from pre-XDG dir layout X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" 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.49]); Wed, 19 Jun 2019 13:38:19 +0000 (UTC) The unprivileged libvirtd daemon switched to use the XDG dir layout in the 0.9.13 release, and included code for moving config files from the old location. The chances of someone upgrading libvirt from <=3D 0.9.12 directly to libvirt >=3D 5.5.0 is close enough to zero that we can reasonably drop the back compat code. Signed-off-by: Daniel P. Berrang=C3=A9 --- src/remote/remote_daemon.c | 79 -------------------------------------- 1 file changed, 79 deletions(-) diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index c3782971f1..c1544ba914 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -845,79 +845,6 @@ static int daemonStateInit(virNetDaemonPtr dmn) return 0; } =20 -static int migrateProfile(void) -{ - char *old_base =3D NULL; - char *updated =3D NULL; - char *home =3D NULL; - char *xdg_dir =3D NULL; - char *config_dir =3D NULL; - const char *config_home; - int ret =3D -1; - mode_t old_umask; - - VIR_DEBUG("Checking if user profile needs migrating"); - - if (!(home =3D virGetUserDirectory())) - goto cleanup; - - if (virAsprintf(&old_base, "%s/.libvirt", home) < 0) - goto cleanup; - - /* if the new directory is there or the old one is not: do nothing */ - if (!(config_dir =3D virGetUserConfigDirectory())) - goto cleanup; - - if (!virFileIsDir(old_base) || virFileExists(config_dir)) { - VIR_DEBUG("No old profile in '%s' / " - "new profile directory already present '%s'", - old_base, config_dir); - ret =3D 0; - goto cleanup; - } - - /* test if we already attempted to migrate first */ - if (virAsprintf(&updated, "%s/DEPRECATED-DIRECTORY", old_base) < 0) - goto cleanup; - if (virFileExists(updated)) - goto cleanup; - - config_home =3D virGetEnvBlockSUID("XDG_CONFIG_HOME"); - if (config_home && config_home[0] !=3D '\0') { - if (VIR_STRDUP(xdg_dir, config_home) < 0) - goto cleanup; - } else { - if (virAsprintf(&xdg_dir, "%s/.config", home) < 0) - goto cleanup; - } - - old_umask =3D umask(077); - if (virFileMakePath(xdg_dir) < 0) { - umask(old_umask); - goto cleanup; - } - umask(old_umask); - - if (rename(old_base, config_dir) < 0) { - int fd =3D creat(updated, 0600); - VIR_FORCE_CLOSE(fd); - VIR_ERROR(_("Unable to migrate %s to %s"), old_base, config_dir); - goto cleanup; - } - - VIR_DEBUG("Profile migrated from %s to %s", old_base, config_dir); - ret =3D 0; - - cleanup: - VIR_FREE(home); - VIR_FREE(old_base); - VIR_FREE(xdg_dir); - VIR_FREE(config_dir); - VIR_FREE(updated); - - return ret; -} - static int daemonSetupHostUUID(const struct daemonConfig *config) { @@ -1162,12 +1089,6 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } =20 - if (!privileged && - migrateProfile() < 0) { - VIR_ERROR(_("Exiting due to failure to migrate profile")); - exit(EXIT_FAILURE); - } - if (daemonSetupHostUUID(config) < 0) { VIR_ERROR(_("Can't setup host uuid")); exit(EXIT_FAILURE); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list