In Ring Build Negative value is allow in <part_power> parameter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
swift-bench |
New
|
Undecided
|
Unassigned |
Bug Description
When executing swift-ring-builder command by passing negative value for <part_power> parameter, use case is executed successfully. When user rebalance the ring it does throw error "TypeError: integer argument expected, got float" . This happens because <part_power> is used to calculate number of partitions (2^<part_power>). When <part_power> is negative, number of partitions are calculated as float value which is incorrect.
Steps:
1.Build a ring
swift-ring-builder account.builder create -10 2 1 <<< There should be an error here >>>
2.Add device to it.
swift-ring-builder account.builder add --region 1 --zone 1 --ip 10.0.2.15 --port 6202 --device sda1 --weight 100
swift-ring-builder account.builder add --region 1 --zone 1 --ip 10.0.2.15 --port 6202 --device loop0 --weight 100
3.Rebalance the ring.
swift-ring-builder account.builder rebalance
Error message:
Traceback (most recent call last):
File "/usr/bin/
sys.
File "/usr/lib/
getattr(
File "/usr/lib/
parts, balance, removed_devs = builder.
File "/usr/lib/
self.
TypeError: integer argument expected, got float
Error is displayed after step 3 but error should be displayed after executing step 1.
This issue was fixed in the openstack/swift 2.31.1 release.