summaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-04-04 17:11:13 +0200
committerKevin Wolf <kwolf@redhat.com>2016-04-05 09:22:28 +0200
commit76b223200ef4fb09dd87f0e213159795eb68e7a5 (patch)
tree738f8a652767248a300bd62a1ccb576cde9a5553 /blockdev.c
parent5cf87fd68e1ea06013594682cec6feb5488fb773 (diff)
downloadqemu-76b223200ef4fb09dd87f0e213159795eb68e7a5.zip
block: Forbid I/O throttling on nodes with multiple parents for 2.6
As the patches to move I/O throttling to BlockBackend didn't make it in time for the 2.6 release, but the release adds new ways of configuring VMs whose behaviour would change once the move is done, we need to outlaw such configurations temporarily. The problem exists whenever a BDS has more users than just its BB, for example it is used as a backing file for another node. (This wasn't possible in 2.5 yet as we introduced node references to specify a backing file only recently.) In these cases, the throttling would apply to these other users now, but after moving throttling to the BlockBackend the other users wouldn't be throttled any more. This patch prevents making new references to a throttled node as well as using monitor commands to throttle a node with multiple parents. Compared to 2.5 this changes behaviour in some corner cases where references were allowed before, like bs->file or Quorum children. It seems reasonable to assume that users didn't use I/O throttling on such low level nodes. With the upcoming move of throttling into BlockBackend, such configurations won't be possible anyway. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c
index 332068a837..f1f520a265 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2661,6 +2661,13 @@ void qmp_block_set_io_throttle(const char *device, int64_t bps, int64_t bps_rd,
goto out;
}
+ /* The BlockBackend must be the only parent */
+ assert(QLIST_FIRST(&bs->parents));
+ if (QLIST_NEXT(QLIST_FIRST(&bs->parents), next_parent)) {
+ error_setg(errp, "Cannot throttle device with multiple parents");
+ goto out;
+ }
+
throttle_config_init(&cfg);
cfg.buckets[THROTTLE_BPS_TOTAL].avg = bps;
cfg.buckets[THROTTLE_BPS_READ].avg = bps_rd;