| 349 | |
| 350 | |
| 351 | Result<ContainerConfig> getContainerConfig( |
| 352 | const string& runtimeDir, |
| 353 | const ContainerID& containerId) |
| 354 | { |
| 355 | const string path = path::join( |
| 356 | getRuntimePath(runtimeDir, containerId), |
| 357 | CONTAINER_CONFIG_FILE); |
| 358 | |
| 359 | if (!os::exists(path)) { |
| 360 | // This is possible if we recovered a container launched before we |
| 361 | // started to checkpoint `ContainerConfig`. |
| 362 | VLOG(1) << "Config path '" << path << "' is missing for container' " |
| 363 | << containerId << "'"; |
| 364 | return None(); |
| 365 | } |
| 366 | |
| 367 | Result<ContainerConfig> containerConfig = state::read<ContainerConfig>(path); |
| 368 | |
| 369 | if (containerConfig.isError()) { |
| 370 | return Error("Failed to read launch config of container: " + |
| 371 | containerConfig.error()); |
| 372 | } |
| 373 | |
| 374 | return containerConfig; |
| 375 | } |
| 376 | |
| 377 | |
| 378 | Try<vector<ContainerID>> getContainerIds(const string& runtimeDir) |