diff --git a/tools/virsh.c b/tools/virsh.c index 3b34f7e914..dc362dcebd 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -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} }; diff --git a/tools/virsh.pod b/tools/virsh.pod index b7dcef5291..8f6a2d6d89 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -598,10 +598,14 @@ currently in use by a running domain. Other contexts that require a MAC address of virtual interface (such as I or I) will accept the MAC address printed by this command. -=item B I I [I] +=item B I I [I] [I] -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. +Populate a disk from its backing image chain. By default, this command +flattens the entire chain; but if I 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.