From Fedora Project Wiki

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Description

Swift allows storage devices to be added to a running swift environment. In this test we will add a storage device to the ring file. And verfiy it is being utilized

Setup

So its more likely we'll see the effects of adding a device we upload more data to swift

$> cd
$> . /path/to/keystonerc
$> for x in {1..10} ; do swift upload c$x test.data ; done

Create a new loopback storage device (use a physical device if you have access to one)

$> truncate /var/tmp/swift-storage-newdevice --size 5G
$> DEVICE=$(sudo losetup --show -f  /var/tmp/swift-storage-newdevice)
$> sudo mkfs.ext4 -I 1024 $DEVICE
$> sudo mkdir -p /srv/node/newdevice
$> sudo mount -o noatime,nodiratime,nobarrier,user_xattr $DEVICE /srv/node/newdevice
$> sudo chown -R swift:swift /srv/node/newdevice 

How to test

Add the new device to the ring

$> sudo swift-ring-builder /etc/swift/account.builder add z1-127.0.0.1:6002/newdevice 100
$> sudo swift-ring-builder /etc/swift/container.builder add z1-127.0.0.1:6001/newdevice 100
$> sudo swift-ring-builder /etc/swift/object.builder add z1-127.0.0.1:6000/newdevice 100
$> sudo swift-ring-builder /etc/swift/object.builder pretend_min_part_hours_passed
$> sudo swift-ring-builder /etc/swift/account.builder pretend_min_part_hours_passed
$> sudo swift-ring-builder /etc/swift/container.builder pretend_min_part_hours_passed

test for files on the new device (there should be none

$> sudo find /srv/node/newdevice -type f

re-balance the ring file

$> sudo swift-ring-builder /etc/swift/account.builder rebalance
$> sudo swift-ring-builder /etc/swift/container.builder rebalance
$> sudo swift-ring-builder /etc/swift/object.builder rebalance

Expected Results

After a sort wait some files should be moved from the other devices to the new storage device

$> sudo find /srv/node/newdevice -type f