Metadata service {devices list}

Laurent Dumont laurentfdumont at gmail.com
Tue Apr 5 23:58:19 UTC 2022


Trying to trace the code that I dont fully grasp :D

We start in nova/base.py
https://github.com/openstack/nova/blob/stable/ussuri/nova/api/metadata/base.py

We seem to generate a device array with a bunch of stuff inside

        if self._check_os_version(NEWTON_ONE, version):
            metadata['devices'] = self._get_device_metadata(version)

(but only if the version is higher than NEWTON_ONE? I dont think we
generate the file every single time someone calls the API so it's probably
at VM creation only?)

Looking at the code for _get_device_metadata

https://github.com/openstack/nova/blob/184a3c976faed38907af148a533bc6e9faa410f5/nova/api/metadata/base.py#L367

It seems we try to build an array for Metadata specifically. It's not
expected to be a full list of all the actual devices (ports + disks).

I'll see if I add a tag to a port, does it now show up?

On Tue, Apr 5, 2022 at 7:29 PM Laurent Dumont <laurentfdumont at gmail.com>
wrote:

> Circling back on this, I see the same in my kolla-ansible + Ussuri.
>
> {"uuid": "a916a95d-3f9b-4e5e-9f64-894470742d8b", "hostname":
> "test-laurent.novalocal", "name": "test-laurent", "launch_index": 0,
> "availability_zone": "nova", "random_seed":
> "EEO9FjZLP51L4DDzQV09NRlwUeuKQa+XlGEWp3nH3XKXCnM5vEwhVgw/qG2kuqLN3HZ+oQIcLsnFPwoCsr5TuYodLTTTEhHgo0xJwZ3mlY/P6Br7QWCOyXCDEIKDxxfvxXhDOKtf9OFkFNROD9GDc4vWrOeCDGtcKshf5QZLsgiIv07fQus9axsqGYosNPdOKAejRa+gVtQfxlqV0kVcVIWWOAQOQdVh/TfoBGaxc8FjSCj/9MHLUMYP/zPSj+NRU4G1AwlKHzmxxiF4LQwHCBuy6dNrG+ImpUs6nLORjlDAgovoMhwIgDVhgihel4eFoT8f2izuq42yCen7yRU7FSfJcL40IlTmdHVTJTfChS2+yP5Y5SjeNHAmO6xCRJ9CCliRXIj8hsCjD0triQi2LCMC/gvZoaLSeczSzUgmL3zEFB+9IcalUuvf4yChK2OqpGfK94YlWR/U7fivdyUMChlaUC9BilPJUkUpCPL2wHiKKQMpPVFK5sRZoFe7nnegLRrMvYKuCPbtp99VqCCm2ts/6u6dgCHZdUD+NvOYUOMBGXYcQz0DVIpF/HyAI+AuW/5HAPCw66NZfwsCfMugzGf5+ljm8zr4UU//pf0vMCVX690dGyVraB/ozuXg1rdQYF8f7iDh9v2vkR+oanuC1sY6bHV+DRMhfc/Xp+KFDCc=",
> "project_id": "4db7dbf9961c4fc6a4589a5cb2ae3c9a", "devices": []}#
>
> Nothing in Devices
>
> But I see it in the network endpoint
>
> # curl http://169.254.169.254/openstack/2018-08-27/network_data.json
> {"links": [{"id": "tap1b4490ec-76", "vif_id":
> "1b4490ec-76b9-4223-9a31-837d60b13cc2", "type": "ovs", "mtu": 1450,
> "ethernet_mac_address": "fa:16:3e:58:a4:4a"}], "networks": [{"id":
> "network0", "type": "ipv4_dhcp", "link": "tap1b4490ec-76", "network_id":
> "bef77274-defd-463c-814a-5051ea2acae0"}], "services": []}#
>
> I'll look at the code, but I am not clear where that snippet is
> being generated. It could be expected that the devices array is empty.
>
> On Sun, Mar 20, 2022 at 11:11 AM Ahmed Abdelhamid <
> ahmedabdelhamid1221 at gmail.com> wrote:
>
>> Thanks. It's OpenStack ussuri, deployed via kolla-ansible
>>
>> On Fri, Mar 18, 2022 at 10:06 PM Laurent Dumont <laurentfdumont at gmail.com>
>> wrote:
>>
>>> That is weird.
>>>
>>>    - What version of Openstack are you running?
>>>    - How was it deployed?
>>>
>>>
>>> On Fri, Mar 18, 2022 at 9:30 AM Ahmed Abdelhamid <
>>> ahmedabdelhamid1221 at gmail.com> wrote:
>>>
>>>> Thanks, Laurent. I tried it for both CEPH-backed VMs and ones with
>>>> local disk, still, the devices array is empty
>>>>
>>>> Network data curl shows alright
>>>>
>>>> {"links": [{"id": "tapa.....", "vif_id": "ae....", "type": "bridge",
>>>> "mtu": 1500, "ethernet_mac_address": "fa:......."}], "networks": [{"id":
>>>> "network0", "type": "ipv4_dhcp", "link": "tap.....
>>>>
>>>> On Wed, Mar 16, 2022 at 6:39 PM Laurent Dumont <
>>>> laurentfdumont at gmail.com> wrote:
>>>>
>>>>> Are you getting anything from the neutron endpoint?
>>>>>
>>>>> http://169.254.169.254/openstack/2018-08-27/network_data.json
>>>>>
>>>>> Can you provide an "openstack server show $server_id" of the VM? I
>>>>> wonder if it's a case of boot from a volume VM missing that data. It would
>>>>> not explain why the port is not there though.
>>>>>
>>>>> On Tue, Mar 15, 2022 at 9:15 AM Ahmed Abdelhamid <
>>>>> ahmedabdelhamid1221 at gmail.com> wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I am running into a strange issue with the metadata service. Per metadata-service
>>>>>> manual <https://docs.openstack.org/nova/latest/user/metadata.html>,
>>>>>> the devices attached to a VM should be visible in
>>>>>>
>>>>>> $ curl http://169.254.169.254/openstack/2018-08-27/meta_data.json
>>>>>>
>>>>>> However, whenever i execute it from a VM , the devices array is empty
>>>>>> and looks like this, any idea why ?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> {   "random_seed": "yu5ZnkqF2CqnDZVAfZgarG...",   "availability_zone": "nova",   "keys": [       {         "data": "ssh-rsa AAAAB3NzaC1y...== Generated by Nova\n",         "type": "ssh",         "name": "mykey"       }   ],   "hostname": "test.novalocal",   "launch_index": 0,   "meta": {      "priority": "low",      "role": "webserver"   },   "devices": [ ],   "project_id": "f7ac731cc11f40efbc03a9f9e1d1d21f",   "public_keys": {       "mykey": "ssh-rsa AAAAB3NzaC1y...== Generated by Nova\n"   },   "name": "test"}
>>>>>>
>>>>>>
>>>>>>
>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-discuss/attachments/20220405/3bc8a38b/attachment.htm>


More information about the openstack-discuss mailing list