@Override
    public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
        if(log.isDebugEnabled()) {
            log.debug(String.format("List containers for %s", session));
        }
        try {
            final AttributedList<Path> containers = new AttributedList<>();
            final int limit = new HostPreferences(session.getHost()).getInteger("openstack.list.container.limit");
            final Client client = session.getClient();
            for(final Region r : client.getRegions()) {
                if(region.getIdentifier() != null) {
                    if(!StringUtils.equals(r.getRegionId(), region.getIdentifier())) {
                        log.warn(String.format("Skip region %s", r));
                        continue;
                    }
                }
                try {
                    // List all containers
                    List<Container> chunk;
                    String marker = null;
                    do {
                        chunk = client.listContainers(r, limit, marker);
                        for(final Container f : chunk) {
                            final PathAttributes attributes = new PathAttributes();
                            attributes.setRegion(f.getRegion().getRegionId());
                            containers.add(new Path(String.format("/%s", f.getName()),
                                EnumSet.of(Path.Type.volume, Path.Type.directory), attributes));
                            marker = f.getName();
                        }
                        listener.chunk(directory, containers);
                    }
                    while(!chunk.isEmpty());
                }
                catch(GenericException e) {
                    if(e.getHttpStatusCode() == HttpStatus.SC_SERVICE_UNAVAILABLE) {
                        log.warn(String.format("Ignore failure %s for region %s", e, region));
                        continue;
                    }
                    throw e;
                }
            }
            return containers;
        }
        catch(GenericException e) {
            throw new SwiftExceptionMappingService().map("Listing directory {0} failed", e, directory);
        }
        catch(IOException e) {
            throw new DefaultIOExceptionMappingService().map(e);
        }
    }
@Test
    public void testListLimitRegion() throws Exception {
        final AttributedList<Path> list = new SwiftContainerListService(session, new SwiftLocationFeature.SwiftRegion("IAD")
        ).list(new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)), new DisabledListProgressListener());
        final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.volume, Path.Type.directory));
        container.attributes().setRegion("IAD");
        assertTrue(list.contains(container));
    }