#1285 new defect

SFTP: put an approximation of grid capacity and available space in the 'df' output

Reported by: davidsarah Owned by:
Priority: normal Milestone: undecided
Component: code-frontend-ftp-sftp Version: 1.8.1
Keywords: usability statistics sftp ostrom Cc:
Launchpad Bug:

Description (last modified by warner)

Ticket #648 is about collecting server capacities and putting them on the welcome page. This might also allow a better approximation of available space than what SFTP currently outputs for 'df'.

Because the SFTP protocol did not originally have a way of implementing 'df', clients use either an extension (implemented at sftpd.py SftpUserHandler.extendedRequest) or try to log in to the server and issue a 'df' command (implemented in sftpd.py ShellSession.execCommand). sshfs does the latter, and will not mount the filesystem if it cannot do so. Currently we always report 314159265 KiB free, and double that capacity, to keep sshfs happy.

However, even given the space available on each server, it is not entirely obvious what to report as the total space available on the filesystem. Brian wrote in ticket #648:

Wait, what? What's the relationship between server-space available and the number that SFTP reports as available to any given client? Not trivial, I think.

If we do this, let's make it clear that we're providing only a very rough approximation of the client-side space. Adding together all of the raw server space and dividing by the expansion factor is pretty rough, especially with the servers-of-happiness change (e.g. one server has 14TB free, but you can't upload anything because everyone else is full: SFTP should announce 0).

Also let's make room for Accounting APIs to generate this data (since really it's a function of accounting: how much space an individual "user" is allowed to consume, which may be far less than the sum of all server capacities). At least let's be thinking in that direction when we name the functions.

Attachments (1)

delegate-grid-stats-calculation-to-client.darcs.patch (11.6 KB) - added by davidsarah at 2010-12-30T04:52:08Z.
Move responsibility for calculating the estimated total/used/available space on a grid as used by SFTP to client.py.

Download all attachments as: .zip

Change History (8)

comment:1 Changed at 2010-12-30T02:32:59Z by davidsarah

Proposed method of calculating the grid capacity and available space:

H = shares.happy
if number_of_servers < H:
    total_available = 0
else:
    available = get_available_space_on_each_server()
    available.sort(reversed=True)
    for i in range(0, H-1):
        # don't count the H-1 servers with most available space
        # as having any more space than the H'th
        available[i] = available[H-1]

    total_available = sum(available)/expansion

total_capacity = total_available + sum(get_used_space_on_each_server())/expansion

The rationale here is that the H servers with most available space are likely to fill up last, and when the H'th of those servers fills up, any extra space on the remaining H-1 that have more space will be unusable. (Implementing #872 would improve this situation.)

comment:2 follow-up: Changed at 2010-12-30T04:44:29Z by davidsarah

Hmm, do we have any way of implementing get_used_space_on_each_server()? I don't think we do (but that would be part of #648).

Changed at 2010-12-30T04:52:08Z by davidsarah

Move responsibility for calculating the estimated total/used/available space on a grid as used by SFTP to client.py.

comment:3 in reply to: ↑ 2 Changed at 2010-12-30T09:36:22Z by zooko

Replying to davidsarah:

Hmm, do we have any way of implementing get_used_space_on_each_server()? I don't think we do (but that would be part of #648).

Figuring out how much space your local storage server is using is #671.

Last edited at 2010-12-30T09:37:12Z by zooko (previous) (diff)

comment:4 Changed at 2011-01-15T22:14:21Z by davidsarah

  • Keywords design-review-needed added

comment:5 Changed at 2012-04-01T05:02:05Z by davidsarah

  • Priority changed from major to normal

comment:6 Changed at 2012-05-14T01:32:02Z by davidsarah

  • Keywords design-review-needed removed

comment:7 Changed at 2014-12-02T19:48:28Z by warner

  • Component changed from code-frontend to code-frontend-ftp-sftp
  • Description modified (diff)
Note: See TracTickets for help on using tickets.