Documentation
¶
Index ¶
- Constants
- func AddExternalNamespacesForDump(nsTypes ...configs.NamespaceType) types.Adapter[types.Dump]
- func AddRecognizedExternalNamespacesForDump(next types.Dump) types.Dump
- func CriuNsToKey(t configs.NamespaceType) string
- func IgnoreNamespacesForDump(nsTypes ...configs.NamespaceType) types.Adapter[types.Dump]
- func IgnoreNamespacesForRestore(nsTypes ...configs.NamespaceType) types.Adapter[types.Restore]
- func InheritExternalNamespacesForRestore(nsTypes ...configs.NamespaceType) types.Adapter[types.Restore]
- func InheritRecognizedNamespacesForRestore(next types.Restore) types.Restore
- type ExternalNamespace
- type Handling
- type HolderKind
- type PrivateMount
- type RecognizedNamespace
Constants ¶
const EXTERNAL_NAMESPACES_FILE = "external_namespaces.json"
Records how the external namespaces were handled on dump, so that restore mirrors it exactly
Variables ¶
This section is empty.
Functions ¶
func AddRecognizedExternalNamespacesForDump ¶ added in v0.9.309
Detects the namespaces of the job that are external (created by whatever launched it, see RecognizeExternalNamespaces) and handles only those. Unlike AddExternalNamespacesForDump, this does not touch CRIU opts when the job is simply running in the host's namespaces.
net, pid -> left out of the dump using --external
mnt -> nothing to tell CRIU, which has no notion of an external mount namespace: the
job is dumped from inside it, where cedana-slurm starts the monitor, and the
dump is refused from anywhere else. Recorded as "inside", for the restore to
hold itself to the same.
What was done is recorded in the dump, for InheritRecognizedNamespacesForRestore.
func CriuNsToKey ¶
func CriuNsToKey(t configs.NamespaceType) string
func IgnoreNamespacesForDump ¶
func InheritExternalNamespacesForRestore ¶
func InheritExternalNamespacesForRestore(nsTypes ...configs.NamespaceType) types.Adapter[types.Restore]
If the container is running in a network or PID namespace and has a path to the network or PID namespace configured, we will dump that network or PID namespace as an external namespace and we will expect that the namespace exists during restore. This basically means that CRIU will ignore the namespace and expect it to be setup correctly.
func InheritRecognizedNamespacesForRestore ¶ added in v0.9.309
Counterpart of AddRecognizedExternalNamespacesForDump. Mirrors exactly what was recorded in the dump, using the namespaces of the job being restored into. Does nothing if the dump has no external namespaces recorded.
Types ¶
type ExternalNamespace ¶ added in v0.9.309
type ExternalNamespace struct {
Type configs.NamespaceType
Handling Handling
Holder HolderKind
}
type Handling ¶ added in v0.9.309
type Handling string
const ( // Namespace is left out of the dump using --external, and inherited on restore using --inherit-fd HandlingExternal Handling = "external" // The job has the namespace to itself, and was dumped from inside it, so the dump has no // trace of it. The restore has to run from inside the new job's as well, or CRIU would // restore into ours. Only for mnt: CRIU has no notion of an external mount namespace. HandlingInside Handling = "inside" // Recorded by earlier dumps for a mount namespace CRIU was put inside of. The same thing // to a restore as HandlingInside. Still read, for those dumps. HandlingEnter Handling = "enter" )
type HolderKind ¶ added in v0.9.309
type HolderKind string
const ( HolderPin HolderKind = "pin" // bind-mounted nsfs file HolderProcess HolderKind = "process" // ancestor of the job, outside the dumped tree )
type PrivateMount ¶ added in v0.9.309
type PrivateMount struct {
Mountpoint string
FSType string
// Where it is on the node: <basepath>/<jobid>/.<jobid>/<dir>
Root string
}
PrivateMount is a directory of the job's own, mounted into its namespace by SLURM
func SlurmMounts ¶ added in v0.9.309
func SlurmMounts(pid uint32, jobID uint32) ([]PrivateMount, error)
SlurmMounts returns the mounts of pid that SLURM's namespace plugin made for the job, in the order they are mounted.
type RecognizedNamespace ¶ added in v0.9.309
type RecognizedNamespace struct {
Type configs.NamespaceType
Inode uint64
Holder HolderKind
// Where it's held. For HolderPin it's the pin, e.g. <basepath>/<jobid>/.ns/pid, as seen from the
// mount namespace it was found in, which may not be ours. To open the namespace, use the job's own /proc/<pid>/ns.
Path string
HolderPID uint32 // HolderProcess: closest ancestor sharing the namespace
}
RecognizedNamespace is a namespace the job lives in that is held open by something outside the job.
func RecognizeExternalNamespaces ¶ added in v0.9.309
func RecognizeExternalNamespaces(pid uint32, jobID uint32) ([]RecognizedNamespace, error)
RecognizeExternalNamespaces returns the namespaces of pid, a process of job jobID, that differ from the host's and are held from outside, by an nsfs mount or by an ancestor. Returns nothing if the process is simply running in the host's namespaces.