Error on no rootfs provided
Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
parent
e981cc6289
commit
acf2087db9
@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/Microsoft/hcsshim"
|
"github.com/Microsoft/hcsshim"
|
||||||
eventstypes "github.com/containerd/containerd/api/events"
|
eventstypes "github.com/containerd/containerd/api/events"
|
||||||
|
"github.com/containerd/containerd/api/types"
|
||||||
"github.com/containerd/containerd/errdefs"
|
"github.com/containerd/containerd/errdefs"
|
||||||
"github.com/containerd/containerd/events"
|
"github.com/containerd/containerd/events"
|
||||||
"github.com/containerd/containerd/log"
|
"github.com/containerd/containerd/log"
|
||||||
@ -114,6 +115,10 @@ func (r *windowsRuntime) Create(ctx context.Context, id string, opts runtime.Cre
|
|||||||
if createOpts.TerminateDuration == 0 {
|
if createOpts.TerminateDuration == 0 {
|
||||||
createOpts.TerminateDuration = defaultTerminateDuration
|
createOpts.TerminateDuration = defaultTerminateDuration
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(opts.Rootfs) == 0 {
|
||||||
|
return nil, errors.Wrap(errdefs.ErrInvalidArgument, "rootfs was not provided to container create")
|
||||||
|
}
|
||||||
spec.Windows.LayerFolders = append(spec.Windows.LayerFolders, opts.Rootfs[0].Source)
|
spec.Windows.LayerFolders = append(spec.Windows.LayerFolders, opts.Rootfs[0].Source)
|
||||||
parentLayerPaths, err := opts.Rootfs[0].GetParentPaths()
|
parentLayerPaths, err := opts.Rootfs[0].GetParentPaths()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -301,6 +306,15 @@ func (r *windowsRuntime) newTask(ctx context.Context, namespace, id string, root
|
|||||||
}
|
}
|
||||||
r.tasks.Add(ctx, t)
|
r.tasks.Add(ctx, t)
|
||||||
|
|
||||||
|
var eventRootfs []*types.Mount
|
||||||
|
for _, m := range rootfs {
|
||||||
|
eventRootfs = append(eventRootfs, &types.Mount{
|
||||||
|
Type: m.Type,
|
||||||
|
Source: m.Source,
|
||||||
|
Options: m.Options,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
r.publisher.Publish(ctx,
|
r.publisher.Publish(ctx,
|
||||||
runtime.TaskCreateEventTopic,
|
runtime.TaskCreateEventTopic,
|
||||||
&eventstypes.TaskCreate{
|
&eventstypes.TaskCreate{
|
||||||
@ -311,8 +325,8 @@ func (r *windowsRuntime) newTask(ctx context.Context, namespace, id string, root
|
|||||||
Stderr: io.Stderr,
|
Stderr: io.Stderr,
|
||||||
Terminal: io.Terminal,
|
Terminal: io.Terminal,
|
||||||
},
|
},
|
||||||
Pid: t.pid,
|
Pid: t.pid,
|
||||||
//???Rootfs: rootfs,
|
Rootfs: eventRootfs,
|
||||||
// TODO: what should be in Bundle for windows?
|
// TODO: what should be in Bundle for windows?
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user