aleph-im / aleph-vm

Aleph.im VM execution engine
MIT License
43 stars 18 forks source link

Problem: FirecrackerVM not working if /var/lib and /var/cache on two … #682

Closed olethanh closed 2 months ago

olethanh commented 2 months ago

…separate partion

The prepare step for jailer was failing because it couldn't create a link to rootfs file when the CACHE and EXECUTION were not on the same partition

This was due do trying to make a hardlink instead of as soft symlink (contrary to what the docstring indicated)

Solution: Make a symlink

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.

Project coverage is 61.31%. Comparing base (0b4fbfd) to head (35f6227). Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/aleph/vm/hypervisors/firecracker/microvm.py 16.66% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #682 +/- ## ========================================== - Coverage 61.43% 61.31% -0.12% ========================================== Files 68 68 Lines 5985 5990 +5 Branches 632 634 +2 ========================================== - Hits 3677 3673 -4 - Misses 2155 2163 +8 - Partials 153 154 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hoh commented 2 months ago

What would happen if the cache is cleared while a VM is working and using a file stored there then ? With hardlinks, this would not be an issue since the file would still exist.

olethanh commented 2 months ago

After @nesitor feedback and more testing I have found a workaround: Do a copy if we can't do a link. Tested and it works properly

olethanh commented 2 months ago

What would happen if the cache is cleared while a VM is working and using a file stored there then ? With hardlinks, this would not be an issue since the file would still exist.

While the VM is working the file is open, and as long as a program has a fd to a file Linux won't actually delete it from the disk so it isn't a problem. But anyway we don't use a symlink anymore