Skip to content

Commit c9654fe

Browse files
nesitorhoh
authored andcommitted
Fixed incorrect IP value to check on init (#375)
1 parent 7c8c120 commit c9654fe

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

vm_supervisor/vm/firecracker/instance.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,22 @@ async def setup(self):
118118

119119
async def wait_for_init(self) -> None:
120120
"""Wait for the init process of the instance to be ready."""
121-
if not self.vm_configuration:
122-
raise ValueError("The VM has not been configured yet")
121+
assert (
122+
self.enable_networking and self.tap_interface
123+
), f"Network not enabled for VM {self.vm_id}"
124+
125+
ip = self.get_vm_ip()
126+
if not ip:
127+
raise ValueError("Host IP not available")
123128

124-
if not self.vm_configuration.ip:
125-
raise ValueError("VM IP address not set")
129+
ip = ip.split("/", 1)[0]
126130

127-
attempts = 5
131+
attempts = 10
128132
timeout_seconds = 1.0
129133

130134
for attempt in range(attempts):
131135
try:
132-
await ping(self.vm_configuration.ip, packets=1, timeout=timeout_seconds)
136+
await ping(ip, packets=1, timeout=timeout_seconds)
133137
return
134138
except HostNotFoundError:
135139
if attempt < (attempts - 1):

0 commit comments

Comments
 (0)