Skip to content

Commit 0e58d22

Browse files
committed
Create correct directory layout for swift on purpose.
The pre-existing configuration for swift on devstack set's the *-server's devices option (the root of the servers list of devices) to: devices = /opt/stack/data/swift/1 where "1" is the node_number, and will be 2, 3, ... N if the devstack machine is built with more than one swift node/device (pretty sure no one does that on devstack ever). The device(s) in the rings are named (perhaps confusingly similar to the swift loopback image) just "sdb1", so all storage servers expect to have a $STACK_USER writeable file system at: os.path.join(<devices_root>, "sdb1") That directory does not exist when you start up a devstack [1]. Currently Swift's object-server's require that directory exist before they write data into it (even with mount_check = false!). Unfortunately however, with mount_check=false the account/container servers are able to create the device directory when it does not exist [2]. Which can lead to some unfortunate results with permissions on some deployments using mount_check = false (e.g. testing or containerized environments). Fixing this issue [3] uncovered the previously benign [4] mis-configuration in devstack. Attempting 1. It was lost a long while ago I7c65303791689523f02e5ae44483a6c50b2eed1e 2. Essentially they want to: mkdir -p /opt/stack/data/swift/1/sdb1/containers/<part#> ... but end up creating the "sdb1" dir too! 3. I3362a6ebff423016bb367b4b6b322bb41ae08764 4. Benign because the object-server share their device with the account-container devices and they would create the dirs before trying to write an object. It was incorrect, but worked by happenstance, which is nearly as good as worked on purpose. Change-Id: I52c4ecb70b1ae47e613ba243da5a4d94e5adedf2
1 parent 9d7e74e commit 0e58d22

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

lib/swift

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -608,15 +608,13 @@ function create_swift_disk {
608608
# create all of the directories needed to emulate a few different servers
609609
local node_number
610610
for node_number in ${SWIFT_REPLICAS_SEQ}; do
611-
sudo ln -sf ${SWIFT_DATA_DIR}/drives/sdb1/$node_number ${SWIFT_DATA_DIR}/$node_number;
612-
local drive=${SWIFT_DATA_DIR}/drives/sdb1/${node_number}
613-
local node=${SWIFT_DATA_DIR}/${node_number}/node
614-
local node_device=${node}/sdb1
615-
[[ -d $node ]] && continue
616-
[[ -d $drive ]] && continue
617-
sudo install -o ${STACK_USER} -g $user_group -d $drive
618-
sudo install -o ${STACK_USER} -g $user_group -d $node_device
619-
sudo chown -R ${STACK_USER}: ${node}
611+
# node_devices must match *.conf devices option
612+
local node_devices=${SWIFT_DATA_DIR}/${node_number}
613+
local real_devices=${SWIFT_DATA_DIR}/drives/sdb1/$node_number
614+
sudo ln -sf $real_devices $node_devices;
615+
local device=${real_devices}/sdb1
616+
[[ -d $device ]] && continue
617+
sudo install -o ${STACK_USER} -g $user_group -d $device
620618
done
621619
}
622620

0 commit comments

Comments
 (0)