Support job cancellation in QEMU driver

This supports cancellation of jobs for the QEMU driver against
the virDomainMigrate, virDomainSave and virDomainCoreDump APIs.
It is not yet supported for the virDomainRestore API, although
it is desirable.

* src/qemu/qemu_driver.c: Issue 'migrate_cancel' command if
  virDomainAbortJob is issued during a migration operation
* tools/virsh.c: Add a domjobabort command
This commit is contained in:
Daniel P. Berrange
2010-02-03 19:11:27 +00:00
parent b1a7ebfdec
commit 04c7abd9c3
2 changed files with 99 additions and 4 deletions

View File

@@ -1906,6 +1906,42 @@ cleanup:
return ret;
}
/*
* "domjobabort" command
*/
static const vshCmdInfo info_domjobabort[] = {
{"help", gettext_noop("abort active domain job")},
{"desc", gettext_noop("Aborts the currently running domain job")},
{NULL, NULL}
};
static const vshCmdOptDef opts_domjobabort[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")},
{NULL, 0, 0, NULL}
};
static int
cmdDomjobabort(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int ret = TRUE;
unsigned int id;
char *str, uuid[VIR_UUID_STRING_BUFLEN];
if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
return FALSE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return FALSE;
if (virDomainAbortJob(dom) < 0)
ret = FALSE;
cleanup:
virDomainFree(dom);
return ret;
}
/*
* "freecell" command
*/
@@ -7621,6 +7657,7 @@ static const vshCmdDef commands[] = {
{"domuuid", cmdDomuuid, opts_domuuid, info_domuuid},
{"dominfo", cmdDominfo, opts_dominfo, info_dominfo},
{"domjobinfo", cmdDomjobinfo, opts_domjobinfo, info_domjobinfo},
{"domjobabort", cmdDomjobabort, opts_domjobabort, info_domjobabort},
{"domname", cmdDomname, opts_domname, info_domname},
{"domstate", cmdDomstate, opts_domstate, info_domstate},
{"domblkstat", cmdDomblkstat, opts_domblkstat, info_domblkstat},