You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by GitBox <gi...@apache.org> on 2022/01/28 21:38:58 UTC
[GitHub] [libcloud] Kami commented on a change in pull request #1638: OpenStack: Move floating IP functions to use network service instead of nova
Kami commented on a change in pull request #1638:
URL: https://github.com/apache/libcloud/pull/1638#discussion_r794905799
##########
File path: libcloud/compute/drivers/openstack.py
##########
@@ -4441,6 +4510,74 @@ def __repr__(self):
)
+class OpenStack_2_FloatingIpAddress(OpenStack_1_1_FloatingIpAddress):
+ """
+ Floating IP info 2.0.
+ """
+
+ def __init__(self, id, ip_address, pool, node_id=None, driver=None, extra=None):
+ self.id = str(id)
+ self.ip_address = ip_address
+ self._pool = pool
+ self._node_id = node_id
+ self.driver = driver
+ self.extra = extra if extra else {}
+
+ @property
+ def pool(self):
Review comment:
Hm, looks like this method will always try to perform the API call (``ex_get_network()``) on subsequent calls even if the code throws an exception and ``self._pool`` is not populated.
It looks like it's similar story with ``node_id`` property.
I wonder if there is something we could to improve that to avoid surprises - if it was regular method, I would be fine with it, but with a variable / property, this call time overhead is kinda hidden and could be substantial in case operation which is triggered when ``self._pool`` is not populated yet gets called on each property access because that internal variable wasn't populated for some reason (exception or similar).
I guess one simple option would be to simplify set that variable to None on error and return that in case of an error (and use some other special marker value for "not set"). That would only really work though if the underlying operation is synchronous and there is no chance for network errors or other similar exceptions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@libcloud.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org