'The maximum size specified for a filesystem is enforced by the ZFS
implementation.  Attempts to write more data than the maximum size
fail.'

def test_maximum_size_enforced(self):

    pool = build_pool(self)
    service = service_for_pool(self, pool)
    maximum_size = ((40 * 1024) * 1024)
    volume = service.get(MY_VOLUME, size=VolumeSize(maximum_size=maximum_size))
    creating = pool.create(volume)
    def write_and_flush(file_object, data):
        file_object.write(data)
        file_object.flush()
    def created(filesystem):
        path = filesystem.get_path()
        with path.child('ok').open('w') as fObj:
            chunk_size = (8 * 1024)
            chunk = ('x' * chunk_size)
            for _ in range((maximum_size / chunk_size)):
                fObj.write(chunk)
            fObj.flush()
            exception = self.assertRaises(IOError, write_and_flush, fObj, 'x')
            self.assertEqual(exception.args[0], errno.EDQUOT)
    creating.addCallback(created)
    return creating
