mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 15:02:45 +00:00
virtcontainers/sandbox: support new persist API
Fix sandbox implementation and unit tests to support the new persist API Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
4b9ab557c8
commit
00307a70ee
@ -451,7 +451,7 @@ func (c *Container) Restore() error {
|
||||
}
|
||||
|
||||
func loadSandboxConfig(id string) (*SandboxConfig, error) {
|
||||
store, err := persist.GetDriver("fs")
|
||||
store, err := persist.GetDriver()
|
||||
if err != nil || store == nil {
|
||||
return nil, errors.New("failed to get fs persist driver")
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ func TestSandboxRestore(t *testing.T) {
|
||||
config: &sconfig,
|
||||
}
|
||||
|
||||
sandbox.newStore, err = persist.GetDriver("fs")
|
||||
sandbox.newStore, err = persist.GetDriver()
|
||||
assert.NoError(err)
|
||||
assert.NotNil(sandbox.newStore)
|
||||
|
||||
|
@ -538,7 +538,7 @@ func newSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
|
||||
ctx: ctx,
|
||||
}
|
||||
|
||||
if s.newStore, err = persist.GetDriver("fs"); err != nil || s.newStore == nil {
|
||||
if s.newStore, err = persist.GetDriver(); err != nil || s.newStore == nil {
|
||||
return nil, fmt.Errorf("failed to get fs persist driver: %v", err)
|
||||
}
|
||||
|
||||
@ -622,7 +622,7 @@ func (s *Sandbox) storeSandbox() error {
|
||||
}
|
||||
|
||||
func rLockSandbox(sandboxID string) (func() error, error) {
|
||||
store, err := persist.GetDriver("fs")
|
||||
store, err := persist.GetDriver()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get fs persist driver: %v", err)
|
||||
}
|
||||
@ -631,7 +631,7 @@ func rLockSandbox(sandboxID string) (func() error, error) {
|
||||
}
|
||||
|
||||
func rwLockSandbox(sandboxID string) (func() error, error) {
|
||||
store, err := persist.GetDriver("fs")
|
||||
store, err := persist.GetDriver()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get fs persist driver: %v", err)
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ func TestDeleteStoreWhenNewContainerFail(t *testing.T) {
|
||||
}
|
||||
_, err = newContainer(p, &contConfig)
|
||||
assert.NotNil(t, err, "New container with invalid device info should fail")
|
||||
storePath := filepath.Join(fs.RunStoragePath(), testSandboxID, contID)
|
||||
storePath := filepath.Join(p.newStore.RunStoragePath(), testSandboxID, contID)
|
||||
_, err = os.Stat(storePath)
|
||||
assert.NotNil(t, err, "Should delete configuration root after failed to create a container")
|
||||
}
|
||||
@ -1160,7 +1160,7 @@ func TestAttachBlockDevice(t *testing.T) {
|
||||
}
|
||||
|
||||
// create state file
|
||||
path := filepath.Join(fs.RunStoragePath(), testSandboxID, container.ID())
|
||||
path := filepath.Join(fs.MockRunStoragePath(), testSandboxID, container.ID())
|
||||
err := os.MkdirAll(path, DirMode)
|
||||
assert.NoError(t, err)
|
||||
|
||||
@ -1238,7 +1238,7 @@ func TestPreAddDevice(t *testing.T) {
|
||||
container.state.State = types.StateReady
|
||||
|
||||
// create state file
|
||||
path := filepath.Join(fs.RunStoragePath(), testSandboxID, container.ID())
|
||||
path := filepath.Join(fs.MockRunStoragePath(), testSandboxID, container.ID())
|
||||
err := os.MkdirAll(path, DirMode)
|
||||
assert.NoError(t, err)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user