~ubuntu-branches/ubuntu/oneiric/swift/oneiric

« back to all changes in this revision

Viewing changes to swift/obj/auditor.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2011-09-02 14:10:27 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: package-import@ubuntu.com-20110902141027-vjxiv7uzkg1ebd4m
Tags: 1.4.3~20110902.354-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
            df = object_server.DiskFile(self.devices, device, partition,
135
135
                                        account, container, obj, self.logger,
136
136
                                        keep_data_fp=True)
137
 
            if df.data_file is None:
138
 
                # file is deleted, we found the tombstone
139
 
                return
140
137
            try:
141
 
                obj_size = df.get_data_file_size()
142
 
            except DiskFileError, e:
143
 
                raise AuditException(str(e))
144
 
            except DiskFileNotExist:
145
 
                return
146
 
            if self.zero_byte_only_at_fps and obj_size:
147
 
                self.passes += 1
148
 
                return
149
 
            for chunk in df:
150
 
                self.bytes_running_time = ratelimit_sleep(
151
 
                    self.bytes_running_time, self.max_bytes_per_second,
152
 
                    incr_by=len(chunk))
153
 
                self.bytes_processed += len(chunk)
154
 
                self.total_bytes_processed += len(chunk)
155
 
            df.close()
156
 
            if df.quarantined_dir:
157
 
                self.quarantines += 1
158
 
                self.logger.error(
159
 
                    _("ERROR Object %(path)s failed audit and will be "
160
 
                      "quarantined: ETag and file's md5 do not match"),
161
 
                    {'path': path})
 
138
                if df.data_file is None:
 
139
                    # file is deleted, we found the tombstone
 
140
                    return
 
141
                try:
 
142
                    obj_size = df.get_data_file_size()
 
143
                except DiskFileError, e:
 
144
                    raise AuditException(str(e))
 
145
                except DiskFileNotExist:
 
146
                    return
 
147
                if self.zero_byte_only_at_fps and obj_size:
 
148
                    self.passes += 1
 
149
                    return
 
150
                for chunk in df:
 
151
                    self.bytes_running_time = ratelimit_sleep(
 
152
                        self.bytes_running_time, self.max_bytes_per_second,
 
153
                        incr_by=len(chunk))
 
154
                    self.bytes_processed += len(chunk)
 
155
                    self.total_bytes_processed += len(chunk)
 
156
                df.close()
 
157
                if df.quarantined_dir:
 
158
                    self.quarantines += 1
 
159
                    self.logger.error(
 
160
                        _("ERROR Object %(path)s failed audit and will be "
 
161
                          "quarantined: ETag and file's md5 do not match"),
 
162
                        {'path': path})
 
163
            finally:
 
164
                df.close(verify_file=False)
162
165
        except AuditException, err:
163
166
            self.quarantines += 1
164
167
            self.logger.error(_('ERROR Object %(obj)s failed audit and will '