On Fri, Jul 17, 2020 at 09:04:51PM +0800, Wang Xin wrote:
>The shared memory path is generated by shmem name as default,
>however, we may need to change it to avoid filename conflict
>when VM migrate to other host.
>
At which point there is no need for the name at all. I agree that having the
'name' was an unfortunate decision, but adding more attributes does not seem
like a proper fix. If it needs to be changed then we should allow changing the
name in the process. You can also unplug the old name and plug in the new one,
just like you'd have to do with role='peer'. Did I miss any other reason
for
this?
e.g.
Ivshmem config:
<shmem name='abcdefg'>
<model type='ivshmem-plain'/>
<size unit='M'>4</size>
<alias name='shmem0'/> <!--auto generated in runtime-->
<address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
</shmem>
qemu args:
-object
memory-backend-file,id=shmmem-shmem0,mem-path=/dev/shm/abcdefg,size=4194304,share=yes
-device ivshmem-plain,id=shmem0,memdev=shmmem-shmem0,bus=pci.0,addr=0x3
The shmem 'name' usually mean the ivshmem device name/id, I think we shouldn't
change it in migration.
However, here we use the auto generated 'alias name' as device name/id instead.
Add a new optional attribute for easier understanding what we changed, no other reason.
Update the shmem 'name' will also work, I can support it in V3.