[nova] Questions on Force refresh instance info_cache during heal

Matt Riedemann mriedemos at gmail.com
Wed Jun 26 14:21:22 UTC 2019

On 6/26/2019 4:39 AM, 胡丽娜 wrote:
> Dear Matt Riedemann :
>          I am quiet interested in your recently published 
> patch  https://review.opendev.org/#/c/591607/  , there is  a question i 
> met ,If we spawn VM with port id and then update db , set 
> network_info='[]' , Afert  periodic task_heal_instance_info_cache , 
> Preserve On Delete turn into False , in face ,it's corret value is True .
> Steps to reproduce:
> 1.Spawn vm with port id : nova boot --flavor xx --nic port-id --image xx 
> vm_name
> 2.View the value of Preserve On Delete , it'value is True
> 3.Update the DB row ,drop interface_list
> 4.View the value of Preserve On Delete , it turns into False
> Have you ever had this question ?  Look forward to your reply !
>          Best wishes !
> 胡丽娜  BC-EC
> 中国移动苏州研发中心  云计算产品部
> 中移(苏州)软件技术有限公司
> 苏州高新区科技城昆仑山路58号 中移软件园

+openstack-discuss mailing list

The problem in this case is that nova relies on the network info cache 
to determine which ports were created by nova and which were 
pre-existing and provided by the user, either during server create or 
attached to the server after it was created. When building the network 
info model we determine the pre-existing port IDs here [1] and then pass 
that to _build_vif_model here [2]. We then determine the 
preserve_on_delete value if the port ID is in that pre-existing ports 
set [3].

What we should probably be doing is if we have lost the cache is always 
set preserve_on_delete=True since we don't have the cache information to 
know if we should delete the port when the server is deleted, and it 
could be an SR-IOV port or something that the user does not want 
deleted. The worst case in this scenario is the server is deleted and 
some ports are unbound and left hanging around that the user has to 
manually cleanup but that's arguably better than deleting something they 
didn't want to be deleted. I used some similar logic in this related 
patch [4].

If people agree with this (being conservative when we've lost the 
cache), then please report a bug and we can make the change (it should 
be pretty simple).

[4] https://review.opendev.org/#/c/640516/




More information about the openstack-discuss mailing list