[Dovecot] SOLVED for me: how to setup different quota for multiple namespaces
Steffen Kaiser
skdovecot at smail.inf.fh-brs.de
Mon Feb 4 13:08:58 EET 2013
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQEVAwUBUQ+Wyl3r2wJMiz2NAQL2fwf/SV2SAl+lvzwN9TEEZfwtsHwTb9D7W1QH
wfoMEJLWBFp8/i+gpjhbGNWbi9P5ogqljuJvALYVIXFNfoGllJBlAEStxBhpv5Z/
xQCY5lB9nCbnGa0g2MA0DMLF+dCmQrUdP0kl7R6moXaa4tn/C40pmkxvGSJjQsFk
qMESy+cuREBSJq3SRP5g8tnlBC14dgoVfg+cWPVzOd/iQatIVQGghC5PqtLj36g3
rYJNvMZ8inGSf9pui21F9rHaN1RLeeACkAEF256Pt1lHBWKaecAhlvK+e3Ps1vru
mssHT+z50T7jee8pwjMK6NMW4IbDgeU8wv9yaf4/c5LmfVPHP6E2cA==
=D38F
-----END PGP SIGNATURE-----
More information about the dovecot
mailing list