[nova][neutron][openstacksdk] Any API way to tell the difference for openstack ports created manually or automatically?

Sean Mooney smooney at redhat.com
Thu Jan 5 12:32:01 UTC 2023


On Thu, 2023-01-05 at 10:08 +0100, Slawek Kaplonski wrote:
> Hi,
> 
> Dnia czwartek, 5 stycznia 2023 03:54:25 CET hai wu pisze:
> > I could not find any API way to tell the difference between openstack
> > ports created automatically when a new instance got created, and
> > openstack ports manually created for port reservation purposes.
> > 
> > There's 'preserve_on_delete' attribute in the openstack database for
> > each vm instance, and if it is set to 'true', then the port was
> > manually created, if not, then it was automatically created. But
> > there's no API to retrieve this.
> > 
> > Am I missing something?
> > 
> > Hai
> > 
> > 
> 
> You are no missing anything. There is no way to check that using API (both Neutron nor Nova).
ya i think you can tell from the nova db if it was created by nova by corralating the virutal interface table and request spec for the instance
but its not somethign you can tell form the api or form neutron's perspective.

there are some cases where preserve_on_delete can be lost too. namely if neutron breaks and the network info cache is currpted and teh ports are
removed form the cache when the cache is forcefully rebuilt the value of preserve_on_delete may not be preserved.
https://bugs.launchpad.net/nova/+bug/1834463 we also have https://bugs.launchpad.net/nova/+bug/1976545
one of the possible fixes for the later https://review.opendev.org/c/openstack/nova/+/844326 would ideally involve a new neutron api extention to 
model delete_on_detach

im not sure if that is related to why you asked this question?
can you expalin why you are trying to determin if it was manually created vs created by nova?

> 




More information about the openstack-discuss mailing list