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
8 changes: 7 additions & 1 deletion .github/workflows/test-using-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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/[email protected]
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/aleph/vm/controllers/qemu/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/aleph/vm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion src/aleph/vm/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down