-
Notifications
You must be signed in to change notification settings - Fork 61
Check disk space before downloading files. #1520
Conversation
188afab
to
4bcf603
Compare
Codecov Report
@@ Coverage Diff @@
## master #1520 +/- ##
==========================================
+ Coverage 80.74% 80.85% +0.11%
==========================================
Files 184 184
Lines 11181 11195 +14
==========================================
+ Hits 9028 9052 +24
+ Misses 2153 2143 -10
Continue to review full report at Codecov.
|
Signed-off-by: Patrick Vacek <[email protected]>
4bcf603
to
d56dd03
Compare
Codecov Report
@@ Coverage Diff @@
## master #1520 +/- ##
==========================================
+ Coverage 80.74% 80.95% +0.21%
==========================================
Files 184 184
Lines 11181 11196 +15
==========================================
+ Hits 9028 9064 +36
+ Misses 2153 2132 -21
Continue to review full report at Codecov.
|
@@ -184,6 +184,7 @@ class INvStorage { | |||
virtual void saveEcuReportCounter(const Uptane::EcuSerial& ecu_serial, int64_t counter) = 0; | |||
virtual bool loadEcuReportCounter(std::vector<std::pair<Uptane::EcuSerial, int64_t>>* results) = 0; | |||
|
|||
virtual bool checkAvailableDiskSpace(uint64_t required_bytes) const = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one minor remark, regarding the "checkAvailableDiskSpace" function, is it really necessary to make this function pure virtual in the "invstorage" interface?
I suspect this function will be called quite often, does it make sense to increase virtual table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I have a choice here. We only have one fully functional storage implementation at present, but I think this depends on the specific implementation. For SQL, we store the files on disk in the same directory as the database, so I know I can check the filesystem that all that lives on. But a different implementation might do something else, like use multiple partitions, and then my current logic would have to be adapted to that.
There is no reason to download a file that we don't have space for on disk. I've set 1MB as reserved so that we can still (hopefully) do the database operations to let libaktualizr send a manifest to the server.
This should help with the problems observed with non-OSTree images (see advancedtelematic/meta-updater#637) when additional overhead isn't provided to the qemu image.