Add volumes to container object at container create time

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
Mrunal Patel 2017-08-14 12:52:25 -07:00 committed by Mrunal Patel
parent 5ab6ec3046
commit fa317b41fd
2 changed files with 37 additions and 7 deletions

View file

@ -355,6 +355,18 @@ func (c *ContainerServer) LoadSandbox(id string) error {
return err
}
if m.Annotations[annotations.Volumes] != "" {
containerVolumes := []oci.ContainerVolume{}
if err = json.Unmarshal([]byte(m.Annotations[annotations.Volumes]), &containerVolumes); err != nil {
return fmt.Errorf("failed to unmarshal container volumes: %v", err)
}
if containerVolumes != nil {
for _, cv := range containerVolumes {
scontainer.AddVolume(cv)
}
}
}
c.ContainerStateFromDisk(scontainer)
if err = label.ReserveLabel(processLabel); err != nil {