Skip to contentSkip to conversation

downscript not run when using quit in monitor

Qemu-devel Jędrzej Kalinowski 2 participants 3 messages Feb 19, 2009 – Feb 24, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

I'm using qemu to simulate various network booting scenarios w pxe/gPXE. I use my ifup / ifdown script to set up / destroy tap devices form the qemu instance.

However if I 'quit' qemu from the monitor - the downscript is not executed. Is it by design or should it be classified as a bug?
If it's fine - how can I close the machine properly (with downscript execution) in -curses mode? It has no OS loaded - it didn't succeded to boot from pxe..

Thanks,
Jedrzej Kalinowski

Signature · 1 line
JK
#1 lore raw
Quoted 4 lines · Jędrzej Kalinowski

Hello,

I'm using qemu to simulate various network booting scenarios w pxe/gPXE. I use my ifup / ifdown script to set up / destroy tap devices form the

qemu

Quoted 3 lines

instance.

However if I 'quit' qemu from the monitor - the downscript is not

executed.

Quoted 5 lines

Is it by design or should it be classified as a bug?
If it's fine - how can I close the machine properly (with downscript execution) in -curses mode? It has no OS loaded - it didn't succeded to boot from pxe..

Following is a trivial patch I needed to apply to make downscripts execute...
Maybe will save a few seconds to someone..

Cheers - Jędrzej

monitor.c 2009-02-22 18:53:17.000000000 +0100 renamed from monitor.c.orig 2009-02-22 19:13:22.000000000 +0100 +1 -0
@@ -380,6 +380,7 @@
 
 static void do_quit(void)
 {
+    net_cleanup();
     exit(0);
 }
 
#2 lore raw
Quoted 26 lines · Jędrzej Kalinowski
Quoted 4 lines · Jędrzej Kalinowski

Hello,

I'm using qemu to simulate various network booting scenarios w pxe/gPXE. I use my ifup / ifdown script to set up / destroy tap devices form the

qemu

Quoted 3 lines

instance.

However if I 'quit' qemu from the monitor - the downscript is not

executed.

Quoted 5 lines

Is it by design or should it be classified as a bug?
If it's fine - how can I close the machine properly (with downscript execution) in -curses mode? It has no OS loaded - it didn't succeded to boot from pxe..

Following is a trivial patch I needed to apply to make downscripts execute...
Maybe will save a few seconds to someone..

Cheers - Jędrzej

monitor.c 2009-02-22 18:53:17.000000000 +0100 line 386

Quoted 7 lines
monitor.c 2009-02-22 18:53:17.000000000 +0100 renamed from monitor.c.orig 2009-02-22 19:13:22.000000000 +0100 +1 -0
@@ -380,6 +380,7 @@
 
 static void do_quit(void)
 {
+    net_cleanup();
     exit(0);
 }
 

Generally, this looks reasonable to me. But to catch also other exits, you probably want to install an atexit handler. And please post your patches with signed-off and an easily extractable commit comment.

Jan