summaryrefslogtreecommitdiff
path: root/blockdev-nbd.c
AgeCommit message (Collapse)AuthorFilesLines
2014-07-15nbd: Shutdown socket before closing.Hani Benhabiles1-0/+1
This forces finishing data sending to client before closing the socket like in exports listing or replying with NBD_REP_ERR_UNSUP cases. Signed-off-by: Hani Benhabiles <kroosec@gmail.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 27e5eae4577316f7e86a56eb7363d4e78f79e3e5) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-07-15nbd: Close socket on negotiation failure.Hani Benhabiles1-2/+2
Otherwise, the nbd client may hang waiting for the server response. Signed-off-by: Hani Benhabiles <hani@linux.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> (cherry picked from commit 36af599417dde11747a27dc8550ff2281657a8ff) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2014-07-15nbd: Don't export a block device with no medium.Hani Benhabiles1-0/+4
The device is exported with erroneous values and can't be read. Before the patch: $ sudo nbd-client localhost -p 10809 /dev/nbd0 -name floppy0 Negotiation: ..size = 17592186044415MB bs=1024, sz=18446744073709547520 bytes $ sudo mount /dev/nbd0 /mnt/tmp/ mount: block device /dev/nbd0 is write-protected, mounting read-only mount: /dev/nbd0: can't read superblock After the patch: (qemu) nbd_server_add ide0-hd0 (qemu) nbd_server_add floppy0 Device 'floppy0' has no medium Signed-off-by: Hani Benhabiles <kroosec@gmail.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 60fe4fac22895576973e317d7148b084c31cc64c) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
2013-09-06nbd: use BlockDriverState refcntFam Zheng1-9/+1
Previously, nbd calls drive_get_ref() on the drive of bs. A BDS doesn't always have associated dinfo, which nbd doesn't care either. We already have BDS ref count, so use it to make it safe for a BDS w/o blockdev. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-04-08hw: move headers to include/Paolo Bonzini1-1/+1
Many of these should be cleaned up with proper qdev-/QOM-ification. Right now there are many catch-all headers in include/hw/ARCH depending on cpu.h, and this makes it necessary to compile these files per-target. However, fixing this does not belong in these patches. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19softmmu: move include files to include/sysemu/Paolo Bonzini1-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19monitor: move include files to include/monitor/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19block: move include files to include/block/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19qapi: move include files to include/qobject/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-28nbd-server-add: Fix the default for 'writable'Michal Privoznik1-1/+1
The documentation to this monitor command tells, that 'writable' argument is optional and defaults to false. However, the code sets true as the default. But since some applications may already been using this, it's safer to fix the code and not documentation which would break those applications. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12nbd: disallow nbd-server-add before nbd-server-startPaolo Bonzini1-0/+5
It works nicely with the QMP commands, but it adds useless complication with HMP. In particular, see the following: (qemu) nbd_server_add -w scsi0-hd0 (qemu) nbd_server_start -a localhost:10809 NBD server already exporting device scsi0-hd0 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12nbd: force read-only export for read-only devicesPaolo Bonzini1-0/+7
This is the desired behavior for HMP, but it is a better choice for QMP as well. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12nbd: fix nbd_server_stop crash when no server was runningPaolo Bonzini1-3/+5
This failed on the new assertion of qemu_set_fd_handler2: qemu-system-x86_64: /home/pbonzini/work/upstream/qemu/iohandler.c:60: qemu_set_fd_handler2: Assertion `fd >= 0' failed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qmp: add NBD server commandsPaolo Bonzini1-0/+119
Adding an NBD server inside QEMU is trivial, since all the logic is in nbd.c and can be shared easily between qemu-nbd and QEMU itself. The main difference is that qemu-nbd serves a single unnamed export, while QEMU serves named exports. Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>