Page MenuHomeVyOS Platform

Check if there's enough drive space for an upgrade before downloading an image
In progress, LowPublicBUG

Description

Ever since the first Vyatta versions that supported image upgrade (that's 6.0/Larkspur for the curious), when a user runs add system image https://example.com/vyos-1.3.0-amd64.iso, the update script:

  • Downloads the image without caching it.
  • Checks if there's enough space for the upgrade.
  • Performs the upgrade.

This is alright if there's enough drive space for the upgrade. If not, it's:

  • Annoying because you need to repeat the procedure.
  • Time-consuming on slow links.
  • Expensive on metered connections.

Checking free space _before_ downloading would be a big UX improvement in that case.

We can do it the following way:

  1. Try an HTTP HEAD request for the image URL.
  2. If that request succeeds and returns a Content-Length header, then calculate the required space precisely based on that data.
  3. If there's no Content-Length in the response (or the protocol doesn't have an equivalent of HEAD and Content-Length), then use some heuristic, e.g. 500M, and do a precise check after the image is downloaded.

Details

Difficulty level
Normal (likely a few hours)
Version
1.3.0-rc3
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible

Event Timeline

erkin changed the task status from Open to In progress.Thu, May 6, 7:54 AM
erkin triaged this task as Low priority.