use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.
the class BaseFileSystemTest method mountException.
/**
* Ensures that an exception is propagated correctly when mounting a path.
*/
@Test
public void mountException() throws Exception {
AlluxioURI alluxioPath = new AlluxioURI("/t");
AlluxioURI ufsPath = new AlluxioURI("/u");
MountPOptions mountOptions = MountPOptions.getDefaultInstance();
doThrow(EXCEPTION).when(mFileSystemMasterClient).mount(alluxioPath, ufsPath, FileSystemOptions.mountDefaults(mConf).toBuilder().mergeFrom(mountOptions).build());
try {
mFileSystem.mount(alluxioPath, ufsPath, mountOptions);
fail(SHOULD_HAVE_PROPAGATED_MESSAGE);
} catch (Exception e) {
assertSame(EXCEPTION, e);
}
verifyFilesystemContextAcquiredAndReleased();
}
use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.
the class DefaultFileSystemMaster method getRootMountInfo.
private static MountInfo getRootMountInfo(MasterUfsManager ufsManager) {
try (CloseableResource<UnderFileSystem> resource = ufsManager.getRoot().acquireUfsResource()) {
boolean shared = resource.get().isObjectStorage() && ServerConfiguration.getBoolean(PropertyKey.UNDERFS_OBJECT_STORE_MOUNT_SHARED_PUBLICLY);
boolean readonly = ServerConfiguration.getBoolean(PropertyKey.MASTER_MOUNT_TABLE_ROOT_READONLY);
String rootUfsUri = PathUtils.normalizePath(ServerConfiguration.getString(PropertyKey.MASTER_MOUNT_TABLE_ROOT_UFS), AlluxioURI.SEPARATOR);
Map<String, String> rootUfsConf = ServerConfiguration.getNestedProperties(PropertyKey.MASTER_MOUNT_TABLE_ROOT_OPTION).entrySet().stream().filter(entry -> entry.getValue() != null).collect(Collectors.toMap(Map.Entry::getKey, entry -> String.valueOf(entry.getValue())));
MountPOptions mountOptions = MountContext.mergeFrom(MountPOptions.newBuilder().setShared(shared).setReadOnly(readonly).putAllProperties(rootUfsConf)).getOptions().build();
return new MountInfo(new AlluxioURI(MountTable.ROOT), new AlluxioURI(rootUfsUri), IdUtils.ROOT_MOUNT_ID, mountOptions);
}
}
use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.
the class DefaultFileSystemMaster method getUfsInfo.
@Override
public UfsInfo getUfsInfo(long mountId) {
MountInfo info = mMountTable.getMountInfo(mountId);
if (info == null) {
return new UfsInfo();
}
MountPOptions options = info.getOptions();
return new UfsInfo().setUri(info.getUfsUri()).setMountOptions(MountContext.mergeFrom(MountPOptions.newBuilder().putAllProperties(options.getPropertiesMap()).setReadOnly(options.getReadOnly()).setShared(options.getShared())).getOptions().build());
}
use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.
the class MountContext method mergeFrom.
/**
* Merges and embeds the given {@link MountPOptions} with the corresponding master options.
*
* @param optionsBuilder Builder for proto {@link MountPOptions} to embed
* @return the instance of {@link MountContext} with default values for master
*/
public static MountContext mergeFrom(MountPOptions.Builder optionsBuilder) {
MountPOptions masterOptions = FileSystemOptions.mountDefaults(ServerConfiguration.global());
MountPOptions.Builder mergedOptionsBuilder = masterOptions.toBuilder().mergeFrom(optionsBuilder.build());
return create(mergedOptionsBuilder);
}
use of alluxio.grpc.MountPOptions in project alluxio by Alluxio.
the class MultiUfsMountIntegrationTest method mountWithCredentials.
@Test
public void mountWithCredentials() throws Exception {
MountPOptions options3 = MountPOptions.newBuilder().putAllProperties(UFS_CONF3).build();
mFileSystem.mount(mMountPoint3, new AlluxioURI(mUfsUri3), options3);
mLocalAlluxioCluster.stopFS();
try (FsMasterResource masterResource = MasterTestUtils.createLeaderFileSystemMasterFromJournal()) {
FileSystemMaster fsMaster = masterResource.getRegistry().get(FileSystemMaster.class);
Map<String, MountPointInfo> mountTable = fsMaster.getMountPointInfoSummary();
Assert.assertTrue(mountTable.containsKey(MOUNT_POINT3));
MountPointInfo mountPointInfo3 = mountTable.get(MOUNT_POINT3);
Assert.assertEquals(mUfsUri3, mountPointInfo3.getUfsUri());
Assert.assertEquals(UFS_CONF3.size(), mountPointInfo3.getProperties().size());
Assert.assertTrue(mountPointInfo3.getProperties().containsKey(PropertyKey.Name.S3A_ACCESS_KEY));
Assert.assertNotEquals(UFS_CONF3.get(PropertyKey.Name.S3A_ACCESS_KEY), mountPointInfo3.getProperties().get(PropertyKey.Name.S3A_ACCESS_KEY));
}
}
Aggregations