summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSamuel Merritt <sam@swiftstack.com>2016-06-30 16:52:58 -0700
committerThiago da Silva <thiago@redhat.com>2017-11-03 13:30:05 -0400
commit728b4ba14008f59ffe64fd28bc061c12a0c64467 (patch)
treeda736e4442f9c13985099e5871f859722c3aa6df /doc
parentfeee3998408e5ed03563c317ad9506ead92083a6 (diff)
downloadswift-728b4ba14008f59ffe64fd28bc061c12a0c64467.tar.gz
Add checksum to object extended attributes
Currently, our integrity checking for objects is pretty weak when it comes to object metadata. If the extended attributes on a .data or .meta file get corrupted in such a way that we can still unpickle it, we don't have anything that detects that. This could be especially bad with encrypted etags; if the encrypted etag (X-Object-Sysmeta-Crypto-Etag or whatever it is) gets some bits flipped, then we'll cheerfully decrypt the cipherjunk into plainjunk, then send it to the client. Net effect is that the client sees a GET response with an ETag that doesn't match the MD5 of the object *and* Swift has no way of detecting and quarantining this object. Note that, with an unencrypted object, if the ETag metadatum gets mangled, then the object will be quarantined by the object server or auditor, whichever notices first. As part of this commit, I also ripped out some mocking of getxattr/setxattr in tests. It appears to be there to allow unit tests to run on systems where /tmp doesn't support xattrs. However, since the mock is keyed off of inode number and inode numbers get re-used, there's lots of leakage between different test runs. On a real FS, unlinking a file and then creating a new one of the same name will also reset the xattrs; this isn't the case with the mock. The mock was pretty old; Ubuntu 12.04 and up all support xattrs in /tmp, and recent Red Hat / CentOS releases do too. The xattr mock was added in 2011; maybe it was to support Ubuntu Lucid Lynx? Bonus: now you can pause a test with the debugger, inspect its files in /tmp, and actually see the xattrs along with the data. Since this patch now uses a real filesystem for testing filesystem operations, tests are skipped if the underlying filesystem does not support setting xattrs (eg tmpfs or more than 4k of xattrs on ext4). References to "/tmp" have been replaced with calls to tempfile.gettempdir(). This will allow setting the TMPDIR envvar in test setup and getting an XFS filesystem instead of ext4 or tmpfs. THIS PATCH SIGNIFICANTLY CHANGES TESTING ENVIRONMENTS With this patch, every test environment will require TMPDIR to be using a filesystem that supports at least 4k of extended attributes. Neither ext4 nor tempfs support this. XFS is recommended. So why all the SkipTests? Why not simply raise an error? We still need the tests to run on the base image for OpenStack's CI system. Since we were previously mocking out xattr, there wasn't a problem, but we also weren't actually testing anything. This patch adds functionality to validate xattr data, so we need to drop the mock. `test.unit.skip_if_no_xattrs()` is also imported into `test.functional` so that functional tests can import it from the functional test namespace. The related OpenStack CI infrastructure changes are made in https://review.openstack.org/#/c/394600/. Co-Authored-By: John Dickinson <me@not.mn> Change-Id: I98a37c0d451f4960b7a12f648e4405c6c6716808
Diffstat (limited to 'doc')
-rw-r--r--doc/source/development_guidelines.rst3
-rw-r--r--doc/source/development_saio.rst17
2 files changed, 20 insertions, 0 deletions
diff --git a/doc/source/development_guidelines.rst b/doc/source/development_guidelines.rst
index a8d2295a0..78228afb3 100644
--- a/doc/source/development_guidelines.rst
+++ b/doc/source/development_guidelines.rst
@@ -77,6 +77,9 @@ To execute the tests:
--recreate`` or remove the ``.tox`` directory to force ``tox`` to recreate the
dependency list.
+ Swift's tests require having an XFS directory available in ``/tmp`` or
+ in the ``TMPDIR`` environment variable.
+
Swift's functional tests may be executed against a :doc:`development_saio` or
other running Swift cluster using the command::
diff --git a/doc/source/development_saio.rst b/doc/source/development_saio.rst
index a71109c81..832cf6a2b 100644
--- a/doc/source/development_saio.rst
+++ b/doc/source/development_saio.rst
@@ -201,6 +201,23 @@ On Fedora 19 or later, you need to place these in ``/etc/rc.d/rc.local``.
On OpenSuse you need to place these in ``/etc/init.d/boot.local``.
+Creating an XFS tmp dir
+-----------------------
+
+Tests require having an XFS directory available in ``/tmp`` or in the
+``TMPDIR`` environment variable. To set up ``/tmp`` with an XFS filesystem,
+do the following::
+
+ cd ~
+ truncate -s 1GB xfs_file # create 1GB fil for XFS in your home directory
+ mkfs.xfs xfs_file
+ sudo mount -o loop,noatime,nodiratime xfs_file /tmp
+ sudo chmod -R 1777 /tmp
+
+To persist this, edit and add the following to ``/etc/fstab``::
+
+ /home/swift/xfs_file /tmp xfs rw,noatime,nodiratime,attr2,inode64,noquota 0 0
+
----------------
Getting the code
----------------