qemu: Don't try to update undefined guest CPU

Calling virCPUUpdateLive on a domain with no guest CPU configuration
does not make sense. Especially when doing so would crash libvirtd.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2017-03-20 09:03:58 +01:00
parent a6d681485f
commit c74207cb18

View File

@ -3815,11 +3815,6 @@ qemuProcessVerifyCPUFeatures(virDomainDefPtr def,
{
int rc;
if (!def->cpu ||
(def->cpu->mode == VIR_CPU_MODE_CUSTOM &&
!def->cpu->model))
return 0;
rc = virCPUCheckFeature(def->os.arch, def->cpu, "invtsc");
if (rc < 0) {
@ -3870,6 +3865,13 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver,
qemuProcessVerifyHypervFeatures(def, cpu) < 0)
goto cleanup;
if (!def->cpu ||
(def->cpu->mode == VIR_CPU_MODE_CUSTOM &&
!def->cpu->model)) {
ret = 0;
goto cleanup;
}
if (qemuProcessVerifyCPUFeatures(def, cpu) < 0)
goto cleanup;