Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions devenv/checks/diskfree.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from __future__ import annotations

import shutil

from devenv.lib_check.types import checker
from devenv.lib_check.types import fixer

tags: set[str] = {"builtin"}
name = "there should be sufficient host disk space"


@checker
def check() -> tuple[bool, str]:
disk_total, disk_used, disk_free = shutil.disk_usage("/")
disk_gib_free = disk_free / (1024**3)

if disk_gib_free < 10000:
return (
False,
f"You have less than 10 GiB disk free ({disk_gib_free} GiB free). "
"You might start to encounter various problems when using colima.",
)

return True, ""


@fixer
def fix() -> tuple[bool, str]:
return (
False,
"""

We can't autofix this, only you can clean up your own disk.

You might want to try cleaning up unused Docker resources:
docker system prune -a
""",
)
36 changes: 0 additions & 36 deletions devenv/checks/test.py

This file was deleted.

4 changes: 4 additions & 0 deletions devenv/lib/colima.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ def start(restart: bool = False) -> ColimaStatus:
"colima",
"start",
"--verbose",
# we're overprovisioning a 512 GiB disk here which is fine because
# the disk doesn't reserve space and is copy-on-write
"--disk",
"512",
# this effectively makes the vm's resolvectl status use:
# DNS Servers: 8.8.8.8 1.1.1.1 192.168.5.2
# https://lima-vm.io/docs/config/network/user/
Expand Down