diff options
Diffstat (limited to 'tuskar_ui/api/node.py')
-rw-r--r-- | tuskar_ui/api/node.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tuskar_ui/api/node.py b/tuskar_ui/api/node.py index 12b037b4..2ad65195 100644 --- a/tuskar_ui/api/node.py +++ b/tuskar_ui/api/node.py @@ -11,6 +11,7 @@ # under the License. import logging +import time from django.conf import settings from django.utils.translation import ugettext_lazy as _ @@ -56,6 +57,7 @@ IRONIC_DISCOVERD_URL = getattr(settings, 'IRONIC_DISCOVERD_URL', None) LOG = logging.getLogger(__name__) +@memoized.memoized def ironicclient(request): api_version = 1 kwargs = {'os_auth_token': request.user.token.id, @@ -156,6 +158,7 @@ class Node(base.APIResourceWrapper): return cls(node, request) @classmethod + @memoized.memoized @handle_errors(_("Unable to retrieve node")) def get(cls, request, uuid): """Return the Node that matches the ID @@ -199,6 +202,7 @@ class Node(base.APIResourceWrapper): return cls(node, request, server) @classmethod + @memoized.memoized @handle_errors(_("Unable to retrieve nodes"), []) def list(cls, request, associated=None, maintenance=None): """Return a list of Nodes @@ -263,6 +267,11 @@ class Node(base.APIResourceWrapper): for uuid in uuids: discoverd_client.introspect(uuid, IRONIC_DISCOVERD_URL, request.user.token.id) + # NOTE(dtantsur): PXE firmware on virtual machines misbehaves when + # a lot of nodes start DHCPing simultaneously: it ignores NACK from + # DHCP server, tries to get the same address, then times out. Work + # around it by using sleep, anyway introspection takes much longer. + time.sleep(5) @classmethod def set_maintenance(cls, request, uuid, maintenance): @@ -302,6 +311,7 @@ class Node(base.APIResourceWrapper): return cls(node, request) @classmethod + @memoized.memoized def list_ports(cls, request, uuid): """Return a list of ports associated with this Node |