Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,27 @@ public ContainerModel createContainer(SandboxType sandboxType, String mountDir,
logger.info("Added readonly mount: " + hostPath + " -> " + containerPath);
}
}
Map<String, String> nonCopyMounts = managerConfig.getFileSystemConfig().getNonCopyMount();
if(nonCopyMounts != null && !nonCopyMounts.isEmpty()){
logger.info("Adding non-copy mounts: " + nonCopyMounts.size() + " mount(s)");
for (Map.Entry<String, String> entry : nonCopyMounts.entrySet()) {
String hostPath = entry.getKey();
String containerPath = entry.getValue();
if (!java.nio.file.Paths.get(hostPath).isAbsolute()) {
hostPath = java.nio.file.Paths.get(hostPath).toAbsolutePath().toString();
logger.info("Converting relative path to absolute: " + hostPath);
}
java.io.File hostFile = new java.io.File(hostPath);
if (!hostFile.exists()) {
logger.warning("NonCopy mount host path does not exist: " + hostPath + ", skipping");
continue;
}
volumeBindings.add(new VolumeBinding(hostPath, containerPath, "rw"));
logger.info("Added non Copy mount: " + hostPath + " -> " + containerPath);
}
}


Map<String, Object> runtimeConfig = Map.of();
if (sandboxConfig != null) {
runtimeConfig = sandboxConfig.getRuntimeConfig();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class FileSystemConfig {
private Map<String, String> readonlyMounts;
private String storageFolderPath;
private String mountDir;
private Map<String, String> nonCopyMount;

protected FileSystemConfig(FileSystemType fileSystemType) {
this.fileSystemType = fileSystemType;
Expand All @@ -33,6 +34,7 @@ protected FileSystemConfig(Builder<?> builder) {
this.readonlyMounts = builder.readonlyMounts;
this.storageFolderPath = builder.storageFolderPath;
this.mountDir = builder.mountDir;
this.nonCopyMount = builder.nonCopyMounts;
}

public FileSystemType getFileSystemType() {
Expand All @@ -51,13 +53,16 @@ public String getMountDir() {
return mountDir;
}

public Map<String, String> getNonCopyMount() {
return nonCopyMount;
}

public static abstract class Builder<T extends Builder<T>> {
protected FileSystemType fileSystemType;
protected Map<String, String> readonlyMounts;
protected String storageFolderPath = "";
protected String mountDir = "sessions_mount_dir";

protected Map<String, String> nonCopyMounts;

protected Builder(FileSystemType fileSystemType) {
this.fileSystemType = fileSystemType;
Expand All @@ -78,6 +83,14 @@ public T addReadonlyMount(String hostPath, String containerPath) {
return self();
}

public T addNonCopyMount(String hostPath, String containerPath) {
if (this.nonCopyMounts == null) {
this.nonCopyMounts = new HashMap<>();
}
this.nonCopyMounts.put(hostPath, containerPath);
return self();
}

public T storageFolderPath(String storageFolderPath) {
this.storageFolderPath = storageFolderPath;
return self();
Expand Down
Loading