Hi list !

It seems that a typo has made its way into the core of the modern Internet:

MogileFS/Worker/Query.pm, line 279

   # make sure directories exist for client to be able to PUT into
    foreach my $dev (@dests) {
        $profstart->("vivify_dir_on_dev" . $dev->id);
        my $dfid = MogileFS::DevFID->new($dev, $fidid);
        $dfid->vivify_directories;
    }

In other words, vivify_directories is missing some calling convention :p

Anyway, adding them parenthesis seems to be the only thing required to make
my  2.17 setup use lighttpd instead of mogstored, apart from the "usage"
file
generation, for which I used the included silly python script.

Stefan
#!/usr/bin/python
import os, dircache, statvfs, time

root="/var/mogdata"

mtab = {}
for l in open("/etc/mtab").readlines():
    vals = l.split(' ')
    mtab[vals[1]] = vals[0]

for dev in dircache.listdir(root):
    name = root + "/" + dev
    s = os.statvfs(name)
    bs = s[statvfs.F_BSIZE]
    mul = float(bs) / 1024.0
    avail_to_root =  long(s[statvfs.F_BFREE] * mul)
    avail = long(s[statvfs.F_BAVAIL] * mul)
    total = long(s[statvfs.F_BLOCKS] * mul)
    used = total-avail_to_root
    # use df's own weird 'used percentage' routine
    u100 = used * 100
    nonroot_total = used + avail
    pct = u100 / nonroot_total + (u100 % nonroot_total != 0)
    tmpusage = name + "/usage.tmp"
    outf = open(tmpusage, "w")
    print >>outf,"available:", avail
    print >>outf,"device:",mtab[name]
    print >>outf,"disk:",name
    print >>outf,"time:",long(time.time())
    print >>outf,"total:",total
    print >>outf,"use: %d%%" % (pct)
    print >>outf,"used:",used
    outf.close()
    usage = name + "/usage"
    os.system("mv %s %s" % (tmpusage, usage))
    os.system("chmod a+r,ug+w %s" % (usage))

Reply via email to