From nobody Tue Apr 23 09:06:39 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1547086814515402.1646751331749; Wed, 9 Jan 2019 18:20:14 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 4092B4025D; Thu, 10 Jan 2019 02:20:10 +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 ED7B75C54B; Thu, 10 Jan 2019 02:20:07 +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 36F8D1832E8F; Thu, 10 Jan 2019 02:20:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0A2K33W026376 for ; Wed, 9 Jan 2019 21:20:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 573C45C578; Thu, 10 Jan 2019 02:20:03 +0000 (UTC) Received: from vhost2.laine.org (ovpn-117-126.phx2.redhat.com [10.3.117.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0847E5C54B for ; Thu, 10 Jan 2019 02:20:00 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 9 Jan 2019 21:19:55 -0500 Message-Id: <20190110021955.11360-1-laine@laine.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] network: remove stale function 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-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 10 Jan 2019 02:20:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" networkMigrateStateFiles was added nearly 5 years ago when the network state directory was moved from /var/lib/libvirt to /var/run/libvirt just prior to libvirt-1.2.4). It was only required to maintain proper state information for networks that were active during an upgrade that didn't involve rebooting the host. At this point the likelyhood of anyone upgrading their libvirt from pre-1.2.4 directly to 5.0.0 or later *without rebooting the host* is probably so close to 0 that no properly informed bookie would take *any* odds on it happening, so it seems appropriate to remove this pointless code. Signed-off-by: Laine Stump --- src/network/bridge_driver.c | 92 ------------------------------------- 1 file changed, 92 deletions(-) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index aed80c04d5..8a16e50feb 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -559,92 +559,6 @@ firewalld_dbus_filter_bridge(DBusConnection *connectio= n ATTRIBUTE_UNUSED, #endif =20 =20 -static int -networkMigrateStateFiles(virNetworkDriverStatePtr driver) -{ - /* Due to a change in location of network state xml beginning in - * libvirt 1.2.4 (from /var/lib/libvirt/network to - * /var/run/libvirt/network), we must check for state files in two - * locations. Anything found in the old location must be written - * to the new location, then erased from the old location. (Note - * that we read/write the file rather than calling rename() - * because the old and new state directories are likely in - * different filesystems). - */ - int ret =3D -1; - const char *oldStateDir =3D LOCALSTATEDIR "/lib/libvirt/network"; - DIR *dir; - int direrr; - struct dirent *entry; - char *oldPath =3D NULL, *newPath =3D NULL; - char *contents =3D NULL; - int rc; - - if ((rc =3D virDirOpenIfExists(&dir, oldStateDir)) <=3D 0) - return rc; - - if (virFileMakePath(driver->stateDir) < 0) { - virReportSystemError(errno, _("cannot create directory %s"), - driver->stateDir); - goto cleanup; - } - - while ((direrr =3D virDirRead(dir, &entry, oldStateDir)) > 0) { - if (entry->d_type !=3D DT_UNKNOWN && - entry->d_type !=3D DT_REG) - continue; - - if (virAsprintf(&oldPath, "%s/%s", - oldStateDir, entry->d_name) < 0) - goto cleanup; - - if (entry->d_type =3D=3D DT_UNKNOWN) { - struct stat st; - - if (lstat(oldPath, &st) < 0) { - virReportSystemError(errno, - _("failed to stat network status file= '%s'"), - oldPath); - goto cleanup; - } - - if (!S_ISREG(st.st_mode)) { - VIR_FREE(oldPath); - continue; - } - } - - if (virFileReadAll(oldPath, 1024*1024, &contents) < 0) - goto cleanup; - - if (virAsprintf(&newPath, "%s/%s", - driver->stateDir, entry->d_name) < 0) - goto cleanup; - if (virFileWriteStr(newPath, contents, S_IRUSR | S_IWUSR) < 0) { - virReportSystemError(errno, - _("failed to write network status file '%= s'"), - newPath); - goto cleanup; - } - - unlink(oldPath); - VIR_FREE(oldPath); - VIR_FREE(newPath); - VIR_FREE(contents); - } - if (direrr < 0) - goto cleanup; - - ret =3D 0; - cleanup: - VIR_DIR_CLOSE(dir); - VIR_FREE(oldPath); - VIR_FREE(newPath); - VIR_FREE(contents); - return ret; -} - - /** * networkStateInitialize: * @@ -691,12 +605,6 @@ networkStateInitialize(bool privileged, LOCALSTATEDIR "/lib/libvirt/radvd") < 0) goto error; =20 - /* migration from old to new location is only applicable for - * privileged mode - unprivileged mode directories haven't - * changed location. - */ - if (networkMigrateStateFiles(network_driver) < 0) - goto error; } else { configdir =3D virGetUserConfigDirectory(); rundir =3D virGetUserRuntimeDirectory(); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list