On Tue, Sep 24, 2013 at 09:37:18AM -0700, Shih-Hao Li wrote: > From: Shih-Hao Li <shi...@vmware.com> > > When output to a file, only allow 90% of the free disk space to be used.
This seems like a good idea. The code to check for free space and then subtract the amount used if it is allowable is repeated a couple of times. A helper function might be a good idea. One could also improve the error message in the failure case (the user will likely want to know how big an amount was attempted and the size of the cap). It might be worth documenting how to avoid the cap if the user really wants to (it looks like outputting to a fd instead of a file avoids it?). ... > +def get_free_disk_space(path): > + path = os.path.abspath(path) > + while not os.path.ismount(path): > + path = os.path.dirname(path) > + s = os.statvfs(path) > + return s.f_frsize * s.f_bfree What is the reason for chaining up to a mount point? All the documentation I see says that statvfs returns information about the file system containing the provided path and doesn't mention special importance of mount points. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev