| 414 | // offer cycle, some resource types or fields may not be specified. |
| 415 | if (!launch.container_id().has_parent()) { |
| 416 | foreach (Resource resource, launch.resources()) { |
| 417 | // Upgrade the resources (in place) to simplify validation. |
| 418 | upgradeResource(&resource); |
| 419 | |
| 420 | // Standalone containers may only use unreserved resources. |
| 421 | // There is no accounting in the master for resources consumed |
| 422 | // by standalone containers, so allowing reserved resources would |
| 423 | // only increase code complexity with no change in behavior. |
| 424 | if (Resources::isReserved(resource)) { |
| 425 | return Error("'launch_container.resources' must be unreserved"); |
| 426 | } |
| 427 | |
| 428 | // NOTE: The master normally requires all volumes be persistent, |
| 429 | // and that all persistent volumes belong to a role. Standalone |
| 430 | // containers therefore cannot use persistent volumes. |
| 431 | if (Resources::isPersistentVolume(resource)) { |
| 432 | return Error( |
| 433 | "'launch_container.resources' may not use persistent volumes"); |
| 434 | } |
| 435 | |
| 436 | // Standalone containers are expected to occupy resources *not* |
| 437 | // advertised by the agent and hence do not need to worry about |
| 438 | // being preempted or throttled. |
| 439 | if (Resources::isRevocable(resource)) { |
| 440 | return Error("'launch_container.resources' must be non-revocable"); |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | if (launch.has_command()) { |
nothing calls this directly
no test coverage detected