Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on filling openstack pool due new instance dont have mac address #116

Closed
dafafdafafadfa opened this issue Sep 25, 2024 · 3 comments
Closed
Assignees

Comments

@dafafdafafadfa
Copy link

master
Exception when fill pool with the opentask live provider.
In our case instances obtains address in minutes later than vm created.

What is expected way for implements get_unique_id()?
Should we await mac address or can use any unique? i.e. instance uuid?

uds.core.managers.userservice_helpers.opchecker:state_updater 266 Checking service state
Traceback (most recent call last):
File "/root/openuds/server/src/uds/core/managers/userservice_helpers/opchecker.py", line 240, in state_updater
userservice.unique_id = userservice_instance.get_unique_id() # Updates uniqueId
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/openuds/server/src/uds/core/services/generics/dynamic/userservice.py", line 346, in get_unique_id
self._mac = self.service().get_mac(self, self._vmid) or ''
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/openuds/server/src/uds/services/OpenStack/service.py", line 265, in get_mac
return self.api.get_server_info(vmid).validated().addresses[0].mac
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
DEBUG 2024-09-24 15:50:00,178 uds.core.managers.userservice:locate_user_service 905 Found service: User service new service pool 2, unique_id , cache_level 0, user vic@new internal database auth (id:1), name , state Error:In preparation
ERROR 2024-09-24 15:50:00,179 uds.web.util.services:enable_service 470 Error
Traceback (most recent call last):
File "/root/openuds/server/src/uds/web/util/services.py", line 431, in enable_service
info = UserServiceManager.manager().get_user_service_info(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/openuds/server/src/uds/core/managers/userservice.py", line 943, in get_user_service_info
raise InvalidServiceException(

@dkmstr
Copy link
Collaborator

dkmstr commented Sep 25, 2024

Unfortunately, UDS needs the mac of the VM in order to allow to be configured. (In fact, the MAC or the IP, but some network related info that, with the template secret, will allow uds to identify vdi).

The best way is simply wait for the MAC to be present, that is, is very easy to patch UDS to allow "delayed" network interface info, simply patching " File "/root/openuds/server/src/uds/services/OpenStack/service.py", line 265, in get_mac" to check if there are adresses and, if not, return empty string... As long as it has no unique id, should keep in.

If it is something normal in OpenStack (i didn't see it before..), i can adapt the code to wait for the mac to be before assuming it has been created...

Also, be care using v4.0 (master branch). It's in an unstable state right now. It will be released as beta probably in a couple of months, but it's not ready for overseed 3.6 on a production environment.

@dafafdafafadfa
Copy link
Author

dafafdafafadfa commented Sep 25, 2024

I think this is typical behavior for openstack. I haven't double-checked how creating a virtual machine looks via API, but via UI it looks exactly like this.
Perhaps there are additional ways to create virtual machines with pre-allocation of network ports, but this method is quite unusual. Thanks for the answer. I feel quite comfortable in the master branch.

@dkmstr
Copy link
Collaborator

dkmstr commented Sep 25, 2024

I have made a change for allowing this.
If i understood, there is no Network until a while after the instance is created, isnt it?

If that is the case, that is, eventually after creating it, it will get a network card and be started correctly, this pull should solve your issues.

c04a2b7

Hope this helps,

(Note the changes to the end of the commit)

@dkmstr dkmstr closed this as completed Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants