ret = qemuMigrationPerform(driver, dom->conn, vm,
NULL, dconnuri, uri, cookie, cookielen,
NULL, NULL, /* No output cookies in v2 */
- flags, dname, resource, true);
+ flags, dname, resource, false);
cleanup:
qemuDriverUnlock(driver);
*/
dom = qemuMigrationFinish(driver, dconn, vm,
NULL, 0, NULL, NULL, /* No cookies */
- flags, retcode);
+ flags, retcode, false);
cleanup:
if (orig_err) {
ret = qemuMigrationPerform(driver, dom->conn, vm, xmlin,
dconnuri, uri, cookiein, cookieinlen,
cookieout, cookieoutlen,
- flags, dname, resource, false);
+ flags, dname, resource, true);
cleanup:
qemuDriverUnlock(driver);
*newdom = qemuMigrationFinish(driver, dconn, vm,
cookiein, cookieinlen,
cookieout, cookieoutlen,
- flags, cancelled);
+ flags, cancelled, true);
ret = 0;
unsigned long flags,
const char *dname,
unsigned long resource,
- bool killOnFinish)
+ bool v3proto)
{
virDomainEventPtr event = NULL;
int ret = -1;
goto endjob;
}
- /* Clean up the source domain. */
- if (killOnFinish) {
+ /*
+ * In v3 protocol, the source VM is not killed off until the
+ * confirm step.
+ */
+ if (v3proto) {
+ resume = 0;
+ } else {
qemuProcessStop(driver, vm, 1, VIR_DOMAIN_SHUTOFF_MIGRATED);
qemuAuditDomainStop(vm, "migrated");
resume = 0;
char **cookieout,
int *cookieoutlen,
unsigned long flags,
- int retcode)
+ int retcode,
+ bool v3proto)
{
virDomainPtr dom = NULL;
virDomainEventPtr event = NULL;
event = NULL;
}
- dom = virGetDomain (dconn, vm->def->name, vm->def->uuid);
if (!(flags & VIR_MIGRATE_PAUSED)) {
/* run 'cont' on the destination, which allows migration on qemu
*/
if (qemuProcessStartCPUs(driver, vm, dconn,
VIR_DOMAIN_RUNNING_MIGRATED) < 0) {
+ /*
+ * In v3 protocol, the source VM is still available to
+ * restart during confirm() step, so we kill it off
+ * now.
+ * In v2 protocol, the source is dead, so we leave
+ * target in paused state, in case admin can fix
+ * things up
+ */
+ if (v3proto) {
+ qemuProcessStop(driver, vm, 1, VIR_DOMAIN_SHUTOFF_FAILED);
+ qemuAuditDomainStop(vm, "failed");
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_STOPPED,
+ VIR_DOMAIN_EVENT_STOPPED_FAILED);
+ if (!vm->persistent) {
+ if (qemuDomainObjEndJob(vm) > 0)
+ virDomainRemoveInactive(&driver->domains, vm);
+ vm = NULL;
+ }
+ }
if (virGetLastError() == NULL)
qemuReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("resume operation failed"));
}
}
+ dom = virGetDomain (dconn, vm->def->name, vm->def->uuid);
+
event = virDomainEventNewFromObj(vm,
VIR_DOMAIN_EVENT_RESUMED,
VIR_DOMAIN_EVENT_RESUMED_MIGRATED);