diff options
author | George Kraft <george.kraft@calxeda.com> | 2013-10-01 15:35:04 -0500 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2013-10-01 15:35:04 -0500 |
commit | 15433b9d93150d212562be13a2b2f10e8b9dd9b3 (patch) | |
tree | f07624afe01cba93a7371ce620a230f4a586be10 | |
parent | 25d3656b4837842e6b06a65e88a00a977eb3e198 (diff) | |
download | cxmanage-15433b9d93150d212562be13a2b2f10e8b9dd9b3.tar.gz |
CXMAN-238: Only spawn a single InternalTftp instance by default
I don't think each node needs its own TFTP server.
-rw-r--r-- | cxmanage_api/fabric.py | 2 | ||||
-rw-r--r-- | cxmanage_api/node.py | 2 | ||||
-rw-r--r-- | cxmanage_api/tftp.py | 8 |
3 files changed, 10 insertions, 2 deletions
diff --git a/cxmanage_api/fabric.py b/cxmanage_api/fabric.py index 8a42ea7..564c97f 100644 --- a/cxmanage_api/fabric.py +++ b/cxmanage_api/fabric.py @@ -156,7 +156,7 @@ class Fabric(object): """ if (not self._tftp): - self._tftp = InternalTftp() + self._tftp = InternalTftp.default() return self._tftp diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py index b0d7922..f720d28 100644 --- a/cxmanage_api/node.py +++ b/cxmanage_api/node.py @@ -88,7 +88,7 @@ class Node(object): image=None, ubootenv=None, ipretriever=None): """Default constructor for the Node class.""" if (not tftp): - tftp = InternalTftp() + tftp = InternalTftp.default() # Dependency Integration if (not bmc): diff --git a/cxmanage_api/tftp.py b/cxmanage_api/tftp.py index 91671cc..58b6cee 100644 --- a/cxmanage_api/tftp.py +++ b/cxmanage_api/tftp.py @@ -62,6 +62,14 @@ class InternalTftp(Thread): :type verbose: boolean """ + _default = None + + @staticmethod + def default(): + """ Return the default InternalTftp server """ + if InternalTftp._default == None: + InternalTftp._default = InternalTftp() + return InternalTftp._default def __init__(self, ip_address=None, port=0, verbose=False): super(InternalTftp, self).__init__() |