diff --git a/.github/workflows/test-using-pytest.yml b/.github/workflows/test-using-pytest.yml index e618ab71f..3b8cb97a8 100644 --- a/.github/workflows/test-using-pytest.yml +++ b/.github/workflows/test-using-pytest.yml @@ -52,7 +52,8 @@ jobs: chmod +x /opt/firecracker/firecracker chmod +x /opt/firecracker/jailer - find /opt + # this produces a 33 MB log + # find /opt - name: "Build custom runtimes" run: | @@ -71,6 +72,11 @@ jobs: run: | sudo python3 -m pip install hatch hatch-vcs coverage sudo hatch run testing:cov + - name: Output modules used and their version + if: always() + run: | + sudo hatch -e testing run pip freeze + - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.0.1 diff --git a/pyproject.toml b/pyproject.toml index 67850ab88..ff5e8e382 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,6 +87,7 @@ check = "aleph-vm controller run {args:--help}" type = "virtual" system-packages = true dependencies = [ + "eth_typing==4.3.1", # Temp fix for bug in CI with 5.0.0 "pytest==8.2.1", "pytest-cov==5.0.0", "pytest-mock==3.14.0", diff --git a/src/aleph/vm/controllers/qemu/instance.py b/src/aleph/vm/controllers/qemu/instance.py index e3c2e5435..be4e2def2 100644 --- a/src/aleph/vm/controllers/qemu/instance.py +++ b/src/aleph/vm/controllers/qemu/instance.py @@ -166,7 +166,7 @@ async def configure(self): """Configure the VM by saving controller service configuration""" logger.debug(f"Making Qemu configuration: {self} ") - monitor_socket_path = settings.EXECUTION_ROOT / (str(self.vm_id) + "-monitor.socket") + monitor_socket_path = settings.EXECUTION_ROOT / (str(self.vm_hash) + "-monitor.socket") cloud_init_drive = await self._create_cloud_init_drive() @@ -218,7 +218,7 @@ def save_controller_configuration(self): @property def qmp_socket_path(self) -> Path: - return settings.EXECUTION_ROOT / f"{self.vm_id}-qmp.socket" + return settings.EXECUTION_ROOT / f"{self.vm_hash}-qmp.socket" async def start(self): # Start via systemd not here diff --git a/src/aleph/vm/models.py b/src/aleph/vm/models.py index 6f87b2363..6d6b77d97 100644 --- a/src/aleph/vm/models.py +++ b/src/aleph/vm/models.py @@ -96,6 +96,10 @@ def is_running(self) -> bool: else bool(self.times.starting_at and not self.times.stopping_at) ) + @property + def is_allocated(self) -> bool: + return bool(self.times.starting_at and not self.times.stopping_at) + @property def is_stopping(self) -> bool: return bool(self.times.stopping_at and not self.times.stopped_at) diff --git a/src/aleph/vm/pool.py b/src/aleph/vm/pool.py index 01e5afd72..2ecb673df 100644 --- a/src/aleph/vm/pool.py +++ b/src/aleph/vm/pool.py @@ -161,7 +161,9 @@ def get_unique_vm_id(self) -> int: # # We therefore recycle vm_id values from executions that are not running # anymore. - currently_used_vm_ids = {execution.vm_id for execution in self.executions.values() if execution.is_running} + currently_used_vm_ids = { + execution.vm_id for execution in self.executions.values() if execution.is_allocated + } for i in range(settings.START_ID_INDEX, 255**2): if i not in currently_used_vm_ids: return i