[OpenAFS] format vos/fs/pts output

Jeff Blaine jblaine@kickflop.net
Mon, 28 Jun 2010 20:14:59 -0400

On 6/28/2010 7:51 PM, Jonathan Nilsson wrote:
> Hello,
> I'd like to write (bash) scripts that can parse the output of the AFS
> command suite, and I was wondering if there are any output format flags
> for the fs/pts/vos commands?
> The only one I've discovered is "vos examine <volume> -format" which
> isn't documented anywhere and has some bugs, but it was referenced in a
> discussion on this list back on April 13th/14th 2010:
> http://www.mail-archive.com/openafs-info@openafs.org/msg31746.html
> That same thread also mentions a "-printuuid" flag, but that didn't work
> for me.
> I realize I'm asking a very general question, so if it helps, here is
> one scenario I'm thinking of: quota reports (find all volumes on a
> particular server or in the entire cell that are above 75% quota usage).
> As I see it, I would have to use "vos listvldb" or "vos listvol" to get
> a list of all volumes, then "vos examine <volume> -format" and do some math.
> The quota report scenario could be simplified if I could, with one
> command, just output the name, diskused and maxquota information.
> Any thoughts or opinions welcome, thanks!

Don't do it with bash.

Perl is everywhere (AFSPerl)


Python is most everywhere (yours truly):


For Example:

     Quota-committal-based version of 'vos partinfo'

     This tool displays output similar to the output of 'vos partinfo'
     but instead of showing 'K free' on a partition, it shows the number
     of K uncommitted quota-wise.  That is, when volumes are created,
     they are assigned a quota, and as such, that space should be 
     marked as unavailable space, even if the volume is not full of data.
     This tool will show you how much space is "truly" free for your
     committal to a new or different volume on the same partition.
... SNIP - argument processing code here ...
qpidata = afs_quotapartinfo.QuotaPartinfoData(server, partition)
if qpidata.load(cache_dir, cache_threshold_hours):
     if syslogflag:
     print "ERROR: Could not load/gather data."