On Wed, Jul 12, 2017 at 15:18:58 +0200, Pavel Hrdina wrote:
On Wed, Jul 12, 2017 at 02:56:50PM +0200, Jiri Denemark wrote:
Separated from qemuProcessUpdateAndVerifyCPU to handle updating of an active guest CPU definition according to live data from QEMU.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_process.c | 70 +++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 28 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ebd13057b..926c64197 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4011,17 +4011,53 @@ qemuProcessVerifyCPU(virDomainObjPtr vm,
static int +qemuProcessUpdateLiveGuestCPU(virDomainObjPtr vm, + virCPUDataPtr enabled, + virCPUDataPtr disabled) +{ + virDomainDefPtr def = vm->def; + qemuDomainObjPrivatePtr priv = vm->privateData; + virCPUDefPtr orig = NULL; + int rc; + int ret = -1; + + if (!enabled || + !def->cpu || + (def->cpu->mode == VIR_CPU_MODE_CUSTOM && + !def->cpu->model))
Now the condition is extended by another check, this makes the code fragile. I would prefer separating the "!enabled".
OK Jirka