mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
blockjob: allow finer bandwidth tuning for set speed
We stupidly modeled block job bandwidth after migration
bandwidth, which in turn was an 'unsigned long' and therefore
subject to 32-bit vs. 64-bit interpretations. To work around
the fact that 10-gigabit interfaces are possible but don't fit
within 32 bits, the original interface took the number scaled
as MiB/sec. But this scaling is rather coarse, and it might
be nice to tune bandwidth finer than in megabyte chunks.
Several of the block job calls that can set speed are fed
through a common interface, so it was easier to adjust them all
at once. Note that there is intentionally no flag for the new
virDomainBlockCopy; there, since the API already uses a 64-bit
type always, instead of a possible 32-bit type, and is brand
new, it was easier to just avoid scaling issues. As with the
previous patch that adjusted the query side (commit db33cc24),
omitting the new flag preserves old behavior, and the
documentation now mentions limits of what happens when a 32-bit
machine is on either client or server side.
* include/libvirt/libvirt.h.in (virDomainBlockJobSetSpeedFlags)
(virDomainBlockPullFlags)
(VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES)
(VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES): New enums.
* src/libvirt.c (virDomainBlockJobSetSpeed, virDomainBlockPull)
(virDomainBlockRebase, virDomainBlockCommit): Document them.
* src/qemu/qemu_driver.c (qemuDomainBlockJobSetSpeed)
(qemuDomainBlockPull, qemuDomainBlockRebase)
(qemuDomainBlockCommit, qemuDomainBlockJobImpl): Support new flag.
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
@@ -2619,11 +2619,24 @@ int virDomainGetBlockJobInfo(virDomainPtr dom, const char *disk,
|
||||
virDomainBlockJobInfoPtr info,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainBlockJobSetSpeed(virDomainPtr dom, const char *disk,
|
||||
unsigned long bandwidth, unsigned int flags);
|
||||
/* Flags for use with virDomainBlockJobSetSpeed */
|
||||
typedef enum {
|
||||
VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES = 1 << 0, /* bandwidth in bytes/s
|
||||
instead of MiB/s */
|
||||
} virDomainBlockJobSetSpeedFlags;
|
||||
|
||||
int virDomainBlockPull(virDomainPtr dom, const char *disk,
|
||||
unsigned long bandwidth, unsigned int flags);
|
||||
int virDomainBlockJobSetSpeed(virDomainPtr dom, const char *disk,
|
||||
unsigned long bandwidth, unsigned int flags);
|
||||
|
||||
/* Flags for use with virDomainBlockPull (values chosen to be a subset
|
||||
* of the flags for virDomainBlockRebase) */
|
||||
typedef enum {
|
||||
VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES = 1 << 6, /* bandwidth in bytes/s
|
||||
instead of MiB/s */
|
||||
} virDomainBlockPullFlags;
|
||||
|
||||
int virDomainBlockPull(virDomainPtr dom, const char *disk,
|
||||
unsigned long bandwidth, unsigned int flags);
|
||||
|
||||
/**
|
||||
* virDomainBlockRebaseFlags:
|
||||
@@ -2642,11 +2655,13 @@ typedef enum {
|
||||
names */
|
||||
VIR_DOMAIN_BLOCK_REBASE_COPY_DEV = 1 << 5, /* Treat destination as block
|
||||
device instead of file */
|
||||
VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES = 1 << 6, /* bandwidth in bytes/s
|
||||
instead of MiB/s */
|
||||
} virDomainBlockRebaseFlags;
|
||||
|
||||
int virDomainBlockRebase(virDomainPtr dom, const char *disk,
|
||||
const char *base, unsigned long bandwidth,
|
||||
unsigned int flags);
|
||||
int virDomainBlockRebase(virDomainPtr dom, const char *disk,
|
||||
const char *base, unsigned long bandwidth,
|
||||
unsigned int flags);
|
||||
|
||||
/**
|
||||
* virDomainBlockCopyFlags:
|
||||
@@ -2721,6 +2736,8 @@ typedef enum {
|
||||
VIR_DOMAIN_BLOCK_COMMIT_RELATIVE = 1 << 3, /* keep the backing chain
|
||||
referenced using relative
|
||||
names */
|
||||
VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES = 1 << 4, /* bandwidth in bytes/s
|
||||
instead of MiB/s */
|
||||
} virDomainBlockCommitFlags;
|
||||
|
||||
int virDomainBlockCommit(virDomainPtr dom, const char *disk, const char *base,
|
||||
|
||||
Reference in New Issue
Block a user