libvirt/src/qemu
Eric Blake 2eabac008e blockjob: fix block-stream bandwidth race
With RHEL 6.2, virDomainBlockPull(dom, dev, bandwidth, 0) has a race
with non-zero bandwidth: there is a window between the block_stream
and block_job_set_speed monitor commands where an unlimited amount
of data was let through, defeating the point of a throttle.

This race was first identified in commit a9d3495e, and libvirt was
able to reduce the size of the window for that race.  In the meantime,
the qemu developers decided to fix things properly; per this message:
https://lists.gnu.org/archive/html/qemu-devel/2012-04/msg03793.html
the fix will be in qemu 1.1, and changes block-job-set-speed to use
a different parameter name, as well as adding a new optional parameter
to block-stream, which eliminates the race altogether.

Since our documentation already mentioned that we can refuse a non-zero
bandwidth for some hypervisors, I think the best solution is to do
just that for RHEL 6.2 qemu, so that the race is obvious to the user
(anyone using stock RHEL 6.2 binaries won't have this patch, and anyone
building their own libvirt with this patch for RHEL can also rebuild
qemu to get the modern semantics, so it is no real loss in behavior).

Meanwhile the code must be fixed to honor actual qemu 1.1 naming.
Rename the parameter to 'modern', since the naming difference now
covers more than just 'async' block-job-cancel.  And while at it,
fix an unchecked integer overflow.

* src/qemu/qemu_monitor.h (enum BLOCK_JOB_CMD): Drop unused value,
rename enum to match conventions.
* src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Reflect enum rename.
* src/qemu_qemu_monitor_json.h (qemuMonitorJSONBlockJob): Likewise.
* src/qemu/qemu_monitor_json.c (qemuMonitorJSONBlockJob): Likewise,
and support difference between RHEL 6.2 and qemu 1.1 block pull.
* src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Reject
bandwidth during pull with too-old qemu.
* src/libvirt.c (virDomainBlockPull, virDomainBlockRebase):
Document this.
2012-04-27 13:00:56 -06:00
..
libvirtd_qemu.aug Add two new security label types 2012-02-02 17:44:37 -07:00
MIGRATION.txt qemu: Implement migration job phases 2011-07-27 08:45:09 -06:00
qemu_agent.c qemu_agent: Issue guest-sync prior to every command 2012-03-30 18:16:17 +02:00
qemu_agent.h qemu: Implement DomainPMSuspendForDuration 2012-02-15 11:45:45 +01:00
qemu_bridge_filter.c Remove conn parameter from virReportSystemError 2010-02-09 01:04:54 +01:00
qemu_bridge_filter.h build: consistently indent preprocessor directives 2010-03-09 19:22:28 +01:00
qemu_capabilities.c qemu: Use common helper when probing qemu capabilities 2012-04-27 12:09:32 +02:00
qemu_capabilities.h qemu: Use common helper when probing qemu capabilities 2012-04-27 12:09:32 +02:00
qemu_cgroup.c qemu: eliminate "Ignoring open failure" when using root-squash NFS 2012-02-03 16:47:43 -05:00
qemu_cgroup.h qemu: Implement period and quota tunable XML configuration and parsing 2011-07-21 17:11:12 +08:00
qemu_command.c cpu: Improve error reporting on incompatible CPUs 2012-04-23 10:59:51 +02:00
qemu_command.h build: use correct type for pid and similar types 2012-03-02 06:57:43 -07:00
qemu_conf.c qemu: Add connection close callbacks 2012-03-21 17:31:09 +01:00
qemu_conf.h qemu: Make autodestroy utilize connection close callbacks 2012-03-21 17:31:09 +01:00
qemu_domain.c qemu: Warn on possibly incorrect usage of EnterMonitor* 2012-04-11 09:57:39 +02:00
qemu_domain.h qemu: Track job owner for better debugging 2012-04-11 09:57:39 +02:00
qemu_driver.c blockjob: fix block-stream bandwidth race 2012-04-27 13:00:56 -06:00
qemu_driver.h Split all QEMU process mangement code into separate file 2011-02-17 12:48:55 +00:00
qemu_hostdev.c qemu: Build activeUsbHostdevs list on process reconnect 2012-04-04 15:09:41 +02:00
qemu_hostdev.h qemu: Build activeUsbHostdevs list on process reconnect 2012-04-04 15:09:41 +02:00
qemu_hotplug.c qemu: use consistent error when qemu binary is too old 2012-04-17 11:09:44 -06:00
qemu_hotplug.h qemu: Start nested job in qemuDomainCheckEjectableMedia 2012-04-02 21:44:27 +02:00
qemu_migration.c qemu: Avoid bogus error at the end of tunnelled migration 2012-04-26 16:30:23 +02:00
qemu_migration.h qemu: Avoid dangling migration-out job when client dies 2012-03-21 17:31:09 +01:00
qemu_monitor_json.c blockjob: fix block-stream bandwidth race 2012-04-27 13:00:56 -06:00
qemu_monitor_json.h blockjob: fix block-stream bandwidth race 2012-04-27 13:00:56 -06:00
qemu_monitor_text.c Consistent style for usage of sizeof operator 2012-03-30 11:47:24 +01:00
qemu_monitor_text.h xml: use better types for memory values 2012-03-07 18:24:44 -07:00
qemu_monitor.c blockjob: fix block-stream bandwidth race 2012-04-27 13:00:56 -06:00
qemu_monitor.h blockjob: fix block-stream bandwidth race 2012-04-27 13:00:56 -06:00
qemu_process.c Do not enforce source type of console[0] 2012-04-16 22:24:20 -06:00
qemu_process.h qemuProcessStart: Switch to flags instead of bunch booleans 2012-04-16 17:20:04 +02:00
qemu.conf qemu driver for virDomainGetCPUstats using cpuacct cgroup. 2012-03-06 21:54:48 -07:00
test_libvirtd_qemu.aug qemu: Support for overriding NOFILE limit 2011-12-22 17:49:04 +01:00
THREADS.txt qemu: fix crash when mixing sync and async monitor jobs 2011-08-01 09:41:57 -06:00