VIR_FREE(priv->migTLSAlias);
qemuDomainMasterKeyFree(priv);
+ virCPUDefFree(priv->origCPU);
+
VIR_FREE(priv);
}
virBufferEscapeString(buf, "<channelTargetDir path='%s'/>\n",
priv->channelTargetDir);
+ virCPUDefFormatBufFull(buf, priv->origCPU, NULL, false);
+
return 0;
}
if (qemuDomainSetPrivatePathsOld(driver, vm) < 0)
goto error;
+ if (virCPUDefParseXML(ctxt, "./cpu", VIR_CPU_TYPE_GUEST, &priv->origCPU) < 0)
+ goto error;
+
return 0;
error:
/* Used when fetching/storing the current 'tls-creds' migration setting */
/* (not to be saved in our private XML). */
char *migTLSAlias;
+
+ /* CPU def used to start the domain when it differs from the one actually
+ * provided by QEMU. */
+ virCPUDefPtr origCPU;
};
# define QEMU_DOMAIN_PRIVATE(vm) \
qemuDomainObjPrivatePtr priv = vm->privateData;
int rc;
int ret = -1;
+ virCPUDefPtr orig = NULL;
if (ARCH_IS_X86(def->os.arch)) {
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
if (qemuProcessVerifyCPUFeatures(def, cpu) < 0)
goto cleanup;
- if ((rc = virCPUUpdateLive(def->os.arch, def->cpu, cpu, disabled)) < 0)
+ if (!(orig = virCPUDefCopy(def->cpu)))
goto cleanup;
- else if (rc == 0)
+
+ if ((rc = virCPUUpdateLive(def->os.arch, def->cpu, cpu, disabled)) < 0) {
+ goto cleanup;
+ } else if (rc == 0) {
+ if (!virCPUDefIsEqual(def->cpu, orig, false))
+ VIR_STEAL_PTR(priv->origCPU, orig);
+
def->cpu->check = VIR_CPU_CHECK_FULL;
+ }
}
ret = 0;
cleanup:
virCPUDataFree(cpu);
virCPUDataFree(disabled);
+ virCPUDefFree(orig);
return ret;
}