Skip to content

Commit

Permalink
hotplug: set disk parameters
Browse files Browse the repository at this point in the history
When hot plugging a disk, paramters should match the current runtime.
I.e. for live migration the cache mode is critical. Other parameters
like aio, discard and unimplemented I/O throtteling groups etc. are
also relevant, but uncritical.
The documetation of HMP drive_add is unclear. It seems, that it
supports the same parameters like -drive command line option???

Current cache settings can be checked by:
  * HMP: info block -n
  * QMP: { "execute": "query-named-block-nodes" }

I was not able to check for aio and discard. So I must assume, that the
HMP/drive_add correctly accepts this parameters.

Signed-off-by: Sascha Lucas <[email protected]>
  • Loading branch information
saschalucas committed Jan 3, 2021
1 parent 74b82e7 commit 4438670
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/hypervisor/hv_kvm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2298,6 +2298,14 @@ def drive_add_fn(filename):
# after QEMU 4.0. auto-read-only first appeared in 3.1, but 4.0
# changed its behavior in a way that breaks hotplugging. See #1547.
cmd += ",auto-read-only=off"
# When hot plugging a disk, parameters should match the current runtime.
# I.e. for live migration, the cache mode is critical.
if up_hvp[constants.HV_DISK_CACHE] != constants.HT_CACHE_DEFAULT:
cmd += ",cache=%s" % up_hvp[constants.HV_DISK_CACHE]
if up_hvp[constants.HV_KVM_DISK_AIO] == constants.HT_KVM_AIO_NATIVE:
cmd += ",aio=%s" % up_hvp[constants.HV_KVM_DISK_AIO]
if up_hvp[constants.HV_DISK_DISCARD] != constants.HT_DISCARD_DEFAULT:
cmd += ",discard=%s" % up_hvp[constants.HV_DISK_DISCARD]
self._CallMonitorCommand(instance.name, cmd)

# This must be done indirectly due to the fact that we pass the drive's
Expand Down

0 comments on commit 4438670

Please sign in to comment.