virtio-console: Keep chardev open for other users after hot-unplug
authorAmit Shah <amit.shah@redhat.com>
Tue, 15 Mar 2011 08:43:09 +0000 (14:13 +0530)
committerAmit Shah <amit.shah@redhat.com>
Mon, 21 Mar 2011 11:26:55 +0000 (16:56 +0530)
After a hot-unplug operation, the previous behaviour was to close the
chardev.  That meant the chardev couldn't be re-used.  Also, since
chardev hot-plug isn't possible so far, this means virtio-console
hot-plug isn't feasible as well.

With this change, the chardev is kept around.  A new virtio-console
channel can then be hot-plugged with the same chardev and things will
continue to work.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
hw/virtio-console.c

index be5955868f5c759cac0b8364f95331f541baff47..6b5237b3ce3e15ea41a5e746415c78dd671199d7 100644 (file)
@@ -82,7 +82,11 @@ static int virtconsole_exitfn(VirtIOSerialPort *port)
     VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port);
 
     if (vcon->chr) {
-        qemu_chr_close(vcon->chr);
+       /*
+        * Instead of closing the chardev, free it so it can be used
+        * for other purposes.
+        */
+       qemu_chr_add_handlers(vcon->chr, NULL, NULL, NULL, NULL);
     }
 
     return 0;