mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
BlockPull: Set initial bandwidth limit if specified
The libvirt BlockPull API supports the use of an initial bandwidth limit but the qemu block_stream API does not. To get the desired behavior we use the two APIs strung together: first BlockPull, then BlockJobSetSpeed. We can do this at the driver level to avoid duplicated code in each monitor path. Signed-off-by: Adam Litke <agl@us.ibm.com>
This commit is contained in:
parent
78d9325d1e
commit
d4b9e06256
@ -9418,8 +9418,14 @@ static int
|
|||||||
qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth,
|
qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long bandwidth,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
return qemuDomainBlockJobImpl(dom, path, bandwidth, NULL, BLOCK_JOB_PULL);
|
ret = qemuDomainBlockJobImpl(dom, path, bandwidth, NULL, BLOCK_JOB_PULL);
|
||||||
|
if (ret == 0 && bandwidth != 0)
|
||||||
|
ret = qemuDomainBlockJobImpl(dom, path, bandwidth, NULL,
|
||||||
|
BLOCK_JOB_SPEED);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static virDriver qemuDriver = {
|
static virDriver qemuDriver = {
|
||||||
|
@ -2956,10 +2956,6 @@ int qemuMonitorJSONBlockJob(qemuMonitorPtr mon,
|
|||||||
if (ret == 0 && mode == BLOCK_JOB_INFO)
|
if (ret == 0 && mode == BLOCK_JOB_INFO)
|
||||||
ret = qemuMonitorJSONGetBlockJobInfo(reply, device, info);
|
ret = qemuMonitorJSONGetBlockJobInfo(reply, device, info);
|
||||||
|
|
||||||
if (ret == 0 && mode == BLOCK_JOB_PULL && bandwidth != 0)
|
|
||||||
ret = qemuMonitorJSONBlockJob(mon, device, bandwidth, NULL,
|
|
||||||
BLOCK_JOB_SPEED);
|
|
||||||
|
|
||||||
virJSONValueFree(cmd);
|
virJSONValueFree(cmd);
|
||||||
virJSONValueFree(reply);
|
virJSONValueFree(reply);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user