use of alluxio.conf.PropertyKey in project alluxio by Alluxio.
the class S3AUnderFileSystemTest method getPermissionsWithMapping.
@Test
public void getPermissionsWithMapping() throws Exception {
Map<PropertyKey, Object> conf = new HashMap<>();
conf.put(PropertyKey.UNDERFS_S3_OWNER_ID_TO_USERNAME_MAPPING, "111=altname");
try (Closeable c = new ConfigurationRule(conf, sConf).toResource()) {
UnderFileSystemConfiguration ufsConf = UnderFileSystemConfiguration.defaults(sConf);
mS3UnderFileSystem = new S3AUnderFileSystem(new AlluxioURI("s3a://" + BUCKET_NAME), mClient, BUCKET_NAME, mExecutor, mManager, UnderFileSystemConfiguration.defaults(sConf), false);
}
Mockito.when(mClient.getS3AccountOwner()).thenReturn(new Owner("111", "test"));
Mockito.when(mClient.getBucketAcl(Mockito.anyString())).thenReturn(new AccessControlList());
ObjectUnderFileSystem.ObjectPermissions permissions = mS3UnderFileSystem.getPermissions();
Assert.assertEquals("altname", permissions.getOwner());
Assert.assertEquals("altname", permissions.getGroup());
Assert.assertEquals(0, permissions.getMode());
}
use of alluxio.conf.PropertyKey in project alluxio by Alluxio.
the class S3AUnderFileSystemTest method getPermissionsNoMapping.
@Test
public void getPermissionsNoMapping() throws Exception {
Map<PropertyKey, Object> conf = new HashMap<>();
conf.put(PropertyKey.UNDERFS_S3_OWNER_ID_TO_USERNAME_MAPPING, "111=userid");
try (Closeable c = new ConfigurationRule(conf, sConf).toResource()) {
UnderFileSystemConfiguration ufsConf = UnderFileSystemConfiguration.defaults(sConf);
mS3UnderFileSystem = new S3AUnderFileSystem(new AlluxioURI("s3a://" + BUCKET_NAME), mClient, BUCKET_NAME, mExecutor, mManager, UnderFileSystemConfiguration.defaults(sConf), false);
}
Mockito.when(mClient.getS3AccountOwner()).thenReturn(new Owner("0", "test"));
Mockito.when(mClient.getBucketAcl(Mockito.anyString())).thenReturn(new AccessControlList());
ObjectUnderFileSystem.ObjectPermissions permissions = mS3UnderFileSystem.getPermissions();
Assert.assertEquals("test", permissions.getOwner());
Assert.assertEquals("test", permissions.getGroup());
Assert.assertEquals(0, permissions.getMode());
}
use of alluxio.conf.PropertyKey in project alluxio by Alluxio.
the class DefaultMetaMaster method getConfiguration.
@Override
public Configuration getConfiguration(GetConfigurationPOptions options) {
// NOTE(cc): there is no guarantee that the returned cluster and path configurations are
// consistent snapshot of the system's state at a certain time, the path configuration might
// be in a newer state. But it's guaranteed that the hashes are respectively correspondent to
// the properties.
Configuration.Builder builder = Configuration.newBuilder();
if (!options.getIgnoreClusterConf()) {
for (PropertyKey key : ServerConfiguration.keySet()) {
if (key.isBuiltIn()) {
Source source = ServerConfiguration.getSource(key);
Object value = ServerConfiguration.getOrDefault(key, null, ConfigurationValueOptions.defaults().useDisplayValue(true).useRawValue(options.getRawValue()));
builder.addClusterProperty(key.getName(), value, source);
}
}
// NOTE(cc): assumes that ServerConfiguration is read-only when master is running, otherwise,
// the following hash might not correspond to the above cluster configuration.
builder.setClusterConfHash(ServerConfiguration.hash());
}
if (!options.getIgnorePathConf()) {
PathPropertiesView pathProperties = mPathProperties.snapshot();
pathProperties.getProperties().forEach((path, properties) -> properties.forEach((key, value) -> builder.addPathProperty(path, key, value)));
builder.setPathConfHash(pathProperties.getHash());
}
return builder.build();
}
use of alluxio.conf.PropertyKey in project alluxio by Alluxio.
the class ServerConfigurationChecker method regenerateReport.
/**
* Checks the server-side configurations and records the check results.
*/
public synchronized void regenerateReport() {
// Generate the configuration map from master and worker configuration records
Map<PropertyKey, Map<Optional<String>, List<String>>> confMap = generateConfMap();
// Update the errors and warnings configuration
Map<Scope, List<InconsistentProperty>> confErrors = new HashMap<>();
Map<Scope, List<InconsistentProperty>> confWarns = new HashMap<>();
for (Map.Entry<PropertyKey, Map<Optional<String>, List<String>>> entry : confMap.entrySet()) {
if (entry.getValue().size() >= 2) {
PropertyKey key = entry.getKey();
InconsistentProperty inconsistentProperty = new InconsistentProperty().setName(key.getName()).setValues(entry.getValue());
Scope scope = key.getScope().equals(Scope.ALL) ? Scope.SERVER : key.getScope();
if (entry.getKey().getConsistencyLevel().equals(ConsistencyCheckLevel.ENFORCE)) {
confErrors.putIfAbsent(scope, new ArrayList<>());
confErrors.get(scope).add(inconsistentProperty);
} else {
confWarns.putIfAbsent(scope, new ArrayList<>());
confWarns.get(scope).add(inconsistentProperty);
}
}
}
// Update configuration status
ConfigStatus status = confErrors.values().stream().anyMatch(a -> a.size() > 0) ? ConfigStatus.FAILED : confWarns.values().stream().anyMatch(a -> a.size() > 0) ? ConfigStatus.WARN : ConfigStatus.PASSED;
if (!status.equals(mConfigCheckReport.getConfigStatus())) {
logConfigReport();
}
mConfigCheckReport = new ConfigCheckReport(confErrors, confWarns, status);
}
use of alluxio.conf.PropertyKey in project alluxio by Alluxio.
the class IntegrationTestUtils method reserveMasterPorts.
/**
* Reserves ports for each master service and updates the server configuration.
*/
public static void reserveMasterPorts() {
for (ServiceType service : Arrays.asList(ServiceType.MASTER_RPC, ServiceType.MASTER_WEB, ServiceType.MASTER_RAFT, ServiceType.JOB_MASTER_RPC, ServiceType.JOB_MASTER_WEB, ServiceType.JOB_MASTER_RAFT)) {
PropertyKey key = service.getPortKey();
ServerConfiguration.set(key, PortRegistry.reservePort());
}
}
Aggregations