Improve debug logging from ring builder.
The gather/place debug logs used to just contain device IDs; now they include region, zone, and IP. This makes it easier to see what's going on when debugging rebalance operations. Change-Id: I6314e327973c57a34b88ebbb4d3b1594dbacd357
This commit is contained in:
parent
2d18ecdf4b
commit
62509cc8f4
@ -34,7 +34,7 @@ from time import time
|
||||
from swift.common import exceptions
|
||||
from swift.common.ring import RingData
|
||||
from swift.common.ring.utils import tiers_for_dev, build_tier_tree, \
|
||||
validate_and_normalize_address
|
||||
validate_and_normalize_address, pretty_dev
|
||||
|
||||
# we can't store None's in the replica2part2dev array, so we high-jack
|
||||
# the max value for magic to represent the part is not currently
|
||||
@ -1048,8 +1048,8 @@ class RingBuilder(object):
|
||||
dev['parts'] -= 1
|
||||
assign_parts[part].append(replica)
|
||||
self.logger.debug(
|
||||
"Gathered %d/%d from dev %d [dispersion]",
|
||||
part, replica, dev['id'])
|
||||
"Gathered %d/%d from dev %s [dispersion]",
|
||||
part, replica, pretty_dev(dev))
|
||||
self._replica2part2dev[replica][part] = NONE_DEV
|
||||
for tier in dev['tiers']:
|
||||
replicas_at_tier[tier] -= 1
|
||||
@ -1105,8 +1105,8 @@ class RingBuilder(object):
|
||||
dev['parts'] -= 1
|
||||
assign_parts[part].append(replica)
|
||||
self.logger.debug(
|
||||
"Gathered %d/%d from dev %d [weight disperse]",
|
||||
part, replica, dev['id'])
|
||||
"Gathered %d/%d from dev %s [weight disperse]",
|
||||
part, replica, pretty_dev(dev))
|
||||
self._replica2part2dev[replica][part] = NONE_DEV
|
||||
for tier in dev['tiers']:
|
||||
replicas_at_tier[tier] -= 1
|
||||
@ -1177,8 +1177,8 @@ class RingBuilder(object):
|
||||
dev['parts'] -= 1
|
||||
assign_parts[part].append(replica)
|
||||
self.logger.debug(
|
||||
"Gathered %d/%d from dev %d [weight forced]",
|
||||
part, replica, dev['id'])
|
||||
"Gathered %d/%d from dev %s [weight forced]",
|
||||
part, replica, pretty_dev(dev))
|
||||
self._replica2part2dev[replica][part] = NONE_DEV
|
||||
self._set_part_moved(part)
|
||||
|
||||
@ -1299,7 +1299,7 @@ class RingBuilder(object):
|
||||
|
||||
self._replica2part2dev[replica][part] = dev['id']
|
||||
self.logger.debug(
|
||||
"Placed %d/%d onto dev %d", part, replica, dev['id'])
|
||||
"Placed %d/%d onto dev %s", part, replica, pretty_dev(dev))
|
||||
|
||||
# Just to save memory and keep from accidental reuse.
|
||||
for dev in self._iter_devs():
|
||||
|
@ -660,3 +660,10 @@ def validate_device_name(device_name):
|
||||
device_name.startswith(' ') or
|
||||
device_name.endswith(' ') or
|
||||
len(device_name) == 0)
|
||||
|
||||
|
||||
def pretty_dev(device):
|
||||
return "r%sz%s-%s/%s" % (device.get('region'),
|
||||
device.get('zone'),
|
||||
device.get('ip'),
|
||||
device.get('id'))
|
||||
|
Loading…
Reference in New Issue
Block a user