Skip to content

add retries for get_network_adapter_name_by_mac_address #47

@noliaoliao

Description

@noliaoliao

for my testes, sometimes cloudbase-init can't initialize interface correctly, and lookup the log we can see the exception as below

2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init [-] plugin 'NetworkConfigPlugin' failed with error 'Network interface with MAC address "24:6e:96:27:d4:38" not found': cloudbaseinit.exception.ItemNotFoundException: Network interface with MAC address "24:6e:96:27:d4:38" not found
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init [-] Network interface with MAC address "24:6e:96:27:d4:38" not found: cloudbaseinit.exception.ItemNotFoundException: Network interface with MAC address "24:6e:96:27:d4:38" not found
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init Traceback (most recent call last):
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\init.py", line 67, in _exec_plugin
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     shared_data)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 307, in execute
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     return self._process_network_details_v2(network_details)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 296, in _process_network_details_v2
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     osutils, network_details)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 198, in _process_physical_links
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     link.mac_address)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init   File "c:\program files\cloudbase solutions\cloudbase-init\python\lib\site-packages\cloudbaseinit\osutils\windows.py", line 752, in get_network_adapter_name_by_mac_address
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init     mac_address)
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init cloudbaseinit.exception.ItemNotFoundException: Network interface with MAC address "24:6e:96:27:d4:38" not found
2020-05-22 14:03:21.273 2968 ERROR cloudbaseinit.init 

I guess this is because when cloud-init run, the NICs are don't seen by OS, so we should add more retries here, just like this commint
41161e5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions