153 |
debug(options, "Disk eligible for spinning down") |
debug(options, "Disk eligible for spinning down") |
154 |
# We can spin this disk down |
# We can spin this disk down |
155 |
if not config[disk]["spun_down"]: |
if not config[disk]["spun_down"]: |
156 |
if spin_down(disk): |
if spin_down(options, disk): |
157 |
debug(options, "Disk spun down") |
debug(options, "Disk spun down") |
158 |
config[disk]["spun_down"] = True |
config[disk]["spun_down"] = True |
159 |
else: |
else: |
164 |
# This disk is ineligible for spinning down at this time |
# This disk is ineligible for spinning down at this time |
165 |
debug(options, "Disk idle for %s seconds, but not for long enough (%s)" % (now - config[disk]["timestamp"], config[disk]["wait"])) |
debug(options, "Disk idle for %s seconds, but not for long enough (%s)" % (now - config[disk]["timestamp"], config[disk]["wait"])) |
166 |
else: |
else: |
|
debug(options, "Disk not idle (old msio: %s, current msio: %s)" % (config[disk]["last_msio"], msio)) |
|
167 |
config[disk]["last_msio"] = msio |
config[disk]["last_msio"] = msio |
168 |
config[disk]["timestamp"] = int(time.time()) |
config[disk]["timestamp"] = int(time.time()) |
169 |
config[disk]["spun_down"] = False |
if config[disk]["spun_down"]: |
170 |
|
debug(options, "%s presumed spun back up by activity" % (disk)) |
171 |
|
config[disk]["spun_down"] = False |
172 |
|
debug(options, "Disk not idle (old msio: %s, current msio: %s)" % (config[disk]["last_msio"], msio)) |
173 |
debug(options, "Sleeping") |
debug(options, "Sleeping") |
174 |
time.sleep(60) |
time.sleep(60) |
175 |
debug(options, "Shutting down") |
debug(options, "Shutting down") |