qemu: Fix qemuProcessInitCpuAffinity()
qemu: Fix qemuProcessInitCpuAffinity()

Ever since the feature was introduced with commit 0f8e7ae33ace,
it has contained a logic error in that it attempted to use a NUMA
node map where a CPU map was expected.

Because of that, guests using <numatune> might fail to start:

  # virsh start guest
  error: Failed to start domain guest
  error: cannot set CPU affinity on process 40055: Invalid argument

This was particularly easy to trigger on POWER 8 machines, where
secondary threads always show up as offline in the host: having

  <numatune>
    <memory mode='strict' placement='static' nodeset='1'/>
  </numatune>

in the guest configuration, for example, would result in libvirt
trying to set the process affinity so that it would prefer
running on CPU 1, but since that's a secondary thread and thus
shows up as offline, the operation would fail, and so would
starting the guest.

Use the newly introduced virNumaNodesetToCPUset() to convert the
NUMA node map to a CPU map, which in the example above would be
48,56,64,72,80,88 - a valid input for virProcessSetAffinity().

https://bugzilla.redhat.com/show_bug.cgi?id=1703661

Signed-off-by: Andrea Bolognani <3ada0bee826c753786fdbba72243dfba997094cf@redhat.com>
Reviewed-by: Ján Tomko <4cab11cfb98d3c937327354a78eb07dbb6ee2bc6@redhat.com>

nertpinx/libvirt,nertpinx/libvirt,eskultety/libvirt,fabianfreyer/libvirt,olafhering/libvirt,crobinso/libvirt,libvirt/libvirt,jardasgit/libvirt,eskultety/libvirt,jfehlig/libvirt,fabianfreyer/libvirt,olafhering/libvirt,crobinso/libvirt,andreabolognani/libvirt,andreabolognani/libvirt,andreabolognani/libvirt,jfehlig/libvirt,jardasgit/libvirt,fabianfreyer/libvirt,fabianfreyer/libvirt,olafhering/libvirt,nertpinx/libvirt,nertpinx/libvirt,zippy2/libvirt,olafhering/libvirt,jardasgit/libvirt,crobinso/libvirt,jfehlig/libvirt,zippy2/libvirt,crobinso/libvirt,andreabolognani/libvirt,eskultety/libvirt,nertpinx/libvirt,jardasgit/libvirt,jfehlig/libvirt,zippy2/libvirt,eskultety/libvirt,andreabolognani/libvirt,jardasgit/libvirt,libvirt/libvirt,libvirt/libvirt,eskultety/libvirt,fabianfreyer/libvirt,zippy2/libvirt,libvirt/libvirt