<div class="zcontentRow"> <p><span style="font-size: 12px;">>On Sat, Jul 22, 2017 at 05:45:59 -0400, Yi Wang wrote:</span></p><p><span style="font-size: 12px;">>> This patch fix this condition:</span></p><p><span style="font-size: 12px;">>>   -vm has the "auto" placement in vcpu</span></p><p><span style="font-size: 12px;">>>   -hot-plug memory with source node "1-3" through attach-device command</span></p><p><span style="font-size: 12px;">>>   -migrate the vm to a host with only 2 numa node</span></p><p><span style="font-size: 12px;">>> And the migration will fail with error:</span></p><p><span style="font-size: 12px;">>> "error: unsupported configuration: NUMA node 2 is unavailable"</span></p><p><span style="font-size: 12px;">>> </span></p><p><span style="font-size: 12px;">>> Signed-off-by: Yi Wang <wang yi59 zte com cn></span></p><p><span style="font-size: 12px;">>> Signed-off-by: Xi Xu <xu xi8 zte com cn></span></p><p><span style="font-size: 12px;">>> ---</span></p><p><span style="font-size: 12px;">>>  src/qemu/qemu_process.c | 10 ++++++++++</span></p><p><span style="font-size: 12px;">>>  1 file changed, 10 insertions(+)</span></p><p><span style="font-size: 12px;">>> </span></p><p><span style="font-size: 12px;">>> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c</span></p><p><span style="font-size: 12px;">>> index 7b708be..dcc564c 100644</span></p><p><span style="font-size: 12px;">>> --- a/src/qemu/qemu_process.c</span></p><p><span style="font-size: 12px;">>> +++ b/src/qemu/qemu_process.c</span></p><p><span style="font-size: 12px;">>> @@ -5259,6 +5259,16 @@ qemuProcessPrepareDomain(virConnectPtr conn,</span></p><p><span style="font-size: 12px;">>>              goto cleanup;</span></p><p><span style="font-size: 12px;">>>      }</span></p><p><span style="font-size: 12px;">>>  </span></p><p><span style="font-size: 12px;">>> +    VIR_DEBUG("Updating memory source nodes");</span></p><p><span style="font-size: 12px;">>> +    for (i = 0; i < vm->def->nmems; i++) {</span></p><p><span style="font-size: 12px;">>> +        virDomainMemoryDefPtr mem = vm->def->mems[i];</span></p><p><span style="font-size: 12px;">>> +        if (priv->autoNodeset && mem && mem->sourceNodes) {</span></p><p><span style="font-size: 12px;">>> +            virBitmapFree(mem->sourceNodes);</span></p><p><span style="font-size: 12px;">>> +            if (!(mem->sourceNodes = virBitmapNewCopy(priv->autoNodeset)))</span></p><p><span style="font-size: 12px;">>> +                goto cleanup;</span></p><p><span style="font-size: 12px;">></span></p><p><span style="font-size: 12px;">>This is not correct. This code will be executed even during normal</span></p><p><span style="font-size: 12px;">>startup and it would remove any manual pinning the user set-up.</span></p><p><br></p><p><span style="font-size: 12px;">What you said is right, this is indeed a problem that my patch ignored.</span></p><p><br></p><p><span style="font-size: 12px;">></span></p><p><span style="font-size: 12px;">>I think the problem might be that the XML retains the nodesets of</span></p><p><span style="font-size: 12px;">>automatically placed memory modules while formatting the migratable XML.</span></p><p><br></p><p><span style="font-size: 12px;">The problem is that the source nodemask specified in the "virsh attach-device"</span></p><p><span style="font-size: 12px;">XML, which doesn't exist in the destination host. For example:</span></p><p><span style="font-size: 12px;">    <memory model='dimm'></span></p><p><span style="font-size: 12px;">        <target></span></p><p><span style="font-size: 12px;">            <size unit='MiB'>1024</size></span></p><p><span style="font-size: 12px;">            <node>0</node></span></p><p><span style="font-size: 12px;">        </target></span></p><p><span style="font-size: 12px;">        <source></span></p><p><span style="font-size: 12px;">            <nodemask>1-3</nodemask></span></p><p><span style="font-size: 12px;">        </source></span></p><p><span style="font-size: 12px;">    </memory></span></p><p><br></p><p><span style="font-size: 12px;">The source of the problem is that we must set source nodemask when hot-plug</span></p><p><span style="font-size: 12px;">memory dimm when the VM has auto placement, or it failed:</span></p><p><span style="font-size: 12px;"># virsh attach-device centos mem_hp.xml</span></p><p><span style="font-size: 12px;">error: Failed to attach device from mem_hp.xml</span></p><p><span style="font-size: 12px;">error: internal error: Advice from numad is needed in case of automatic numa placement</span></p><p><br></p><p><span style="font-size: 12px;">And after we set source nodemask, it might fail to migrate.</span></p><p><br></p><p><span style="font-size: 12px;">So, a better way to work around this problem is add a "auto" supported to <source>?</span></p><p><span style="font-size: 12px;">Any other suggestion?</span></p><p></p><p><br></p><div class="zMailSign"><div><div><p><span style="font-size: 12px;">---</span></p><p><span style="font-size: 12px;">Best wishes</span></p><p><span style="font-size: 12px;">Yi Wang</span></p></div></div></div><p><br></p></div>