Skip to content

Commit 096301e

Browse files
committed
qemu: Simplyify global timeout handling
Set the timeout later, so we have to cancel it in fewer places. Always use 10 minutes as the global timeout value.
1 parent 5b24b89 commit 096301e

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

lib/qemu.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def qemu_main(qemu_machine, cpuinfo_platform, cpu, net, args):
140140

141141
cloud_image = os.environ.get('CLOUD_IMAGE', False)
142142
if cloud_image:
143-
setup_timeout(600)
144143
boot_timeout = 300
145144

146145
# Create snapshot image
@@ -171,7 +170,6 @@ def qemu_main(qemu_machine, cpuinfo_platform, cpu, net, args):
171170
drive += f'-drive file={dst},format=qcow2,if={interface},id=drive0 ' \
172171
f'-drive file={rdpath}/cloud-init-user-data.img,format=raw,if={interface},readonly=on,id=drive1'
173172
else:
174-
setup_timeout(120)
175173
boot_timeout = 120
176174
drive = None
177175

@@ -188,7 +186,6 @@ def qemu_main(qemu_machine, cpuinfo_platform, cpu, net, args):
188186
gdb = '-s -S'
189187
p.timeout = None
190188
boot_timeout = None
191-
setup_timeout(0)
192189
else:
193190
gdb = None
194191

@@ -198,10 +195,12 @@ def qemu_main(qemu_machine, cpuinfo_platform, cpu, net, args):
198195

199196
if '--interactive' in args:
200197
logging.info("Running interactively ...")
201-
setup_timeout(0)
202198
rc = subprocess.run(cmd, shell=True).returncode
203199
return rc == 0
204200

201+
if not gdb:
202+
setup_timeout(600)
203+
205204
logpath = get_env_var('QEMU_CONSOLE_LOG', 'console.log')
206205
p.spawn(cmd, logfile=open(logpath, 'w'))
207206

0 commit comments

Comments
 (0)