Add volumes to container object at container create time
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
5ab6ec3046
commit
fa317b41fd
2 changed files with 37 additions and 7 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue