提交 ff4c25ba 编写于 作者: E Eric Blake

virsh: expose partial pull

Now virsh can call virDomainBlockRebase.

* tools/virsh.c (cmdBlockPull): Add --base parameter.
(blockJobImpl): Use it to expose BlockRebase API.
* tools/virsh.pod (blockpull): Document it.
上级 10ec36e2
......@@ -7349,14 +7349,21 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
goto cleanup;
}
if (mode == VSH_CMD_BLOCK_JOB_ABORT)
if (mode == VSH_CMD_BLOCK_JOB_ABORT) {
ret = virDomainBlockJobAbort(dom, path, 0);
else if (mode == VSH_CMD_BLOCK_JOB_INFO)
} else if (mode == VSH_CMD_BLOCK_JOB_INFO) {
ret = virDomainGetBlockJobInfo(dom, path, info, 0);
else if (mode == VSH_CMD_BLOCK_JOB_SPEED)
} else if (mode == VSH_CMD_BLOCK_JOB_SPEED) {
ret = virDomainBlockJobSetSpeed(dom, path, bandwidth, 0);
else if (mode == VSH_CMD_BLOCK_JOB_PULL)
ret = virDomainBlockPull(dom, path, bandwidth, 0);
} else if (mode == VSH_CMD_BLOCK_JOB_PULL) {
const char *base = NULL;
if (vshCommandOptString(cmd, "base", &base) < 0)
goto cleanup;
if (base)
ret = virDomainBlockRebase(dom, path, base, bandwidth, 0);
else
ret = virDomainBlockPull(dom, path, bandwidth, 0);
}
cleanup:
if (dom)
......@@ -7377,6 +7384,8 @@ static const vshCmdOptDef opts_block_pull[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"path", VSH_OT_DATA, VSH_OFLAG_REQ, N_("Fully-qualified path of disk")},
{"bandwidth", VSH_OT_DATA, VSH_OFLAG_NONE, N_("Bandwidth limit in MB/s")},
{"base", VSH_OT_DATA, VSH_OFLAG_NONE,
N_("path of backing file in chain for a partial pull")},
{NULL, 0, 0, NULL}
};
......
......@@ -598,10 +598,14 @@ currently in use by a running domain. Other contexts that require a MAC
address of virtual interface (such as I<detach-interface> or
I<domif-setlink>) will accept the MAC address printed by this command.
=item B<blockpull> I<domain> I<path> [I<bandwidth>]
Populate a disk from its backing image. Once all data from its backing
image has been pulled, the disk no longer depends on the backing image.
=item B<blockpull> I<domain> I<path> [I<bandwidth>] [I<base>]
Populate a disk from its backing image chain. By default, this command
flattens the entire chain; but if I<base> is specified, containing the
name of one of the backing files in the chain, then that file becomes
the new backing file and only the intermediate portion of the chain is
pulled. Once all requested data from the backing image chain has been
pulled, the disk no longer depends on that portion of the backing chain.
It pulls data for the entire disk in the background, the process of the
operation can be checked with B<blockjob>.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册