aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2012-01-18 14:40:53 +0000
committerKevin Wolf <kwolf@redhat.com>2012-01-26 14:49:18 +0100
commitc8c3080f4a6fbbf3c9c5d6efd1b49e7ca6479d1e (patch)
treeb034c08322e2c0f1d7bcbf752ff8c123b7a68213 /blockdev.c
parent019b8cbf76fc3126d300c401acca3102c69e7876 (diff)
block: add support for partial streaming
Add support for streaming data from an intermediate section of the image chain (see patch and documentation for details). Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/blockdev.c b/blockdev.c
index 2fa01516f9..7e4c548426 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -973,6 +973,7 @@ void qmp_block_stream(const char *device, bool has_base,
const char *base, Error **errp)
{
BlockDriverState *bs;
+ BlockDriverState *base_bs = NULL;
int ret;
bs = bdrv_find(device);
@@ -981,13 +982,15 @@ void qmp_block_stream(const char *device, bool has_base,
return;
}
- /* Base device not supported */
if (base) {
- error_set(errp, QERR_NOT_SUPPORTED);
- return;
+ base_bs = bdrv_find_backing_image(bs, base);
+ if (base_bs == NULL) {
+ error_set(errp, QERR_BASE_NOT_FOUND, base);
+ return;
+ }
}
- ret = stream_start(bs, NULL, block_stream_cb, bs);
+ ret = stream_start(bs, base_bs, base, block_stream_cb, bs);
if (ret < 0) {
switch (ret) {
case -EBUSY: