diff options
author | George Kraft <george.kraft@calxeda.com> | 2013-06-07 17:16:29 -0500 |
---|---|---|
committer | George Kraft <george.kraft@calxeda.com> | 2013-06-07 17:16:29 -0500 |
commit | 530ff68d7fe9eecec3381ca47ba4c2c6e0ed92c3 (patch) | |
tree | 9e54e3a4711b530b7d3cea3e2e168fd31006a919 | |
parent | 7087e92d40310d9bb6c8b4a6bb1baf7c3b73bee7 (diff) | |
download | cxmanage-530ff68d7fe9eecec3381ca47ba4c2c6e0ed92c3.tar.gz |
CXMAN-207: Retry firmware TFTP transfers up to 3 times
If the initial RRQ or WRQ packet out is dropped, tftpy seems to
break and never retries. We need to be more tolerant than that, so
just retry the transfer a couple of times.
We used to do that anyway.
-rw-r--r-- | cxmanage_api/node.py | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/cxmanage_api/node.py b/cxmanage_api/node.py index 9ccae97..efd38ba 100644 --- a/cxmanage_api/node.py +++ b/cxmanage_api/node.py @@ -1351,10 +1351,14 @@ class Node(object): filename = image.render_to_simg(priority, daddr) basename = os.path.basename(filename) - try: - self.bmc.register_firmware_write(basename, partition_id, image.type) - self.ecme_tftp.put_file(filename, basename) - except (IpmiError, TftpException): + for x in xrange(2): + try: + self.bmc.register_firmware_write(basename, partition_id, image.type) + self.ecme_tftp.put_file(filename, basename) + break + except (IpmiError, TftpException): + pass + else: # Fall back and use TFTP server self.tftp.put_file(filename, basename) result = self.bmc.update_firmware(basename, partition_id, @@ -1376,10 +1380,14 @@ class Node(object): partition_id = int(partition.partition) image_type = partition.type.split()[1][1:-1] - try: - self.bmc.register_firmware_read(basename, partition_id, image_type) - self.ecme_tftp.get_file(basename, filename) - except (IpmiError, TftpException): + for x in xrange(2): + try: + self.bmc.register_firmware_read(basename, partition_id, image_type) + self.ecme_tftp.get_file(basename, filename) + break + except (IpmiError, TftpException): + pass + else: # Fall back and use TFTP server result = self.bmc.retrieve_firmware(basename, partition_id, image_type, self.tftp_address) |