Skip to content

Commit 4e7efa0

Browse files
olethanhnesitor
authored andcommitted
Address review comment
1 parent 718812e commit 4e7efa0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/aleph/vm/models.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ async def fetch_port_redirect_config_and_setup(self):
104104
message = self.message
105105
try:
106106
port_forwarding_settings = await get_user_settings(message.address, "port-forwarding")
107-
ports_requests = port_forwarding_settings.get(self.vm_hash)
107+
ports_requests = port_forwarding_settings.get(self.vm_hash, {})
108108

109109
except Exception:
110110
ports_requests = {}
111-
logger.exception("Could not fetch the port redirect settings for user")
112-
if not ports_requests:
113-
# FIXME DEBUG FOR NOW
114-
ports_requests = {22: {"tcp": True, "udp": False}}
115-
ports_requests = ports_requests or {}
111+
logger.info("Could not fetch the port redirect settings for user %s", message.address, exc_info=True)
112+
113+
# Always forward port 22
114+
ports_requests[22] = {"tcp": True, "udp": False}
115+
116116
await self.update_port_redirects(ports_requests)
117117

118118
async def update_port_redirects(self, requested_ports: dict[int, dict[str, bool]]):

src/aleph/vm/pool.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,15 @@ async def load_persistent_executions(self):
307307
await vm.start_guest_api()
308308
execution.ready_event.set()
309309
execution.times.started_at = datetime.now(tz=timezone.utc)
310+
execution.times.starting_at = saved_execution.time_prepared
311+
execution.times.prepared_at = saved_execution.time_defined
310312

311313
self._schedule_forget_on_stop(execution)
312314

313315
# Start the snapshot manager for the VM
314316
if vm.support_snapshot and self.snapshot_manager:
315317
await self.snapshot_manager.start_for(vm=execution.vm)
318+
await execution.fetch_port_redirect_config_and_setup()
316319

317320
self.executions[vm_hash] = execution
318321
else:

0 commit comments

Comments
 (0)