Merge pull request #853 from AkihiroSuda/check-rootfs
linux: error out if no rootfs specified
This commit is contained in:
commit
c1530b5b76
@ -117,6 +117,9 @@ func (r *Runtime) Create(ctx context.Context, id string, opts plugin.CreateOpts)
|
|||||||
Options: m.Options,
|
Options: m.Options,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if len(sopts.Rootfs) == 0 {
|
||||||
|
return nil, fmt.Errorf("no rootfs was specified for id %s", id)
|
||||||
|
}
|
||||||
if _, err := s.Create(ctx, sopts); err != nil {
|
if _, err := s.Create(ctx, sopts); err != nil {
|
||||||
os.RemoveAll(path)
|
os.RemoveAll(path)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
|
|
||||||
"github.com/containerd/console"
|
"github.com/containerd/console"
|
||||||
@ -36,6 +37,9 @@ type initProcess struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newInitProcess(context context.Context, path string, r *shimapi.CreateRequest) (*initProcess, error) {
|
func newInitProcess(context context.Context, path string, r *shimapi.CreateRequest) (*initProcess, error) {
|
||||||
|
if len(r.Rootfs) == 0 {
|
||||||
|
return nil, errors.New("no rootfs was specified")
|
||||||
|
}
|
||||||
for _, rm := range r.Rootfs {
|
for _, rm := range r.Rootfs {
|
||||||
m := &containerd.Mount{
|
m := &containerd.Mount{
|
||||||
Type: rm.Type,
|
Type: rm.Type,
|
||||||
|
Loading…
Reference in New Issue
Block a user