Index: /trunk/src/VBox/ValidationKit/testmanager/config.py
===================================================================
--- /trunk/src/VBox/ValidationKit/testmanager/config.py	(revision 83414)
+++ /trunk/src/VBox/ValidationKit/testmanager/config.py	(revision 83415)
@@ -90,4 +90,6 @@
 ## File on the build binary share that can be used to check that it's mounted.
 g_ksBuildBinRootFile    = 'builds.txt'
+## Template for paratial database dump files.  One argument: UID
+g_ksTmDbDumpFileTemplate = '/var/tmp/tm-partial-db-dump-for-%u.zip'
 ## @}
 
@@ -142,4 +144,17 @@
 g_kcMaxUploads          = 256;
 ## @}
+
+
+## @name Partial Database Dump
+## @{
+
+## Minimum number of day.  Set higher than g_kcTmDbDumpMaxDays to disable.
+g_kcTmDbDumpMinDays     = 1;
+## Maximum number of day.  Keep low - consider space and runtime.
+g_kcTmDbDumpMaxDays     = 31;
+## The default number of days.
+g_kcTmDbDumpDefaultDays = 14;
+## @}
+
 
 ## @name Debug Features
Index: /trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py
===================================================================
--- /trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py	(revision 83414)
+++ /trunk/src/VBox/ValidationKit/testmanager/webui/wuiadmin.py	(revision 83415)
@@ -35,5 +35,5 @@
 
 # Validation Kit imports.
-from common                                    import webutils
+from common                                    import utils, webutils;
 from testmanager                               import config;
 from testmanager.webui.wuibase                 import WuiDispatcherBase, WuiException
@@ -55,4 +55,6 @@
     ksActionSystemLogList           = 'SystemLogList'
     ksActionSystemChangelogList     = 'SystemChangelogList'
+    ksActionSystemDbDump            = 'SystemDbDump'
+    ksActionSystemDbDumpDownload    = 'SystemDbDumpDownload'
 
     ksActionUserList                = 'UserList'
@@ -167,8 +169,10 @@
 
         #
-        # System Log actions.
+        # System actions.
         #
         self._dDispatch[self.ksActionSystemChangelogList]       = self._actionSystemChangelogList;
         self._dDispatch[self.ksActionSystemLogList]             = self._actionSystemLogList;
+        self._dDispatch[self.ksActionSystemDbDump]              = self._actionSystemDbDump;
+        self._dDispatch[self.ksActionSystemDbDumpDownload]      = self._actionSystemDbDumpDownload;
 
         #
@@ -345,4 +349,5 @@
                     [ 'Changelog',              self._sActionUrlBase + self.ksActionSystemChangelogList,    False ],
                     [ 'System log',             self._sActionUrlBase + self.ksActionSystemLogList,          False ],
+                    [ 'Partial DB Dump',        self._sActionUrlBase + self.ksActionSystemDbDump,           False ],
                     [ 'User accounts',          self._sActionUrlBase + self.ksActionUserList,               False ],
                     [ 'New user',               self._sActionUrlBase + self.ksActionUserAdd,                True  ],
@@ -423,5 +428,5 @@
 
     def _actionSystemChangelogList(self):
-        """ Action wrapper. """
+        """ Action handler. """
         from testmanager.core.systemchangelog          import SystemChangelogLogic;
         from testmanager.webui.wuiadminsystemchangelog import WuiAdminSystemChangelogList;
@@ -447,4 +452,68 @@
         from testmanager.webui.wuiadminsystemlog       import WuiAdminSystemLogList;
         return self._actionGenericListing(SystemLogLogic, WuiAdminSystemLogList)
