Convert bind mounts to use DB field

Refactors creation of bind mounts into a separate function that
can be called from elsewhere (e.g. pod start or container
restart). This function stores the mounts in the DB using the
field established last commit.

Spec generation now relies upon this field in the DB instead of
manually enumerating files to be bind mounted in.

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #462
Approved by: baude
This commit is contained in:
Matthew Heon
2018-03-07 14:10:19 -05:00
committed by Atomic Bot
parent c657511bce
commit 54f32f2cc0
5 changed files with 121 additions and 62 deletions

View File

@ -59,25 +59,12 @@ func (c *Container) Init() (err error) {
}
}()
// Copy /etc/resolv.conf to the container's rundir
runDirResolv, err := c.generateResolvConf()
if err != nil {
if err := c.makeBindMounts(); err != nil {
return err
}
// Copy /etc/hosts to the container's rundir
runDirHosts, err := c.generateHosts()
if err != nil {
return errors.Wrapf(err, "unable to copy /etc/hosts to container space")
}
runDirHostname, err := c.generateEtcHostname(c.Hostname())
if err != nil {
return errors.Wrapf(err, "unable to generate hostname file for container")
}
// Generate the OCI spec
spec, err := c.generateSpec(runDirResolv, runDirHosts, runDirHostname)
spec, err := c.generateSpec()
if err != nil {
return err
}