mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 14:35:25 +00:00
Revert "Enable the virDomainBlockPull API in virsh"
This reverts commit 3e2493ce28
.
This commit is contained in:
parent
21ecea2e93
commit
f7f5e3e806
120
tools/virsh.c
120
tools/virsh.c
@ -4412,8 +4412,7 @@ out_sig:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_job_progress(const char *label, unsigned long long remaining,
|
print_job_progress(unsigned long long remaining, unsigned long long total)
|
||||||
unsigned long long total)
|
|
||||||
{
|
{
|
||||||
int progress;
|
int progress;
|
||||||
|
|
||||||
@ -4433,7 +4432,7 @@ print_job_progress(const char *label, unsigned long long remaining,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "\r%s: [%3d %%]", label, progress);
|
fprintf(stderr, "\rMigration: [%3d %%]", progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@ -4520,7 +4519,7 @@ repoll:
|
|||||||
functionReturn = true;
|
functionReturn = true;
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
/* print [100 %] */
|
/* print [100 %] */
|
||||||
print_job_progress("Migration", 0, 1);
|
print_job_progress(0, 1);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
functionReturn = false;
|
functionReturn = false;
|
||||||
@ -4559,8 +4558,7 @@ repoll:
|
|||||||
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
|
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
|
||||||
#endif
|
#endif
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
print_job_progress("Migration", jobinfo.dataRemaining,
|
print_job_progress(jobinfo.dataRemaining, jobinfo.dataTotal);
|
||||||
jobinfo.dataTotal);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4663,114 +4661,6 @@ done:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
VSH_CMD_BLOCK_PULL_ONE = 0,
|
|
||||||
VSH_CMD_BLOCK_PULL_ALL = 1,
|
|
||||||
VSH_CMD_BLOCK_PULL_ABORT = 2,
|
|
||||||
VSH_CMD_BLOCK_PULL_INFO = 3
|
|
||||||
} vshCmdBlockPullMode;
|
|
||||||
|
|
||||||
static int
|
|
||||||
blockPullImpl(vshControl *ctl, const vshCmd *cmd,
|
|
||||||
virDomainBlockPullInfoPtr info, int mode)
|
|
||||||
{
|
|
||||||
virDomainPtr dom;
|
|
||||||
const char *name, *path;
|
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (!vshConnectionUsability(ctl, ctl->conn))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (vshCommandOptString(cmd, "path", &path) < 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (mode == VSH_CMD_BLOCK_PULL_ONE)
|
|
||||||
ret = virDomainBlockPull(dom, path, info, 0);
|
|
||||||
else if (mode == VSH_CMD_BLOCK_PULL_ALL)
|
|
||||||
ret = virDomainBlockPullAll(dom, path, 0);
|
|
||||||
else if (mode == VSH_CMD_BLOCK_PULL_ABORT)
|
|
||||||
ret = virDomainBlockPullAbort(dom, path, 0);
|
|
||||||
else if (mode == VSH_CMD_BLOCK_PULL_INFO)
|
|
||||||
ret = virDomainGetBlockPullInfo(dom, path, info, 0);
|
|
||||||
|
|
||||||
virDomainFree(dom);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* "blockpull" command
|
|
||||||
*/
|
|
||||||
static const vshCmdInfo info_block_pull[] = {
|
|
||||||
{"help", N_("Populate a disk from its backing image.")},
|
|
||||||
{"desc", N_("Populate a disk from its backing image.")},
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
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")},
|
|
||||||
{"all", VSH_OT_BOOL, VSH_OFLAG_NONE, N_("Populate the entire disk")},
|
|
||||||
{"abort", VSH_OT_BOOL, VSH_OFLAG_NONE, N_("Stop populating this disk")},
|
|
||||||
{NULL, 0, 0, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool
|
|
||||||
cmdBlockPull(vshControl *ctl, const vshCmd *cmd)
|
|
||||||
{
|
|
||||||
virDomainBlockPullInfo info;
|
|
||||||
int mode;
|
|
||||||
bool all = vshCommandOptBool(cmd, "all");
|
|
||||||
bool do_abort = vshCommandOptBool(cmd, "abort");
|
|
||||||
|
|
||||||
if (all && do_abort) {
|
|
||||||
vshError(ctl, "%s", _("--all and --abort are mutually exclusive"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (all)
|
|
||||||
mode = VSH_CMD_BLOCK_PULL_ALL;
|
|
||||||
else if (do_abort)
|
|
||||||
mode = VSH_CMD_BLOCK_PULL_ABORT;
|
|
||||||
else
|
|
||||||
mode = VSH_CMD_BLOCK_PULL_ONE;
|
|
||||||
|
|
||||||
if (blockPullImpl(ctl, cmd, &info, mode) != 0)
|
|
||||||
return false;
|
|
||||||
if (mode == VSH_CMD_BLOCK_PULL_ONE)
|
|
||||||
print_job_progress("Block pull", info.end - info.cur, info.end);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* "blockpullinfo" command
|
|
||||||
*/
|
|
||||||
static const vshCmdInfo info_block_pull_info[] = {
|
|
||||||
{"help", N_("Check progress of an active block pull operation.")},
|
|
||||||
{"desc", N_("Check progress of an active block pull operation.")},
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
static const vshCmdOptDef opts_block_pull_info[] = {
|
|
||||||
{"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")},
|
|
||||||
{NULL, 0, 0, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool
|
|
||||||
cmdBlockPullInfo(vshControl *ctl, const vshCmd *cmd)
|
|
||||||
{
|
|
||||||
virDomainBlockPullInfo info;
|
|
||||||
|
|
||||||
if (blockPullImpl(ctl, cmd, &info, VSH_CMD_BLOCK_PULL_INFO) != 0)
|
|
||||||
return false;
|
|
||||||
print_job_progress("Block pull", info.end - info.cur, info.end);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "net-autostart" command
|
* "net-autostart" command
|
||||||
*/
|
*/
|
||||||
@ -11649,8 +11539,6 @@ static const vshCmdDef domManagementCmds[] = {
|
|||||||
info_attach_interface, 0},
|
info_attach_interface, 0},
|
||||||
{"autostart", cmdAutostart, opts_autostart, info_autostart, 0},
|
{"autostart", cmdAutostart, opts_autostart, info_autostart, 0},
|
||||||
{"blkiotune", cmdBlkiotune, opts_blkiotune, info_blkiotune, 0},
|
{"blkiotune", cmdBlkiotune, opts_blkiotune, info_blkiotune, 0},
|
||||||
{"blockpull", cmdBlockPull, opts_block_pull, info_block_pull, 0},
|
|
||||||
{"blockpullinfo", cmdBlockPullInfo, opts_block_pull_info, info_block_pull_info, 0},
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
{"console", cmdConsole, opts_console, info_console, 0},
|
{"console", cmdConsole, opts_console, info_console, 0},
|
||||||
#endif
|
#endif
|
||||||
|
@ -371,20 +371,6 @@ Configure a domain to be automatically started at boot.
|
|||||||
|
|
||||||
The option I<--disable> disables autostarting.
|
The option I<--disable> disables autostarting.
|
||||||
|
|
||||||
=item B<blockpull> I<domain-id> I<path> optional { I<--all> | I<--abort> }
|
|
||||||
|
|
||||||
Request that the hypervisor update a thin-provisioned I<disk> (a disk
|
|
||||||
image belonging to I<domain-id>) by pulling data from the backing
|
|
||||||
source into the main disk image. This command defaults to pulling one
|
|
||||||
block at a time. Using I<--all> requests that all data be pulled in
|
|
||||||
the background, and progress can be tracked with B<blockpullinfo>.
|
|
||||||
Using <--abort> will stop a long-running <--all>.
|
|
||||||
|
|
||||||
=item B<blockpullinfo> I<domain-id> I<disk>
|
|
||||||
|
|
||||||
Get information about the current status of a B<blockpull> operation
|
|
||||||
started on B<disk>.
|
|
||||||
|
|
||||||
=item B<console> I<domain-id> [I<devname>]
|
=item B<console> I<domain-id> [I<devname>]
|
||||||
|
|
||||||
Connect the virtual serial console for the guest. The optional
|
Connect the virtual serial console for the guest. The optional
|
||||||
|
Loading…
Reference in New Issue
Block a user