From owner-svn-src-projects@FreeBSD.ORG Thu Dec 8 05:24:26 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C860106564A; Thu, 8 Dec 2011 05:24:26 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82B5B8FC08; Thu, 8 Dec 2011 05:24:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB85OQcm071968; Thu, 8 Dec 2011 05:24:26 GMT (envelope-from linimon@svn.freebsd.org) Received: (from linimon@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB85OQ0Z071966; Thu, 8 Dec 2011 05:24:26 GMT (envelope-from linimon@svn.freebsd.org) Message-Id: <201112080524.pB85OQ0Z071966@svn.freebsd.org> From: Mark Linimon Date: Thu, 8 Dec 2011 05:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228345 - projects/portbuild/scripts X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 05:24:26 -0000 Author: linimon (doc,ports committer) Date: Thu Dec 8 05:24:26 2011 New Revision: 228345 URL: http://svn.freebsd.org/changeset/base/228345 Log: When I laid out the svn dirs on pointyhat-west, I put in one more level of directories. Update the expiry list to take this into account. While here, add debugging and verbosity. Modified: projects/portbuild/scripts/zexpire Modified: projects/portbuild/scripts/zexpire ============================================================================== --- projects/portbuild/scripts/zexpire Thu Dec 8 03:20:48 2011 (r228344) +++ projects/portbuild/scripts/zexpire Thu Dec 8 05:24:26 2011 (r228345) @@ -8,23 +8,30 @@ sys.path.insert(0, '/var/portbuild/lib/p import zfs +ENABLED = True +VERBOSE= True + # List of filesystems to expire expirelist=(("a", 14), - ("a/nfs", 14), - ("a/local", 14), ("a/portbuild", 14), ("a/portbuild/amd64", 14), + ("a/portbuild/arm", 14), ("a/portbuild/i386", 14), ("a/portbuild/ia64", 14), ("a/portbuild/powerpc", 14), ("a/portbuild/sparc64", 14), + ("a/portbuild/sun4v", 14), ("a/snap", 7), - ("a/snap/ports", 2), + ("a/snap/ports-head", 2), + ("a/snap/ports-head/ports", 2), ("a/snap/src-7", 2), + ("a/snap/src-7/src", 2), ("a/snap/src-8", 2), + ("a/snap/src-8/src", 2), ("a/snap/src-9", 2), - ("a/snap/world-amd64-HEAD", 7), - ("a/snap/world-i386-HEAD", 7)) + ("a/snap/src-9/src", 2), + ("a/snap/src-10", 2), + ("a/snap/src-10/src", 2)) now = datetime.datetime.now() print "zexpire: starting at " + now.ctime() @@ -32,10 +39,15 @@ print "zexpire: starting at " + now.ctim for (fs, maxage) in expirelist: print + if VERBOSE: + print "fs: " + str(fs) try: + # XXX MCL 20111205 produces nothing! snapdata = zfs.getallsnaps(fs) + if VERBOSE: + print "snapdata: " + str(snapdata) except zfs.NoSuchFS: - print "no such fs %s, skipping" % fs + print "zexpire: no such fs %s, skipping" % fs continue snaps = (i[0] for i in snapdata) @@ -50,12 +62,15 @@ for (fs, maxage) in expirelist: print "zexpire: don't know what to do with snap `" + snap + "'" continue + if VERBOSE: + print "zexpire: examining snapshot %s@%s" % (fs, snap) if (now - snapdate) > datetime.timedelta(days=maxage): - print "Snapshot %s@%s too old, attempting zfs destroy" % (fs, snap) - (err, out) = commands.getstatusoutput("zfs destroy %s@%s" % (fs,snap)) + print "zexpire: snapshot %s@%s too old, attempting zfs destroy" % (fs, snap) + if ENABLED: + (err, out) = commands.getstatusoutput("zfs destroy %s@%s" % (fs,snap)) - if err: - print "Error deleting snapshot", out + if err: + print "zexpire: error deleting snapshot", out then = datetime.datetime.now() print