OS-EXT-SRV-ATTR incomplete in compute api
Hi, is there a reason why some member variables of the nova instance object are returned by the api and some not. For example the "os_type" value is not returned but the "kernel_id" (OS-EXT-SRV-ATTR:kernel_id) is. I have a use case where it would be very helpful to get the "os_type" via the api and python sdk. Is there a chance that a patch implementing this would be accepted? Regards, Jan
On 29/01/2025 15:58, Jan wrote:
Hi,
is there a reason why some member variables of the nova instance object are returned by the api and some not. yes some are admin only and other are accessible to the member/reader role.
For example the "os_type" value is not returned but the "kernel_id" (OS-EXT-SRV-ATTR:kernel_id) is.
os_type is not an atirbute of the instance its a properlty on the image. we do not currently support showing the image proerties in general kernel_id is diffent because when you create an instance you can optionally specify an addtion kernl image to use. i belive this can also be encoded as an image property but it can be passed in the api request so kernel_id is returned in server show because it can be passed as part of the create request. if you would like to be able to see the image properties like os_type in the server show reponce you will be happy to know that we are adding that this cycle https://review.opendev.org/c/openstack/nova/+/939649 that will bring parity with flavor extra specs.
I have a use case where it would be very helpful to get the "os_type" via the api and python sdk.
Is there a chance that a patch implementing this would be accepted?
on its own no but it will be added by https://review.opendev.org/c/openstack/nova/+/939649 as i said instance do not have an os_type but the root disk image does have one. so you will be able to chekc the os_type in the image properties once that is merged. as this is an api change it will not be backportable.
Regards, Jan
On 1/29/25 19:45, Sean Mooney wrote:
On 29/01/2025 15:58, Jan wrote:
Hi,
is there a reason why some member variables of the nova instance object are returned by the api and some not. yes some are admin only and other are accessible to the member/reader role.
For example the "os_type" value is not returned but the "kernel_id" (OS-EXT-SRV-ATTR:kernel_id) is.
os_type is not an atirbute of the instance its a properlty on the image.
How do you distinguish between image properties and attributes of an instance? The os_type attribute is a field in the "Instance" class, and thus a column in the instance table in the nova database. There also exists an entry in the system_metadata table if os_type on an image was set. But os_type dependent settings, such as enabling of the hyperv feature emulation, depend only on the setting in the instance table.
we do not currently support showing the image proerties in general
kernel_id is diffent because when you create an instance you can optionally specify an addtion kernl image to use.
i belive this can also be encoded as an image property but it can be passed in the api request
so kernel_id is returned in server show because it can be passed as part of the create request.
if you would like to be able to see the image properties like os_type in the server show reponce you will be happy
to know that we are adding that this cycle https://review.opendev.org/c/openstack/nova/+/939649
that will bring parity with flavor extra specs.
I have a use case where it would be very helpful to get the "os_type" via the api and python sdk.
Is there a chance that a patch implementing this would be accepted?
on its own no but it will be added by https://review.opendev.org/c/openstack/nova/+/939649
Thanks for the hint. I will definitely look into this.
as i said instance do not have an os_type but the root disk image does have one.
so you will be able to chekc the os_type in the image properties once that is merged.
as this is an api change it will not be backportable.
Regards, Jan
On 29/01/2025 19:54, Jan wrote:
On 1/29/25 19:45, Sean Mooney wrote:
On 29/01/2025 15:58, Jan wrote:
Hi,
is there a reason why some member variables of the nova instance object are returned by the api and some not. yes some are admin only and other are accessible to the member/reader role.
For example the "os_type" value is not returned but the "kernel_id" (OS-EXT-SRV-ATTR:kernel_id) is.
os_type is not an atirbute of the instance its a properlty on the image.
How do you distinguish between image properties and attributes of an instance?
The os_type attribute is a field in the "Instance" class, and thus a column in the instance table in the nova database.
that is an artiface of the very early days of nova. i belive it predates the intoduction of glance. the instance os_type is now (for many years) an atribute of the root disk iamge https://github.com/openstack/nova/blob/master/nova/objects/image_meta.py#L60... https://github.com/openstack/glance/blob/master/etc/metadefs/compute-libvirt... the OS_TYPE is not a feild in the request you pass to nova to create the instance, it is populated form the image if its set on the image. in the past the xenAPI had a default_os_type config option which was also a vector to cofnigre it. today the os_type can only be set via the os_type image property i dont belive the OS_TYPE on the instance is actully used anymore for anything meaning full. i think the only reaons we have not removed it si to avoid the upgrade impact of the db schema contreaction and the fact that we can only remove it form the instance object on a major version bump which is a lot of work for little gain.
There also exists an entry in the system_metadata table if os_type on an image was set. But os_type dependent settings, such as enabling of the hyperv feature emulation, depend only on the setting in the instance table.
we do not currently support showing the image proerties in general
kernel_id is diffent because when you create an instance you can optionally specify an addtion kernl image to use.
i belive this can also be encoded as an image property but it can be passed in the api request
so kernel_id is returned in server show because it can be passed as part of the create request.
if you would like to be able to see the image properties like os_type in the server show reponce you will be happy
to know that we are adding that this cycle https://review.opendev.org/c/openstack/nova/+/939649
that will bring parity with flavor extra specs.
I have a use case where it would be very helpful to get the "os_type" via the api and python sdk.
Is there a chance that a patch implementing this would be accepted?
on its own no but it will be added by https://review.opendev.org/c/openstack/nova/+/939649
Thanks for the hint. I will definitely look into this.
this is the realted spec https://specs.openstack.org/openstack/nova-specs/specs/2025.1/approved/image...
as i said instance do not have an os_type but the root disk image does have one.
so you will be able to chekc the os_type in the image properties once that is merged.
as this is an api change it will not be backportable.
Regards, Jan
We use os_type on images as a means for scheduling workload based on what image was selected. Several years later the best idea would probably to have used a more custom property name :) On 29 Jan 2025, at 21:30, Sean Mooney <smooney@redhat.com> wrote: On 29/01/2025 19:54, Jan wrote: On 1/29/25 19:45, Sean Mooney wrote: On 29/01/2025 15:58, Jan wrote: Hi, is there a reason why some member variables of the nova instance object are returned by the api and some not. yes some are admin only and other are accessible to the member/reader role. For example the "os_type" value is not returned but the "kernel_id" (OS-EXT-SRV-ATTR:kernel_id) is. os_type is not an atirbute of the instance its a properlty on the image. How do you distinguish between image properties and attributes of an instance? The os_type attribute is a field in the "Instance" class, and thus a column in the instance table in the nova database. that is an artiface of the very early days of nova. i belive it predates the intoduction of glance. the instance os_type is now (for many years) an atribute of the root disk iamge https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenstack%2Fnova%2Fblob%2Fmaster%2Fnova%2Fobjects%2Fimage_meta.py%23L604-L607&data=05%7C02%7Ctobias.urdin%40binero.com%7C126ba5abbf3f47406b9008dd40a3ea0c%7C89d97f28180f459da0e585855aa63f6c%7C0%7C0%7C638737794939603684%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=8t5juIK8XWdls4u3WB1qZkYakpA6ZIVq6n6t5phN1hQ%3D&reserved=0<https://github.com/openstack/nova/blob/master/nova/objects/image_meta.py#L604-L607> https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fopenstack%2Fglance%2Fblob%2Fmaster%2Fetc%2Fmetadefs%2Fcompute-libvirt-image.json%23L103-L111&data=05%7C02%7Ctobias.urdin%40binero.com%7C126ba5abbf3f47406b9008dd40a3ea0c%7C89d97f28180f459da0e585855aa63f6c%7C0%7C0%7C638737794939619922%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=6nZ550ROrbDuhqDZBP2nqa9PsS4GuIkOOBQDslgX%2BeY%3D&reserved=0<https://github.com/openstack/glance/blob/master/etc/metadefs/compute-libvirt-image.json#L103-L111> the OS_TYPE is not a feild in the request you pass to nova to create the instance, it is populated form the image if its set on the image. in the past the xenAPI had a default_os_type config option which was also a vector to cofnigre it. today the os_type can only be set via the os_type image property i dont belive the OS_TYPE on the instance is actully used anymore for anything meaning full. i think the only reaons we have not removed it si to avoid the upgrade impact of the db schema contreaction and the fact that we can only remove it form the instance object on a major version bump which is a lot of work for little gain. There also exists an entry in the system_metadata table if os_type on an image was set. But os_type dependent settings, such as enabling of the hyperv feature emulation, depend only on the setting in the instance table. we do not currently support showing the image proerties in general kernel_id is diffent because when you create an instance you can optionally specify an addtion kernl image to use. i belive this can also be encoded as an image property but it can be passed in the api request so kernel_id is returned in server show because it can be passed as part of the create request. if you would like to be able to see the image properties like os_type in the server show reponce you will be happy to know that we are adding that this cycle https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.opendev.org%2Fc%2Fopenstack%2Fnova%2F%2B%2F939649&data=05%7C02%7Ctobias.urdin%40binero.com%7C126ba5abbf3f47406b9008dd40a3ea0c%7C89d97f28180f459da0e585855aa63f6c%7C0%7C0%7C638737794939631857%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=ziCqd5MiBSD91xmafdpz2tN1bju8lTOU875knEt4OZA%3D&reserved=0<https://review.opendev.org/c/openstack/nova/+/939649> that will bring parity with flavor extra specs. I have a use case where it would be very helpful to get the "os_type" via the api and python sdk. Is there a chance that a patch implementing this would be accepted? on its own no but it will be added by https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Freview.opendev.org%2Fc%2Fopenstack%2Fnova%2F%2B%2F939649&data=05%7C02%7Ctobias.urdin%40binero.com%7C126ba5abbf3f47406b9008dd40a3ea0c%7C89d97f28180f459da0e585855aa63f6c%7C0%7C0%7C638737794939645441%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=Y9J7uDLHUmuVh2jFFfGM8qnJ7gqCoPGoX7kjPs2IlzE%3D&reserved=0<https://review.opendev.org/c/openstack/nova/+/939649> Thanks for the hint. I will definitely look into this. this is the realted spec https://eur05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fspecs.openstack.org%2Fopenstack%2Fnova-specs%2Fspecs%2F2025.1%2Fapproved%2Fimage-props-in-server-show.html&data=05%7C02%7Ctobias.urdin%40binero.com%7C126ba5abbf3f47406b9008dd40a3ea0c%7C89d97f28180f459da0e585855aa63f6c%7C0%7C0%7C638737794939657086%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=7AOBAnpxZJnDxVaS7gODQO2KzyFjTpxjs6YwGGJ%2BeZg%3D&reserved=0<https://specs.openstack.org/openstack/nova-specs/specs/2025.1/approved/image-props-in-server-show.html> as i said instance do not have an os_type but the root disk image does have one. so you will be able to chekc the os_type in the image properties once that is merged. as this is an api change it will not be backportable. Regards, Jan
participants (3)
-
Jan
-
Sean Mooney
-
Tobias Urdin - Binero IT