Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
qemu-testsuite.20749
0073-xen-add-block-resize-support-for-xe.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0073-xen-add-block-resize-support-for-xe.patch of Package qemu-testsuite.20749
From: Bruce Rogers <brogers@suse.com> Date: Mon, 11 Jun 2018 13:53:40 -0600 Subject: xen: add block resize support for xen disks In the context of a monitor based disk resize, provide notification of the new size to the front end xen block driver via a xenstore update. [BR: FATE#325467, BSC#1094725] Signed-off-by: Bruce Rogers <brogers@suse.com> --- block/block-backend.c | 7 +++++++ blockdev.c | 8 ++++++++ hw/block/xen_disk.c | 9 +++++++++ include/hw/xen/xen.h | 2 ++ include/sysemu/block-backend.h | 2 ++ stubs/xen-common.c | 4 ++++ 6 files changed, 32 insertions(+) diff --git a/block/block-backend.c b/block/block-backend.c index 5288b67914b468f73914c293ffe1..a9073760fc55c5aa29642f5a5159 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1900,6 +1900,13 @@ int blk_truncate(BlockBackend *blk, int64_t offset, PreallocMode prealloc, return bdrv_truncate(blk->root, offset, prealloc, errp); } +void blk_legacy_resize_cb(BlockBackend *blk) +{ + if (blk->legacy_dev) { + xen_blk_resize_cb(blk->dev); + } +} + static void blk_pdiscard_entry(void *opaque) { BlkRwCo *rwco = opaque; diff --git a/blockdev.c b/blockdev.c index 56a6b24a0be3dd78c397ab95f92f..67339b475a6e584f308741e810a6 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2918,6 +2918,7 @@ void qmp_block_resize(bool has_device, const char *device, { Error *local_err = NULL; BlockBackend *blk = NULL; + BlockBackend *cb_blk = NULL; BlockDriverState *bs; AioContext *aio_context; int ret; @@ -2930,6 +2931,10 @@ void qmp_block_resize(bool has_device, const char *device, return; } + if (has_device) { + cb_blk = blk_by_name(device); + } + aio_context = bdrv_get_aio_context(bs); aio_context_acquire(aio_context); @@ -2956,6 +2961,9 @@ void qmp_block_resize(bool has_device, const char *device, bdrv_drained_begin(bs); ret = blk_truncate(blk, size, PREALLOC_MODE_OFF, errp); + if (!ret && cb_blk) { + blk_legacy_resize_cb(cb_blk); + } bdrv_drained_end(bs); out: diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 67f8464f6aaa0888807656387f33..3556ceb6a2a03582e099b8ace46d 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -1400,6 +1400,15 @@ char *xen_blk_get_attached_dev_id(void *dev) return g_strdup_printf("xen-qdisk-%i", blkdev->xendev.dev); } +void xen_blk_resize_cb(void *dev) +{ + struct XenBlkDev *blkdev = dev; + blkdev->file_size = blk_getlength(blkdev->blk); + xenstore_write_be_int64(&blkdev->xendev, "sectors", + blkdev->file_size / blkdev->file_blk); + xen_be_set_state(&blkdev->xendev, blkdev->xendev.be_state); +} + struct XenDevOps xen_blkdev_ops = { .size = sizeof(struct XenBlkDev), .alloc = blk_alloc, diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index a201517675c6f7b05399ff55eb2d..d923ae53f1085431bbcb673bb024 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -50,4 +50,6 @@ void xen_register_framebuffer(struct MemoryRegion *mr); char *xen_blk_get_attached_dev_id(void *dev); +void xen_blk_resize_cb(void *dev); + #endif /* QEMU_HW_XEN_H */ diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index c4e52a5fa3969742d008c6f6620d..46f45c4dc34723bb892a9c206ee7 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -229,4 +229,6 @@ void blk_io_limits_enable(BlockBackend *blk, const char *group); void blk_io_limits_update_group(BlockBackend *blk, const char *group); void blk_set_force_allow_inactivate(BlockBackend *blk); +void blk_legacy_resize_cb(BlockBackend *blk); + #endif diff --git a/stubs/xen-common.c b/stubs/xen-common.c index aeac0534acf2a38fb23877ae671a..c2cbf81a879ab30bb1f9a10749bd 100644 --- a/stubs/xen-common.c +++ b/stubs/xen-common.c @@ -17,3 +17,7 @@ char *xen_blk_get_attached_dev_id(void *dev) { return g_strdup(""); } + +void xen_blk_resize_cb(void *dev) +{ +}
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor