summaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump
diff options
context:
space:
mode:
Diffstat (limited to 'node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump')
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/AbstractProducer.java6
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/Artifact.java22
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java7
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumper.java32
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PerfReporter.java15
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PmapReporter.java9
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaLogDumper.java8
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java51
8 files changed, 69 insertions, 81 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/AbstractProducer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/AbstractProducer.java
index 6bcf41b89c2..1756b81f795 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/AbstractProducer.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/AbstractProducer.java
@@ -3,10 +3,10 @@ package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump;
import com.yahoo.vespa.hosted.node.admin.container.ContainerOperations;
import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext;
+import com.yahoo.vespa.hosted.node.admin.task.util.fs.ContainerPath;
import com.yahoo.vespa.hosted.node.admin.task.util.process.CommandResult;
import java.io.IOException;
-import java.nio.file.Path;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -48,8 +48,8 @@ abstract class AbstractProducer implements ArtifactProducer {
}
protected int findVespaServicePid(NodeAgentContext ctx, String configId) throws IOException {
- Path findPidBinary = ctx.pathInNodeUnderVespaHome("libexec/vespa/find-pid");
- CommandResult findPidResult = executeCommand(ctx, List.of(findPidBinary.toString(), configId), true);
+ ContainerPath findPidBinary = ctx.containerPathUnderVespaHome("libexec/vespa/find-pid");
+ CommandResult findPidResult = executeCommand(ctx, List.of(findPidBinary.pathInContainer(), configId), true);
return Integer.parseInt(findPidResult.getOutput());
}
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/Artifact.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/Artifact.java
index edab90afea7..6f29a9c2558 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/Artifact.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/Artifact.java
@@ -1,7 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump;
-import java.nio.file.Path;
+import com.yahoo.vespa.hosted.node.admin.task.util.fs.ContainerPath;
+
import java.util.Optional;
/**
@@ -21,18 +22,14 @@ class Artifact {
}
private final Classification classification;
- private final Path fileInNode;
- private final Path fileOnHost;
+ private final ContainerPath file;
private final boolean compressOnUpload;
private Artifact(Builder builder) {
- if (builder.fileOnHost == null && builder.fileInNode == null) {
+ if (builder.file == null) {
throw new IllegalArgumentException("No file specified");
- } else if (builder.fileOnHost != null && builder.fileInNode != null) {
- throw new IllegalArgumentException("Only a single file can be specified");
}
- this.fileInNode = builder.fileInNode;
- this.fileOnHost = builder.fileOnHost;
+ this.file = builder.file;
this.classification = builder.classification;
this.compressOnUpload = Boolean.TRUE.equals(builder.compressOnUpload);
}
@@ -40,21 +37,18 @@ class Artifact {
static Builder newBuilder() { return new Builder(); }
Optional<Classification> classification() { return Optional.ofNullable(classification); }
- Optional<Path> fileInNode() { return Optional.ofNullable(fileInNode); }
- Optional<Path> fileOnHost() { return Optional.ofNullable(fileOnHost); }
+ ContainerPath file() { return file; }
boolean compressOnUpload() { return compressOnUpload; }
static class Builder {
private Classification classification;
- private Path fileInNode;
- private Path fileOnHost;
+ private ContainerPath file;
private Boolean compressOnUpload;
private Builder() {}
Builder classification(Classification c) { this.classification = c; return this; }
- Builder fileInNode(Path f) { this.fileInNode = f; return this; }
- Builder fileOnHost(Path f) { this.fileOnHost = f; return this; }
+ Builder file(ContainerPath f) { this.file = f; return this; }
Builder compressOnUpload() { this.compressOnUpload = true; return this; }
Artifact build() { return new Artifact(this); }
}
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java
index e4a9e6aeea5..0394756cc77 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/ArtifactProducer.java
@@ -1,9 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump;
+import com.yahoo.vespa.hosted.node.admin.task.util.fs.ContainerPath;
import com.yahoo.vespa.hosted.node.admin.task.util.process.CommandResult;
-import java.nio.file.Path;
import java.util.List;
import java.util.OptionalDouble;
@@ -22,9 +22,8 @@ interface ArtifactProducer {
String serviceId();
int servicePid();
CommandResult executeCommandInNode(List<String> command, boolean logOutput);
- Path outputDirectoryInNode();
- Path pathInNodeUnderVespaHome(String relativePath);
- Path pathOnHostFromPathInNode(Path pathInNode);
+ ContainerPath outputContainerPath();
+ ContainerPath containerPathUnderVespaHome(String relativePath);
Options options();
interface Options {
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumper.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumper.java
index cf206918568..8b6ca1384e9 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumper.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/JvmDumper.java
@@ -1,9 +1,9 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump;
+import com.yahoo.vespa.hosted.node.admin.task.util.fs.ContainerPath;
import com.yahoo.yolean.concurrent.Sleeper;
-import java.nio.file.Path;
import java.time.Duration;
import java.util.List;
@@ -22,12 +22,12 @@ class JvmDumper {
@Override
public List<Artifact> produceArtifacts(Context ctx) {
- Path heapDumpFile = ctx.outputDirectoryInNode().resolve("jvm-heap-dump.bin");
+ ContainerPath heapDumpFile = ctx.outputContainerPath().resolve("jvm-heap-dump.bin");
List<String> cmd = List.of(
- "jmap", "-dump:live,format=b,file=" + heapDumpFile, Integer.toString(ctx.servicePid()));
+ "jmap", "-dump:live,format=b,file=" + heapDumpFile.pathInContainer(), Integer.toString(ctx.servicePid()));
ctx.executeCommandInNode(cmd, true);
return List.of(
- Artifact.newBuilder().classification(CONFIDENTIAL).fileInNode(heapDumpFile).compressOnUpload().build());
+ Artifact.newBuilder().classification(CONFIDENTIAL).file(heapDumpFile).compressOnUpload().build());
}
}
@@ -37,10 +37,10 @@ class JvmDumper {
@Override
public List<Artifact> produceArtifacts(Context ctx) {
- Path jmapReport = ctx.outputDirectoryInNode().resolve("jvm-jmap.txt");
- List<String> cmd = List.of("bash", "-c", "jhsdb jmap --heap --pid " + ctx.servicePid() + " > " + jmapReport);
+ ContainerPath jmapReport = ctx.outputContainerPath().resolve("jvm-jmap.txt");
+ List<String> cmd = List.of("bash", "-c", "jhsdb jmap --heap --pid " + ctx.servicePid() + " > " + jmapReport.pathInContainer());
ctx.executeCommandInNode(cmd, true);
- return List.of(Artifact.newBuilder().classification(INTERNAL).fileInNode(jmapReport).build());
+ return List.of(Artifact.newBuilder().classification(INTERNAL).file(jmapReport).build());
}
}
@@ -50,10 +50,10 @@ class JvmDumper {
@Override
public List<Artifact> produceArtifacts(Context ctx) {
- Path jstatReport = ctx.outputDirectoryInNode().resolve("jvm-jstat.txt");
- List<String> cmd = List.of("bash", "-c", "jstat -gcutil " + ctx.servicePid() + " > " + jstatReport);
+ ContainerPath jstatReport = ctx.outputContainerPath().resolve("jvm-jstat.txt");
+ List<String> cmd = List.of("bash", "-c", "jstat -gcutil " + ctx.servicePid() + " > " + jstatReport.pathInContainer());
ctx.executeCommandInNode(cmd, true);
- return List.of(Artifact.newBuilder().classification(INTERNAL).fileInNode(jstatReport).build());
+ return List.of(Artifact.newBuilder().classification(INTERNAL).file(jstatReport).build());
}
}
@@ -63,9 +63,9 @@ class JvmDumper {
@Override
public List<Artifact> produceArtifacts(Context ctx) {
- Path jstackReport = ctx.outputDirectoryInNode().resolve("jvm-jstack.txt");
- ctx.executeCommandInNode(List.of("bash", "-c", "jstack " + ctx.servicePid() + " > " + jstackReport), true);
- return List.of(Artifact.newBuilder().classification(INTERNAL).fileInNode(jstackReport).build());
+ ContainerPath jstackReport = ctx.outputContainerPath().resolve("jvm-jstack.txt");
+ ctx.executeCommandInNode(List.of("bash", "-c", "jstack " + ctx.servicePid() + " > " + jstackReport.pathInContainer()), true);
+ return List.of(Artifact.newBuilder().classification(INTERNAL).file(jstackReport).build());
}
}
@@ -80,9 +80,9 @@ class JvmDumper {
@Override
public List<Artifact> produceArtifacts(ArtifactProducer.Context ctx) {
int seconds = (int) (ctx.options().duration().orElse(30.0));
- Path outputFile = ctx.outputDirectoryInNode().resolve("recording.jfr");
+ ContainerPath outputFile = ctx.outputContainerPath().resolve("recording.jfr");
List<String> startCommand = List.of("jcmd", Integer.toString(ctx.servicePid()), "JFR.start", "name=host-admin",
- "path-to-gc-roots=true", "settings=profile", "filename=" + outputFile, "duration=" + seconds + "s");
+ "path-to-gc-roots=true", "settings=profile", "filename=" + outputFile.pathInContainer(), "duration=" + seconds + "s");
ctx.executeCommandInNode(startCommand, true);
sleeper.sleep(Duration.ofSeconds(seconds).plusSeconds(1));
int maxRetries = 10;
@@ -92,7 +92,7 @@ class JvmDumper {
.anyMatch(l -> l.contains("name=host-admin") && l.contains("running"));
if (!stillRunning) {
Artifact a = Artifact.newBuilder()
- .classification(CONFIDENTIAL).fileInNode(outputFile).compressOnUpload().build();
+ .classification(CONFIDENTIAL).file(outputFile).compressOnUpload().build();
return List.of(a);
}
sleeper.sleep(Duration.ofSeconds(1));
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PerfReporter.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PerfReporter.java
index 07c8b709e04..3dae6544304 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PerfReporter.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PerfReporter.java
@@ -1,7 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump;
-import java.nio.file.Path;
+import com.yahoo.vespa.hosted.node.admin.task.util.fs.ContainerPath;
+
import java.util.ArrayList;
import java.util.List;
@@ -25,15 +26,15 @@ class PerfReporter implements ArtifactProducer {
if (ctx.options().callGraphRecording()) {
perfRecordCommand.add("-g");
}
- Path recordFile = ctx.outputDirectoryInNode().resolve("perf-record.bin");
+ ContainerPath recordFile = ctx.outputContainerPath().resolve("perf-record.bin");
perfRecordCommand.addAll(
- List.of("--output=" + recordFile,
+ List.of("--output=" + recordFile.pathInContainer(),
"--pid=" + ctx.servicePid(), "sleep", Integer.toString(duration)));
ctx.executeCommandInNode(perfRecordCommand, true);
- Path reportFile = ctx.outputDirectoryInNode().resolve("perf-report.txt");
- ctx.executeCommandInNode(List.of("bash", "-c", "perf report --input=" + recordFile + " > " + reportFile), true);
+ ContainerPath reportFile = ctx.outputContainerPath().resolve("perf-report.txt");
+ ctx.executeCommandInNode(List.of("bash", "-c", "perf report --input=" + recordFile.pathInContainer() + " > " + reportFile.pathInContainer()), true);
return List.of(
- Artifact.newBuilder().classification(CONFIDENTIAL).fileInNode(recordFile).compressOnUpload().build(),
- Artifact.newBuilder().classification(INTERNAL).fileInNode(reportFile).build());
+ Artifact.newBuilder().classification(CONFIDENTIAL).file(recordFile).compressOnUpload().build(),
+ Artifact.newBuilder().classification(INTERNAL).file(reportFile).build());
}
}
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PmapReporter.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PmapReporter.java
index 659628d03a0..8087ea7eec0 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PmapReporter.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/PmapReporter.java
@@ -1,7 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump;
-import java.nio.file.Path;
+import com.yahoo.vespa.hosted.node.admin.task.util.fs.ContainerPath;
+
import java.util.List;
import static com.yahoo.vespa.hosted.node.admin.maintenance.servicedump.Artifact.Classification.INTERNAL;
@@ -15,9 +16,9 @@ class PmapReporter implements ArtifactProducer {
@Override
public List<Artifact> produceArtifacts(Context ctx) {
- Path pmapReport = ctx.outputDirectoryInNode().resolve("pmap.txt");
- List<String> cmd = List.of("bash", "-c", "pmap -x " + ctx.servicePid() + " > " + pmapReport);
+ ContainerPath pmapReport = ctx.outputContainerPath().resolve("pmap.txt");
+ List<String> cmd = List.of("bash", "-c", "pmap -x " + ctx.servicePid() + " > " + pmapReport.pathInContainer());
ctx.executeCommandInNode(cmd, true);
- return List.of(Artifact.newBuilder().classification(INTERNAL).fileInNode(pmapReport).build());
+ return List.of(Artifact.newBuilder().classification(INTERNAL).file(pmapReport).build());
}
}
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaLogDumper.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaLogDumper.java
index 24224789877..e6e8df7585e 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaLogDumper.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaLogDumper.java
@@ -1,10 +1,10 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.maintenance.servicedump;
+import com.yahoo.vespa.hosted.node.admin.task.util.fs.ContainerPath;
import com.yahoo.yolean.concurrent.Sleeper;
import java.nio.file.Files;
-import java.nio.file.Path;
import java.time.Duration;
import java.util.List;
import java.util.logging.Logger;
@@ -33,12 +33,12 @@ class VespaLogDumper implements ArtifactProducer {
ctx.executeCommandInNode(List.of("kill", "-SIGPROF", Integer.toString(ctx.servicePid())), true);
sleeper.sleep(Duration.ofSeconds(3));
}
- Path vespaLogFile = ctx.pathOnHostFromPathInNode(ctx.pathInNodeUnderVespaHome("logs/vespa/vespa.log"));
- Path destination = ctx.pathOnHostFromPathInNode(ctx.outputDirectoryInNode()).resolve("vespa.log");
+ ContainerPath vespaLogFile = ctx.containerPathUnderVespaHome("logs/vespa/vespa.log");
+ ContainerPath destination = ctx.outputContainerPath().resolve("vespa.log");
if (Files.exists(vespaLogFile)) {
uncheck(() -> Files.copy(vespaLogFile, destination));
return List.of(
- Artifact.newBuilder().classification(CONFIDENTIAL).fileOnHost(destination).compressOnUpload().build());
+ Artifact.newBuilder().classification(CONFIDENTIAL).file(destination).compressOnUpload().build());
} else {
log.info("Log file '" + vespaLogFile + "' does not exist");
return List.of();
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java
index 23a6ed2aa8c..45fceb93e41 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/servicedump/VespaServiceDumperImpl.java
@@ -12,11 +12,11 @@ import com.yahoo.vespa.hosted.node.admin.maintenance.sync.SyncFileInfo;
import com.yahoo.vespa.hosted.node.admin.maintenance.sync.SyncFileInfo.Compression;
import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentContext;
import com.yahoo.vespa.hosted.node.admin.task.util.file.UnixPath;
+import com.yahoo.vespa.hosted.node.admin.task.util.fs.ContainerPath;
import com.yahoo.vespa.hosted.node.admin.task.util.process.CommandResult;
import com.yahoo.yolean.concurrent.Sleeper;
import java.net.URI;
-import java.nio.file.Path;
import java.time.Clock;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
@@ -88,22 +88,22 @@ public class VespaServiceDumperImpl implements VespaServiceDumper {
handleFailure(context, request, startedAt, "No artifacts requested");
return;
}
- UnixPath directoryInNode = new UnixPath(context.pathInNodeUnderVespaHome("tmp/vespa-service-dump"));
- UnixPath directoryOnHost = new UnixPath(context.pathOnHostFromPathInNode(directoryInNode.toPath()));
+ ContainerPath directory = context.containerPathUnderVespaHome("tmp/vespa-service-dump");
+ UnixPath unixPathDirectory = new UnixPath(directory);
try {
context.log(log, Level.INFO,
"Creating service dump for " + configId + " requested at "
+ Instant.ofEpochMilli(request.getCreatedMillisOrNull()));
storeReport(context, ServiceDumpReport.createStartedReport(request, startedAt));
- if (directoryOnHost.exists()) {
- context.log(log, Level.INFO, "Removing existing directory '" + directoryOnHost +"'.");
- directoryOnHost.deleteRecursively();
+ if (unixPathDirectory.exists()) {
+ context.log(log, Level.INFO, "Removing existing directory '" + unixPathDirectory +"'.");
+ unixPathDirectory.deleteRecursively();
}
- context.log(log, Level.INFO, "Creating '" + directoryOnHost +"'.");
- directoryOnHost.createDirectory();
- directoryOnHost.setPermissions("rwxrwxrwx");
+ context.log(log, Level.INFO, "Creating '" + unixPathDirectory +"'.");
+ unixPathDirectory.createDirectory();
+ unixPathDirectory.setPermissions("rwxrwxrwx");
URI destination = serviceDumpDestination(nodeSpec, createDumpId(request));
- ProducerContext producerCtx = new ProducerContext(context, directoryInNode.toPath(), request);
+ ProducerContext producerCtx = new ProducerContext(context, directory, request);
List<Artifact> producedArtifacts = new ArrayList<>();
for (ArtifactProducer producer : artifactProducers.resolve(requestedArtifacts)) {
context.log(log, "Producing artifact of type '" + producer.artifactName() + "'");
@@ -114,9 +114,9 @@ public class VespaServiceDumperImpl implements VespaServiceDumper {
} catch (Exception e) {
handleFailure(context, request, startedAt, e);
} finally {
- if (directoryOnHost.exists()) {
- context.log(log, Level.INFO, "Deleting directory '" + directoryOnHost +"'.");
- directoryOnHost.deleteRecursively();
+ if (unixPathDirectory.exists()) {
+ context.log(log, Level.INFO, "Deleting directory '" + unixPathDirectory +"'.");
+ unixPathDirectory.deleteRecursively();
}
}
}
@@ -127,10 +127,8 @@ public class VespaServiceDumperImpl implements VespaServiceDumper {
List<SyncFileInfo> filesToUpload = producedArtifacts.stream()
.map(a -> {
Compression compression = a.compressOnUpload() ? Compression.ZSTD : Compression.NONE;
- Path fileInNode = a.fileInNode().orElse(null);
- Path fileOnHost = fileInNode != null ? ctx.pathOnHostFromPathInNode(fileInNode) : a.fileOnHost().orElseThrow();
String classification = a.classification().map(Artifact.Classification::value).orElse(null);
- return SyncFileInfo.forServiceDump(destination, fileOnHost, expiry, compression, owner, classification);
+ return SyncFileInfo.forServiceDump(destination, a.file(), expiry, compression, owner, classification);
})
.collect(Collectors.toList());
ctx.log(log, Level.INFO,
@@ -180,13 +178,13 @@ public class VespaServiceDumperImpl implements VespaServiceDumper {
private class ProducerContext implements ArtifactProducer.Context, ArtifactProducer.Context.Options {
final NodeAgentContext nodeAgentCtx;
- final Path outputDirectoryInNode;
+ final ContainerPath path;
final ServiceDumpReport request;
volatile int pid = -1;
- ProducerContext(NodeAgentContext nodeAgentCtx, Path outputDirectoryInNode, ServiceDumpReport request) {
+ ProducerContext(NodeAgentContext nodeAgentCtx, ContainerPath path, ServiceDumpReport request) {
this.nodeAgentCtx = nodeAgentCtx;
- this.outputDirectoryInNode = outputDirectoryInNode;
+ this.path = path;
this.request = request;
}
@@ -195,8 +193,8 @@ public class VespaServiceDumperImpl implements VespaServiceDumper {
@Override
public int servicePid() {
if (pid == -1) {
- Path findPidBinary = nodeAgentCtx.pathInNodeUnderVespaHome("libexec/vespa/find-pid");
- CommandResult findPidResult = executeCommandInNode(List.of(findPidBinary.toString(), serviceId()), true);
+ ContainerPath findPidBinary = nodeAgentCtx.containerPathUnderVespaHome("libexec/vespa/find-pid");
+ CommandResult findPidResult = executeCommandInNode(List.of(findPidBinary.pathInContainer(), serviceId()), true);
this.pid = Integer.parseInt(findPidResult.getOutput());
}
return pid;
@@ -225,16 +223,11 @@ public class VespaServiceDumperImpl implements VespaServiceDumper {
return result;
}
- @Override public Path outputDirectoryInNode() { return outputDirectoryInNode; }
+ @Override public ContainerPath outputContainerPath() { return path; }
@Override
- public Path pathInNodeUnderVespaHome(String relativePath) {
- return nodeAgentCtx.pathInNodeUnderVespaHome(relativePath);
- }
-
- @Override
- public Path pathOnHostFromPathInNode(Path pathInNode) {
- return nodeAgentCtx.pathOnHostFromPathInNode(pathInNode);
+ public ContainerPath containerPathUnderVespaHome(String relativePath) {
+ return nodeAgentCtx.containerPathUnderVespaHome(relativePath);
}
@Override public Options options() { return this; }