+
+    def _actionSystemDbDump(self):
+        """ Action handler. """
+        from testmanager.webui.wuiadminsystemdbdump    import WuiAdminSystemDbDumpForm;
+
+        cDaysBack = self.getIntParam(self.ksParamDaysBack, iMin = config.g_kcTmDbDumpMinDays,
+                                     iMax = config.g_kcTmDbDumpMaxDays, iDefault = config.g_kcTmDbDumpDefaultDays);
+        self._checkForUnknownParameters();
+
+        oContent = WuiAdminSystemDbDumpForm(cDaysBack, oDisp = self);
+        (self._sPageTitle, self._sPageBody) = oContent.showForm();
+        return True;
+
+    def _actionSystemDbDumpDownload(self):
+        """ Action handler. """
+        import datetime;
+        import os;
+
+        cDaysBack = self.getIntParam(self.ksParamDaysBack, iMin = config.g_kcTmDbDumpMinDays,
+                                     iMax = config.g_kcTmDbDumpMaxDays, iDefault = config.g_kcTmDbDumpDefaultDays);
+        self._checkForUnknownParameters();
+
+        #
+        # Generate the dump.
+        #
+        # We generate a file name that's unique to a user is smart enough to only
+        # issue one of these requests at the time.  This also makes sure we  won't
+        #  waste too much space should this code get interrupted and rerun.
+        #
+        oFile    = None;
+        oNow     = datetime.datetime.utcnow();
+        sTmpFile = config.g_ksTmDbDumpFileTemplate % (self._oCurUser.uid,);
+        sScript  = os.path.join(config.g_ksTestManagerDir, 'db', 'partial-db-dump.py');
+        try:
+            (iExitCode, sStdOut, sStdErr) = utils.processOutputUnchecked([sScript, '--days-to-dump', str(cDaysBack),
+                                                                          '-f', sTmpFile,]);
+            if iExitCode != 0:
+                raise Exception('iExitCode=%s\n--- stderr ---\n%s\n--- stdout ---\n%s' % (iExitCode, sStdOut, sStdErr,));
+
+            #
+            # Open and send the dump.
+            #
+            oFile = open(sTmpFile, 'rb');
+            cbFile = os.fstat(oFile.fileno()).st_size;
+
+            self._oSrvGlue.setHeaderField('Content-Type', 'application/zip');
+            self._oSrvGlue.setHeaderField('Content-Disposition',
+                                          oNow.strftime('attachment; filename="partial-db-dump-%Y-%m-%dT%H-%M-%S.zip"'));
+            self._oSrvGlue.setHeaderField('Content-Length', str(cbFile));
+
+            while True:
+                abChunk = oFile.read(262144);
+                if not abChunk:
+                    break;
+                self._oSrvGlue.writeRaw(abChunk);
+
+        finally:
+            # Delete the file to save space.
+            if oFile:
+                try:    oFile.close();
+                except: pass;
+            utils.noxcptDeleteFile(sTmpFile);
+        return self.ksDispatchRcAllDone;
+
 
     # User Account actions.
Index: /trunk/src/VBox/ValidationKit/testmanager/webui/wuiadminsystemdbdump.py
===================================================================
--- /trunk/src/VBox/ValidationKit/testmanager/webui/wuiadminsystemdbdump.py	(revision 83415)
+++ /trunk/src/VBox/ValidationKit/testmanager/webui/wuiadminsystemdbdump.py	(revision 83415)
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+# $Id$
+
+"""
+Test Manager WUI - System DB - Partial Dumping
+"""
+
+__copyright__ = \
+"""
+Copyright (C) 2012-2020 Oracle Corporation
+
+This file is part of VirtualBox Open Source Edition (OSE), as
+available from http://www.virtualbox.org. This file is free software;
+you can redistribute it and/or modify it under the terms of the GNU
+General Public License (GPL) as published by the Free Software
+Foundation, in version 2 as it comes in the "COPYING" file of the
+VirtualBox OSE distribution. VirtualBox OSE is distributed in the
+hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
+
+The contents of this file may alternatively be used under the terms
+of the Common Development and Distribution License Version 1.0
+(CDDL) only, as it comes in the "COPYING.CDDL" file of the
+VirtualBox OSE distribution, in which case the provisions of the
+CDDL are applicable instead of those of the GPL.
+
+You may elect to license modified versions of this file under the
+terms and conditions of either the GPL or the CDDL or both.
+"""
+__version__ = "$Revision$"
+
+
+# Validation Kit imports.
+from testmanager.core.base              import ModelDataBase;
+from testmanager.webui.wuicontentbase   import WuiFormContentBase;
+
+
+class WuiAdminSystemDbDumpForm(WuiFormContentBase):
+    """
+    WUI Partial DB Dump HTML content generator.
+    """
+
+    def __init__(self, cDaysBack, oDisp):
+        WuiFormContentBase.__init__(self, ModelDataBase(),
+                                    WuiFormContentBase.ksMode_Edit, 'DbDump', oDisp, 'Partial DB Dump',
+                                    sSubmitAction = oDisp.ksActionSystemDbDumpDownload);
+        self._cDaysBack = cDaysBack;
+
+    def _generateTopRowFormActions(self, oData):
+        _ = oData;
+        return [];
+
+    def _populateForm(self, oForm, oData): # type: (WuiHlpForm, SchedGroupDataEx) -> bool
+        """
+        Construct an HTML form
+        """
+        _ = oData;
+
+        oForm.addInt(self._oDisp.ksParamDaysBack, self._cDaysBack, 'How many days back to dump');
+        oForm.addSubmit('Produce & Download');
+
+        return True;
+
+
+
