mirror of
https://github.com/containers/podman.git
synced 2025-10-15 10:16:28 +08:00
Add pod state
Add a mutable state to pods, and database backend sutable for modifying and updating said state. Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #784 Approved by: rhatdan
This commit is contained in:
@ -256,13 +256,22 @@ func (s *BoltState) getPodFromDB(id []byte, pod *Pod, podBkt *bolt.Bucket) error
|
||||
return errors.Wrapf(ErrNoSuchPod, "pod with ID %s not found", string(id))
|
||||
}
|
||||
|
||||
podBytes := podDB.Get(configKey)
|
||||
if podBytes == nil {
|
||||
podConfigBytes := podDB.Get(configKey)
|
||||
if podConfigBytes == nil {
|
||||
return errors.Wrapf(ErrInternal, "pod %s is missing configuration key in DB", string(id))
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(podBytes, pod.config); err != nil {
|
||||
return errors.Wrapf(err, "error unmarshalling pod %s from DB", string(id))
|
||||
if err := json.Unmarshal(podConfigBytes, pod.config); err != nil {
|
||||
return errors.Wrapf(err, "error unmarshalling pod %s config from DB", string(id))
|
||||
}
|
||||
|
||||
podStateBytes := podDB.Get(stateKey)
|
||||
if podStateBytes == nil {
|
||||
return errors.Wrapf(ErrInternal, "pod %s is missing state key in DB", string(id))
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(podStateBytes, pod.state); err != nil {
|
||||
return errors.Wrapf(err, "error unmarshalling pod %s state from DB", string(id))
|
||||
}
|
||||
|
||||
// Get the lock
|
||||
|
Reference in New Issue
Block a user