[Dovecot] SOLVED for me: how to setup different quota for multiple namespaces

Andreas Oster aoster at novanetwork.de
Mon Feb 4 13:20:53 EET 2013


Am 04.02.2013 12:08, schrieb Steffen Kaiser:
> On Tue, 22 Jan 2013, Timo Sirainen wrote:
> 
> Hey, it works (for me) now:
> 
> namespace {
>   type = private
>   separator = .
>   prefix = archive.
>   location = mdbox:/home/%u/archive
>   #subscriptions = no
>   #list = children
> }
> 
> plugin {
>   quota = dict:User quota::ns=:proxy::quota
>   quota2 = dict:Archive quota:%u.archive:ns=archive.:proxy::quota
>   quota2_rule = *:storage=1048576
> }
> 
> Note the %u.archive _and_ ns=archive. ! The "%u.archive" is used as
> "username" in the SQL table and you require another name (primary key)
> there for both namespaces, see below. Seems to work for any type of
> namespace.
> 
> @Timo: I will going to document this setup in the Wiki unless you say
> the syntax is wrong and/or works because of a bug only.
> 
> :-)
> 
> ==================================
> 
> Old response with my debugging/findings for information only.
> 
> ====
> 
> all the name spaces use one entry in the quota dict table, hence,
> it does not work.
> 
>> On 17.1.2013, at 16.58, Andreas Oster <aoster at novanetwork.de> wrote:
> 
>>>> I just saw on important difference in the doc and this configuration:
>>>>
>>>> see
>>>> http://wiki2.dovecot.org/Quota/Configuration#Quota_for_public_namespaces
>>>>
>>>>
>>>> the ns=name syntax is for _public_ namespaces only. I just tested it
>>>> with this setup and every message is counted for both namespaces, if
>>>> delivered into INBOX or a mailbox of the Archive namespace.
> 
>> It should work for all namespaces.
> 
>>>>> plugin {
>>>>> quota = dict:User quota::proxy::quota
>>>>> quota2 = dict:Archive quota:ns=Archive.:proxy::quota
> 
>> quota = dict:User quota::ns=:proxy::quota
>> quota2 = dict:Archive quota::ns=Archive.:proxy::quota
> 
>> That should work? Worked at least in latest v2.1 hg.
> 
> I use these settings now:
> 
> # 2.1.14 (ea7e45c1da72+):
> /usr/local/dovecot-2.1.14/etc/dovecot/dovecot.conf
> # OS: Linux 2.6.32-5-amd64 x86_64 Debian 6.0.6
> 
> [snip]
> 
> dict {
>   quota =
> pgsql:/usr/local/dovecot-2.1.14/etc/dovecot/dovecot-dict-sql.conf.ext
> }
> namespace {
>   location = mdbox:/home/%u/archive
>   prefix = archive.
>   separator = .
>   type = private
> }
> plugin {
>   quota = dict:User quota::ns=:proxy::quota
>   quota2 = dict:Archive quota::ns=archive.:proxy::quota
>   quota2_rule = *:storage=1048576
>   quota_rule = *:storage=300MB
>   quota_rule2 = Trash:storage=+30M
> }
> 
> The problem is now, that there is one row in the quota dict SQL table,
> that holds the quota of an user, e.g. doveadm quota recalc executes
> these SQL statements:
> 
> 2013-02-04 11:52:07 CET LOG:  statement: BEGIN
> 2013-02-04 11:52:07 CET LOG:  statement: DELETE FROM quota WHERE
> username = 'dvtest1'
> 2013-02-04 11:52:07 CET LOG:  statement: DELETE FROM quota WHERE
> username = 'dvtest1'
> 2013-02-04 11:52:07 CET LOG:  statement: INSERT INTO quota
> (bytes,username) VALUES ('2173894','dvtest1')
> 2013-02-04 11:52:07 CET LOG:  statement: INSERT INTO quota
> (messages,username) VALUES ('89','dvtest1')
> 2013-02-04 11:52:07 CET LOG:  statement: COMMIT
> 2013-02-04 11:52:07 CET LOG:  statement: BEGIN
> 2013-02-04 11:52:07 CET LOG:  statement: DELETE FROM quota WHERE
> username = 'dvtest1'
> 2013-02-04 11:52:07 CET LOG:  statement: DELETE FROM quota WHERE
> username = 'dvtest1'
> 2013-02-04 11:52:07 CET LOG:  statement: INSERT INTO quota
> (bytes,username) VALUES ('2582','dvtest1')
> 2013-02-04 11:52:07 CET LOG:  statement: INSERT INTO quota
> (messages,username) VALUES ('2','dvtest1')
> 2013-02-04 11:52:07 CET LOG:  statement: COMMIT
> 
> Deliveries to INBOX or a folder of "archive." yields:
> 
> UPDATE quota SET bytes=bytes+1220,messages=messages+1 WHERE username =
> 'dvtest1'
> 
> This is true if I change the type of name spaces "archive" from "private"
> into "shared" or "public".
> 
> -- Steffen Kaiser
> 

Hello Steffen,

I do not use a SQL backend to store the quota information, so I guess
the %u parameter is of little use with my setup.

I have also tried to configure quota with dict and flat file, but this
also did seem not work.

Thanks

best regards

Andreas





More information about the dovecot mailing list