History | View | Annotate | Download (64.1 kB)
sheepdog: fix loadvm operation
Currently the 'loadvm' opertaion works as following:1. switch to the snapshot2. mark current working VDI as a snapshot3. rely on sd_create_branch to create a new working VDI based on the snapshot
This works not the same as other format as QCOW2. For e.g,...
sheepdog: use BDRV_SECTOR_SIZE
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Cc: Kevin Wolf <kwolf@redhat.com>Cc: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Liu Yuan <tailai.ly@taobao.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
sheepdog: implement .bdrv_co_is_allocated()
sheepdog: cleanup find_vdi_name
This makes 'filename' and 'tag' constant variables, and renames'for_snapshot' to 'lock' to clear how it works.
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
sheepdog: add SD_RES_READONLY result code
Sheepdog returns SD_RES_READONLY when qemu sends write requests to thesnapshot vdi. This adds the result code and makes sd_strerror() printits error reason.
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>...
sheepdog: add helper function to reload inode
This adds a helper function to update the current inode state with thespecified vdi object.
sheepdog: resend write requests when SD_RES_READONLY is received
When a snapshot is taken from out side of qemu (e.g. qemu-imgsnapshot), write requests to the current vdi return SD_RES_READONLY.In this case, the sheepdog block driver needs to update the current...
sheepdog: add discard/trim support for sheepdog
The 'TRIM' command from VM that is to release underlying data storage forbetter thin-provision is already supported by the Sheepdog.
This patch adds the TRIM support at QEMU part.
For older Sheepdog that doesn't support it, we return 0(success) to upper layer....
block: Remove filename parameter from .bdrv_file_open()
It is unused now in all block drivers.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
sheepdog: Use bdrv_open options instead of filename
This is only to convert the internal interface that is used for passingthe "filename" to be parsed, but converting to actual fine grainedoptions is left for another day, as it doesn't look trivial.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
block: Introduce bdrv_writev_vmstate
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()
The fcntl(fd, F_SETFL, O_NONBLOCK) flag is not specific to sockets.Rename to qemu_set_nonblock() just like qemu_set_cloexec().
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
block: Add options QDict to bdrv_file_open() prototypes
The new parameter is unused yet.
sheepdog: show error message for halt status
Sheepdog (neither quorum nor unsafe mode) will refuse to serve IO requests whennumber of alive nodes is less than that of copies specified by users. This willreturn 0x19 to QEMU client which currently doesn't recognize it....
sheepdog: use non-blocking fd in coroutine context
Using a blocking socket in the coroutine context reduces the chance ofswitching to other work. This patch makes the sheepdog driver use anon-blocking fd always.
sheepdog: set io_flush handler in do_co_req
If an io_flush handler is not set, qemu_aio_wait doesn't invokecallbacks.
move socket_set_nodelay to osdep.c
sheepdog: accept URIs
The URI syntax is consistent with the NBD and Gluster syntax. Thesyntax is
sheepdog[+tcp]://[host:port]/vdiname[#snapid|#tag]
sheepdog: use inet_connect to simplify connect code
This uses the form "<host>:<port>" for the representation of thesheepdog server to use inet_connect.
sheepdog: add support for connecting to unix domain socket
This patch adds support for a unix domain socket for a connectionbetween qemu and local sheepdog server. You can use the unix domainsocket with the following syntax:
$ qemu sheepdog+unix:///<vdiname>?socket=<socket path>[#snapid]...
sheepdog: pass vdi_id to sheep daemon for sd_close()
Sheep daemon needs vdi_id to identify which vdi is closed to release resourcessuch as object cache.
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Cc: Kevin Wolf <kwolf@redhat.com>Cc: Stefan Hajnoczi <stefanha@redhat.com>...
sheepdog: clean up sd_aio_setup()
The last two parameters of sd_aio_setup() are never used, so remove them.
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Cc: Kevin Wolf <kwolf@redhat.com>Cc: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Liu Yuan <tailai.ly@taobao.com>...
sheepdog: multiplex the rw FD to flush cache
This will reduce sockfds connected to the sheep server to one, which simply thefuture hacks.
sheepdog: implement direct write semantics
Sheepdog supports both writeback/writethrough write but has not yet supportedDIRECTIO semantics which bypass the cache completely even if Sheepdog daemon isset up with cache enabled.
Suppose cache is enabled on Sheepdog daemon size, the new cache control is...
sheepdog: pass oid directly to send_pending_req()
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Cc: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Liu Yuan <tailai.ly@taobao.com>Reviewed-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
sheepdog: don't update inode when create_and_write fails
For the error case such as SD_RES_NO_SPACE, we shouldn't update the inode bitmapto avoid the scenario that the object is allocated but wasn't created at theserver side. This will result in VM's IO error on the failed object....
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: move include files to include/block/
aio: rename AIOPool to AIOCBInfo
Now that AIOPool no longer keeps a freelist, it isn't really a "pool" anymore. Rename it to AIOCBInfo and make it const since it no longerneeds to be modified.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
sheepdog: use bool for boolean variables
This improves readability.
sheepdog: avoid a few buffer overruns
block: do not parse BDRV_O_CACHE_WB in block drivers
Block drivers should ignore BDRV_O_CACHE_WB in .bdrv_open flags,and in the bs->open_flags.
This patch removes the code, leaving the behaviour behind as ifBDRV_O_CACHE_WB was set.
Signed-off-by: Jeff Cody <jcody@redhat.com>...
sheepdog: fix savevm and loadvm
This patch sets data to be sent to Sheepdog correctly and fixes savevmand loadvm operations on a Sheepdog image.
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
sheepdog: don't leak socket file descriptor upon connection failure
Signed-off-by: Jim Meyering <meyering@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
sheepdog: always use coroutine-based network functions
This reduces some code duplication.
sheepdog: do not blindly memset all read buffers
Only buffers that map to unallocated blocks need to be zeroed.
Signed-off-by: Christoph Hellwig <hch@lst.de>Acked-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Merge remote-tracking branch 'mjt/mjt-iov2' into staging
sheepdog: split outstanding list into inflight and pending
outstanding_list_head is used for both pending and inflight requests.This patch splits it and improves readability.
sheepdog: traverse pending_list from the first for each time
The pending list can be modified in other coroutine contextsd_co_rw_vector, so we need to traverse the list from the first againafter we send the pending request.
sheepdog: fix dprintf format strings
This fixes warnings about dprintf format in debug mode.
sheepdog: restart I/O when socket becomes ready in do_co_req()
Currently, no one reenters the yielded coroutine. This fixes it.
sheepdog: use coroutine based socket functions in coroutine context
This removes blocking network I/Os in coroutine context.
sheepdog: make sure we don't free aiocb before sending all requests
This patch increments the pending counter before sending requests, andmake sures that aiocb is not freed while sending them.
sheepdog: add coroutine_fn markers to coroutine functions
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
cleanup qemu_co_sendv(), qemu_co_recvv() and friends
The same as for non-coroutine versions in previouspatches: rename arguments to be more obvious, changetype of arguments from int to size_t where appropriate,and use common code for send and receive paths (with...
sheepdog: fix return value of do_load_save_vm_state
bdrv_save_vmstate and bdrv_load_vmstate should return the vmstate sizeon success, and -errno on error.
sheepdog: mark image as snapshot when tag is specified
When a snapshot tag is specified in the filename, the opened image isa snapshot.
sheepdog: return -errno on error
On error, BlockDriver APIs should return -errno instead of -1.
sheepdog: use heap instead of stack for BDRVSheepdogState
bdrv_create() is called in coroutine context now, so we cannot usemore stack than 1 MB in the function if we use ucontext coroutine.This patch allocates BDRVSheepdogState, whose size is 4 MB, on the...
sheepdog: switch to writethrough mode if cluster doesn't support flush
This is necessary for qemu to work with the older version of Sheepdogwhich doesn't support SD_OP_FLUSH_VDI.
Signed-off-by: MORITA Kazutaka <morita.kazutaka@gmail.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
aio: remove process_queue callback and qemu_aio_process_queue
Both unused after the previous patch.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
sheepdog: implement SD_OP_FLUSH_VDI operation
Flush operation is supposed to flush the write-back cache ofsheepdog cluster.
By issuing flush operation, we can assure the Guest of datareaching the sheepdog cluster storage.
Cc: Kevin Wolf <kwolf@redhat.com>...
sheepdog: fix send req helpers
We should return if reading of the header fails.
Cc: Kevin Wolf <kwolf@redhat.com>Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Liu Yuan <tailai.ly@taobao.com>Acked-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>...
sheepdog: fix co_recv coroutine context
The co_recv coroutine has two things that will try to enter it:
1. The select(2) read callback on the sheepdog socket. 2. The aio_add_request() blocking operations, including a coroutine mutex.
This patch fixes it by setting NULL to co_recv before sending data....
prepare for future GPLv2+ relicensing
All files under GPLv2 will get GPLv2+ changes starting tomorrow.event_notifier.c and exec-obsolete.h were only ever touched by Red Hatemployees and can be relicensed now.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
move corking functions to osdep.c
sheepdog: move coroutine send/recv function to generic code
Outside coroutines, avoid busy waiting on EAGAIN by temporarilymaking the socket blocking.
The API of qemu_recvv/qemu_sendv is slightly different fromdo_readv/do_writev because they do not handle coroutines. It...
block: Add coroutine_fn marker to coroutine functions
Looks better when reviewing these source files.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
sheepdog: Avoid deadlock in error path
s->lock should be unlocked before leaving add_aio_request.
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
sheepdog: add coroutine_fn markers
This makes the following patch easier to review.
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
sheepdog: correct spelling
Reviewed-by: Andreas Färber <afaerber@suse.de>Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
sheepdog: use coroutines
This makes the sheepdog block driver support bdrv_co_readv/writevinstead of bdrv_aio_readv/writev.
With this patch, Sheepdog network I/O becomes fully asynchronous. Theblock driver yields back when send/recv returns EAGAIN, and is resumed...
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Wrap recv to avoid warnings
Avoid warnings like these by wrapping recv(): CC slirp/ip_icmp.o/src/qemu/slirp/ip_icmp.c: In function 'icmp_receive':/src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror]...
sheepdog: add full data preallocation support
This introduces qemu-img create option for sheepdog which allows thedata to be fully preallocated (note that sheepdog always preallocatesmetadata).
The option is disabled by default and you need to enable it like the...
sheepdog: qemu_bh_new() can't return null pointer, drop check
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Strip trailing '\n' from error_report()'s first argument
error_report() prepends location, and appends a newline. The messageconstructed from the arguments should not contain a newline. Fix theobvious offenders.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
Fix typo in code and comments
Replace writeable -> writable
Signed-off-by: Stefan Weil <weil@mail.berlios.de>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
get rid of private bitmap functions in block/sheepdog.c, use generic ones
qemu now has generic bitmap functions,so don't redefine them in sheepdog.c,use common header instead. A small cleanup.
Here's only one function which is actuallyused in sheepdog and gets replaced with...
sheepdog: support creating images on remote hosts
This patch parses the input filename in sd_create(), and enables usspecifying a target server to create sheepdog images.
sheepdog: remove unnecessary includes
"qemu_socket.h" includes all necessary files andincluding <netinet/tcp.h> without <netinet/in.h>could cause errors on some systems.
Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
sheepdog: fix compile error on systems without TCP_CORK
WIN32 is not only the system which doesn't have TCP_CORK (e.g. OS X).
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
block: add sheepdog driver for distributed storage support
Sheepdog is a distributed storage system for QEMU. It provides highlyavailable block level storage volumes to VMs like Amazon EBS. Thispatch adds a qemu block driver for Sheepdog.
Sheepdog features are:...