tools: initialize main loop before block layer
authorPaolo Bonzini <pbonzini@redhat.com>
Sat, 3 Nov 2012 17:10:17 +0000 (18:10 +0100)
committermalc <av1474@comtv.ru>
Tue, 6 Nov 2012 00:37:57 +0000 (04:37 +0400)
Tools were broken because they initialized the block layer while
qemu_aio_context was still NULL.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
qemu-img.c
qemu-io.c

index b17bddd25c170a97b8c8ddf14e96a1ddb0c80d30..e29e01b729e76002f9fe0daec5dfdc753cbd40b7 100644 (file)
@@ -2001,14 +2001,13 @@ int main(int argc, char **argv)
 
     error_set_progname(argv[0]);
 
+    qemu_init_main_loop();
     bdrv_init();
     if (argc < 2)
         help();
     cmdname = argv[1];
     argc--; argv++;
 
-    qemu_init_main_loop();
-
     /* find the command */
     for(cmd = img_cmds; cmd->name != NULL; cmd++) {
         if (!strcmp(cmdname, cmd->name)) {
index d0f4fb70c79a4aa2b4e02f0690d8b515e943627a..1ad7d3adb9b34b4c77dc111692614ef382df43e6 100644 (file)
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -1892,9 +1892,8 @@ int main(int argc, char **argv)
         exit(1);
     }
 
-    bdrv_init();
-
     qemu_init_main_loop();
+    bdrv_init();
 
     /* initialize commands */
     quit_init();