api: RootFS -> SnapshotKey

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Akihiro Suda 2017-09-04 07:02:43 +00:00 committed by Stephen J Day
parent 8b63386924
commit e30e0c8b75
No known key found for this signature in database
GPG Key ID: 67B3DED84EDC823F
17 changed files with 168 additions and 171 deletions

View File

@ -155,14 +155,11 @@ file {
json_name: "snapshotter" json_name: "snapshotter"
} }
field { field {
name: "rootfs" name: "snapshot_key"
number: 7 number: 7
label: LABEL_OPTIONAL label: LABEL_OPTIONAL
type: TYPE_STRING type: TYPE_STRING
options { json_name: "snapshotKey"
65004: "RootFS"
}
json_name: "rootfs"
} }
field { field {
name: "created_at" name: "created_at"
@ -1216,14 +1213,11 @@ file {
json_name: "labels" json_name: "labels"
} }
field { field {
name: "rootfs" name: "snapshot_key"
number: 4 number: 4
label: LABEL_OPTIONAL label: LABEL_OPTIONAL
type: TYPE_STRING type: TYPE_STRING
options { json_name: "snapshotKey"
65004: "RootFS"
}
json_name: "rootfs"
} }
nested_type { nested_type {
name: "LabelsEntry" name: "LabelsEntry"

View File

@ -79,15 +79,17 @@ type Container struct {
Spec *google_protobuf1.Any `protobuf:"bytes,5,opt,name=spec" json:"spec,omitempty"` Spec *google_protobuf1.Any `protobuf:"bytes,5,opt,name=spec" json:"spec,omitempty"`
// Snapshotter specifies the snapshotter name used for rootfs // Snapshotter specifies the snapshotter name used for rootfs
Snapshotter string `protobuf:"bytes,6,opt,name=snapshotter,proto3" json:"snapshotter,omitempty"` Snapshotter string `protobuf:"bytes,6,opt,name=snapshotter,proto3" json:"snapshotter,omitempty"`
// RootFS specifies the snapshot key to use for the container's root // SnapshotKey specifies the snapshot key to use for the container's root
// filesystem. When starting a task from this container, a caller should // filesystem. When starting a task from this container, a caller should
// look up the mounts from the snapshot service and include those on the // look up the mounts from the snapshot service and include those on the
// task create request. // task create request.
// //
// Snapshots referenced in this field will not be garbage collected. // Snapshots referenced in this field will not be garbage collected.
// //
// This field is set to empty when the rootfs is not a snapshot.
//
// This field may be updated. // This field may be updated.
RootFS string `protobuf:"bytes,7,opt,name=rootfs,proto3" json:"rootfs,omitempty"` SnapshotKey string `protobuf:"bytes,7,opt,name=snapshot_key,json=snapshotKey,proto3" json:"snapshot_key,omitempty"`
// CreatedAt is the time the container was first created. // CreatedAt is the time the container was first created.
CreatedAt time.Time `protobuf:"bytes,8,opt,name=created_at,json=createdAt,stdtime" json:"created_at"` CreatedAt time.Time `protobuf:"bytes,8,opt,name=created_at,json=createdAt,stdtime" json:"created_at"`
// UpdatedAt is the last time the container was mutated. // UpdatedAt is the last time the container was mutated.
@ -494,11 +496,11 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintContainers(dAtA, i, uint64(len(m.Snapshotter))) i = encodeVarintContainers(dAtA, i, uint64(len(m.Snapshotter)))
i += copy(dAtA[i:], m.Snapshotter) i += copy(dAtA[i:], m.Snapshotter)
} }
if len(m.RootFS) > 0 { if len(m.SnapshotKey) > 0 {
dAtA[i] = 0x3a dAtA[i] = 0x3a
i++ i++
i = encodeVarintContainers(dAtA, i, uint64(len(m.RootFS))) i = encodeVarintContainers(dAtA, i, uint64(len(m.SnapshotKey)))
i += copy(dAtA[i:], m.RootFS) i += copy(dAtA[i:], m.SnapshotKey)
} }
dAtA[i] = 0x42 dAtA[i] = 0x42
i++ i++
@ -862,7 +864,7 @@ func (m *Container) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovContainers(uint64(l)) n += 1 + l + sovContainers(uint64(l))
} }
l = len(m.RootFS) l = len(m.SnapshotKey)
if l > 0 { if l > 0 {
n += 1 + l + sovContainers(uint64(l)) n += 1 + l + sovContainers(uint64(l))
} }
@ -1009,7 +1011,7 @@ func (this *Container) String() string {
`Runtime:` + strings.Replace(fmt.Sprintf("%v", this.Runtime), "Container_Runtime", "Container_Runtime", 1) + `,`, `Runtime:` + strings.Replace(fmt.Sprintf("%v", this.Runtime), "Container_Runtime", "Container_Runtime", 1) + `,`,
`Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`, `Spec:` + strings.Replace(fmt.Sprintf("%v", this.Spec), "Any", "google_protobuf1.Any", 1) + `,`,
`Snapshotter:` + fmt.Sprintf("%v", this.Snapshotter) + `,`, `Snapshotter:` + fmt.Sprintf("%v", this.Snapshotter) + `,`,
`RootFS:` + fmt.Sprintf("%v", this.RootFS) + `,`, `SnapshotKey:` + fmt.Sprintf("%v", this.SnapshotKey) + `,`,
`CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "google_protobuf4.Timestamp", 1), `&`, ``, 1) + `,`, `CreatedAt:` + strings.Replace(strings.Replace(this.CreatedAt.String(), "Timestamp", "google_protobuf4.Timestamp", 1), `&`, ``, 1) + `,`,
`UpdatedAt:` + strings.Replace(strings.Replace(this.UpdatedAt.String(), "Timestamp", "google_protobuf4.Timestamp", 1), `&`, ``, 1) + `,`, `UpdatedAt:` + strings.Replace(strings.Replace(this.UpdatedAt.String(), "Timestamp", "google_protobuf4.Timestamp", 1), `&`, ``, 1) + `,`,
`}`, `}`,
@ -1426,7 +1428,7 @@ func (m *Container) Unmarshal(dAtA []byte) error {
iNdEx = postIndex iNdEx = postIndex
case 7: case 7:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RootFS", wireType) return fmt.Errorf("proto: wrong wireType = %d for field SnapshotKey", wireType)
} }
var stringLen uint64 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1451,7 +1453,7 @@ func (m *Container) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.RootFS = string(dAtA[iNdEx:postIndex]) m.SnapshotKey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 8: case 8:
if wireType != 2 { if wireType != 2 {
@ -2507,52 +2509,51 @@ func init() {
} }
var fileDescriptorContainers = []byte{ var fileDescriptorContainers = []byte{
// 738 bytes of a gzipped FileDescriptorProto // 730 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0x92, 0xd2, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0x72, 0x12, 0x41,
0x14, 0x9d, 0x40, 0x26, 0x0c, 0x97, 0x8d, 0xd5, 0x22, 0xc6, 0x58, 0x05, 0x98, 0x15, 0x0b, 0x0d, 0x14, 0xcd, 0xc0, 0x04, 0xc2, 0xc5, 0x85, 0xd5, 0x22, 0x8e, 0x63, 0x15, 0x10, 0x56, 0x2c, 0x74,
0x0e, 0x5a, 0x3a, 0x8f, 0xd5, 0x30, 0xaf, 0xb2, 0x6a, 0xc6, 0x9a, 0x6a, 0x75, 0xa3, 0x8b, 0x31, 0x30, 0x68, 0x69, 0x1e, 0xab, 0x90, 0x57, 0x59, 0x26, 0x56, 0xaa, 0x4b, 0x37, 0xba, 0x88, 0x0d,
0x40, 0xc3, 0x44, 0x92, 0x74, 0x4c, 0x37, 0x54, 0x51, 0x2e, 0xf4, 0x13, 0xfc, 0x0b, 0x7f, 0x65, 0x74, 0xc8, 0xc8, 0xbc, 0x9c, 0x6e, 0xa8, 0xa2, 0x5c, 0xe8, 0x27, 0xf8, 0x17, 0xfe, 0x4a, 0x96,
0x96, 0x2e, 0x5d, 0xcd, 0x83, 0x2f, 0xb1, 0xd2, 0x49, 0x26, 0xc8, 0xa3, 0x84, 0x51, 0x76, 0x7d, 0x2e, 0x5d, 0xc5, 0x84, 0x2f, 0xb1, 0xba, 0x67, 0x26, 0x43, 0x78, 0x94, 0x10, 0x65, 0x77, 0x2f,
0xe9, 0x7b, 0xee, 0x3d, 0x39, 0xf7, 0xdc, 0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x8c, 0x09, 0x00, 0x00,
0x00, 0x00,
} }

View File

@ -67,15 +67,17 @@ message Container {
// Snapshotter specifies the snapshotter name used for rootfs // Snapshotter specifies the snapshotter name used for rootfs
string snapshotter = 6; string snapshotter = 6;
// RootFS specifies the snapshot key to use for the container's root // SnapshotKey specifies the snapshot key to use for the container's root
// filesystem. When starting a task from this container, a caller should // filesystem. When starting a task from this container, a caller should
// look up the mounts from the snapshot service and include those on the // look up the mounts from the snapshot service and include those on the
// task create request. // task create request.
// //
// Snapshots referenced in this field will not be garbage collected. // Snapshots referenced in this field will not be garbage collected.
// //
// This field is set to empty when the rootfs is not a snapshot.
//
// This field may be updated. // This field may be updated.
string rootfs = 7 [(gogoproto.customname) = "RootFS"]; string snapshot_key = 7;
// CreatedAt is the time the container was first created. // CreatedAt is the time the container was first created.
google.protobuf.Timestamp created_at = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false]; google.protobuf.Timestamp created_at = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = false];

View File

@ -94,10 +94,10 @@ func (*ContainerCreate_Runtime) Descriptor() ([]byte, []int) {
} }
type ContainerUpdate struct { type ContainerUpdate struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"` Image string `protobuf:"bytes,2,opt,name=image,proto3" json:"image,omitempty"`
Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Labels map[string]string `protobuf:"bytes,3,rep,name=labels" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
RootFS string `protobuf:"bytes,4,opt,name=rootfs,proto3" json:"rootfs,omitempty"` SnapshotKey string `protobuf:"bytes,4,opt,name=snapshot_key,json=snapshotKey,proto3" json:"snapshot_key,omitempty"`
} }
func (m *ContainerUpdate) Reset() { *m = ContainerUpdate{} } func (m *ContainerUpdate) Reset() { *m = ContainerUpdate{} }
@ -194,8 +194,8 @@ func (m *ContainerUpdate) Field(fieldpath []string) (string, bool) {
} }
value, ok := m.Labels[strings.Join(fieldpath[1:], ".")] value, ok := m.Labels[strings.Join(fieldpath[1:], ".")]
return value, ok return value, ok
case "rootfs": case "snapshot_key":
return string(m.RootFS), len(m.RootFS) > 0 return string(m.SnapshotKey), len(m.SnapshotKey) > 0
} }
return "", false return "", false
} }
@ -331,11 +331,11 @@ func (m *ContainerUpdate) MarshalTo(dAtA []byte) (int, error) {
i += copy(dAtA[i:], v) i += copy(dAtA[i:], v)
} }
} }
if len(m.RootFS) > 0 { if len(m.SnapshotKey) > 0 {
dAtA[i] = 0x22 dAtA[i] = 0x22
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(len(m.RootFS))) i = encodeVarintContainer(dAtA, i, uint64(len(m.SnapshotKey)))
i += copy(dAtA[i:], m.RootFS) i += copy(dAtA[i:], m.SnapshotKey)
} }
return i, nil return i, nil
} }
@ -442,7 +442,7 @@ func (m *ContainerUpdate) Size() (n int) {
n += mapEntrySize + 1 + sovContainer(uint64(mapEntrySize)) n += mapEntrySize + 1 + sovContainer(uint64(mapEntrySize))
} }
} }
l = len(m.RootFS) l = len(m.SnapshotKey)
if l > 0 { if l > 0 {
n += 1 + l + sovContainer(uint64(l)) n += 1 + l + sovContainer(uint64(l))
} }
@ -513,7 +513,7 @@ func (this *ContainerUpdate) String() string {
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`Image:` + fmt.Sprintf("%v", this.Image) + `,`, `Image:` + fmt.Sprintf("%v", this.Image) + `,`,
`Labels:` + mapStringForLabels + `,`, `Labels:` + mapStringForLabels + `,`,
`RootFS:` + fmt.Sprintf("%v", this.RootFS) + `,`, `SnapshotKey:` + fmt.Sprintf("%v", this.SnapshotKey) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -994,7 +994,7 @@ func (m *ContainerUpdate) Unmarshal(dAtA []byte) error {
iNdEx = postIndex iNdEx = postIndex
case 4: case 4:
if wireType != 2 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field RootFS", wireType) return fmt.Errorf("proto: wrong wireType = %d for field SnapshotKey", wireType)
} }
var stringLen uint64 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
@ -1019,7 +1019,7 @@ func (m *ContainerUpdate) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.RootFS = string(dAtA[iNdEx:postIndex]) m.SnapshotKey = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
@ -1231,32 +1231,32 @@ func init() {
} }
var fileDescriptorContainer = []byte{ var fileDescriptorContainer = []byte{
// 429 bytes of a gzipped FileDescriptorProto // 427 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x4d, 0x8b, 0xd4, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x5d, 0x8b, 0xd4, 0x30,
0x10, 0xdd, 0xce, 0xac, 0x19, 0xec, 0x39, 0x28, 0xcd, 0x20, 0x71, 0xc0, 0xec, 0x30, 0xa7, 0xf1, 0x14, 0xdd, 0x74, 0xd6, 0x19, 0x4c, 0x05, 0x25, 0x0c, 0x52, 0x07, 0xac, 0xe3, 0x3c, 0x8d, 0x2f,
0xd2, 0xcd, 0x8e, 0x20, 0xba, 0x82, 0xe8, 0xee, 0xaa, 0x08, 0x0a, 0xd2, 0xe2, 0x45, 0xbc, 0xf4, 0x09, 0x3b, 0x82, 0xe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e, 0xfa, 0xcf, 0x5f, 0xff, 0xa1, 0x43, 0xd1, 0xd8, 0x7e, 0x93, 0xbb, 0x3f, 0x02, 0x00,
0x01, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xae, 0x41, 0x3c, 0x44, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0x26, 0x0d, 0x55, 0x1c, 0x43, 0x03, 0x00, 0x00,
} }

View File

@ -23,7 +23,7 @@ message ContainerUpdate {
string id = 1; string id = 1;
string image = 2; string image = 2;
map<string, string> labels = 3; map<string, string> labels = 3;
string rootfs = 4 [(gogoproto.customname) = "RootFS"]; string snapshot_key = 4;
} }
message ContainerDelete { message ContainerDelete {

View File

@ -173,13 +173,13 @@ func (c *container) NewTask(ctx context.Context, ioCreate IOCreation, opts ...Ne
Stdout: cfg.Stdout, Stdout: cfg.Stdout,
Stderr: cfg.Stderr, Stderr: cfg.Stderr,
} }
if c.c.RootFS != "" { if c.c.SnapshotKey != "" {
if c.c.Snapshotter == "" { if c.c.Snapshotter == "" {
return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "unable to resolve rootfs mounts without snapshotter on container") return nil, errors.Wrapf(errdefs.ErrInvalidArgument, "unable to resolve rootfs mounts without snapshotter on container")
} }
// get the rootfs from the snapshotter and add it to the request // get the rootfs from the snapshotter and add it to the request
mounts, err := c.client.SnapshotService(c.c.Snapshotter).Mounts(ctx, c.c.RootFS) mounts, err := c.client.SnapshotService(c.c.Snapshotter).Mounts(ctx, c.c.SnapshotKey)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -70,7 +70,7 @@ func WithSnapshot(id string) NewContainerOpts {
if _, err := client.SnapshotService(c.Snapshotter).Mounts(ctx, id); err != nil { if _, err := client.SnapshotService(c.Snapshotter).Mounts(ctx, id); err != nil {
return err return err
} }
c.RootFS = id c.SnapshotKey = id
return nil return nil
} }
} }
@ -87,19 +87,19 @@ func WithNewSnapshot(id string, i Image) NewContainerOpts {
if _, err := client.SnapshotService(c.Snapshotter).Prepare(ctx, id, identity.ChainID(diffIDs).String()); err != nil { if _, err := client.SnapshotService(c.Snapshotter).Prepare(ctx, id, identity.ChainID(diffIDs).String()); err != nil {
return err return err
} }
c.RootFS = id c.SnapshotKey = id
c.Image = i.Name() c.Image = i.Name()
return nil return nil
} }
} }
// WithSnapshotCleanup deletes the rootfs allocated for the container // WithSnapshotCleanup deletes the rootfs snapshot allocated for the container
func WithSnapshotCleanup(ctx context.Context, client *Client, c containers.Container) error { func WithSnapshotCleanup(ctx context.Context, client *Client, c containers.Container) error {
if c.RootFS != "" { if c.SnapshotKey != "" {
if c.Snapshotter == "" { if c.Snapshotter == "" {
return errors.Wrapf(errdefs.ErrInvalidArgument, "container.Snapshotter must be set to cleanup rootfs") return errors.Wrapf(errdefs.ErrInvalidArgument, "container.Snapshotter must be set to cleanup rootfs snapshot")
} }
return client.SnapshotService(c.Snapshotter).Remove(ctx, c.RootFS) return client.SnapshotService(c.Snapshotter).Remove(ctx, c.SnapshotKey)
} }
return nil return nil
} }
@ -116,7 +116,7 @@ func WithNewSnapshotView(id string, i Image) NewContainerOpts {
if _, err := client.SnapshotService(c.Snapshotter).View(ctx, id, identity.ChainID(diffIDs).String()); err != nil { if _, err := client.SnapshotService(c.Snapshotter).View(ctx, id, identity.ChainID(diffIDs).String()); err != nil {
return err return err
} }
c.RootFS = id c.SnapshotKey = id
c.Image = i.Name() c.Image = i.Name()
return nil return nil
} }

View File

@ -22,7 +22,7 @@ import (
// WithCheckpoint allows a container to be created from the checkpointed information // WithCheckpoint allows a container to be created from the checkpointed information
// provided by the descriptor. The image, snapshot, and runtime specifications are // provided by the descriptor. The image, snapshot, and runtime specifications are
// restored on the container // restored on the container
func WithCheckpoint(desc v1.Descriptor, rootfsID string) NewContainerOpts { func WithCheckpoint(desc v1.Descriptor, snapshotKey string) NewContainerOpts {
// set image and rw, and spec // set image and rw, and spec
return func(ctx context.Context, client *Client, c *containers.Container) error { return func(ctx context.Context, client *Client, c *containers.Container) error {
id := desc.Digest id := desc.Digest
@ -47,7 +47,7 @@ func WithCheckpoint(desc v1.Descriptor, rootfsID string) NewContainerOpts {
return err return err
} }
setSnapshotterIfEmpty(c) setSnapshotterIfEmpty(c)
if _, err := client.SnapshotService(c.Snapshotter).Prepare(ctx, rootfsID, identity.ChainID(diffIDs).String()); err != nil { if _, err := client.SnapshotService(c.Snapshotter).Prepare(ctx, snapshotKey, identity.ChainID(diffIDs).String()); err != nil {
if !errdefs.IsAlreadyExists(err) { if !errdefs.IsAlreadyExists(err) {
return err return err
} }
@ -67,7 +67,7 @@ func WithCheckpoint(desc v1.Descriptor, rootfsID string) NewContainerOpts {
} }
if rw != nil { if rw != nil {
// apply the rw snapshot to the new rw layer // apply the rw snapshot to the new rw layer
mounts, err := client.SnapshotService(c.Snapshotter).Mounts(ctx, rootfsID) mounts, err := client.SnapshotService(c.Snapshotter).Mounts(ctx, snapshotKey)
if err != nil { if err != nil {
return err return err
} }
@ -75,7 +75,7 @@ func WithCheckpoint(desc v1.Descriptor, rootfsID string) NewContainerOpts {
return err return err
} }
} }
c.RootFS = rootfsID c.SnapshotKey = snapshotKey
return nil return nil
} }
} }

View File

@ -39,13 +39,13 @@ type Container struct {
// This field is required but mutable. // This field is required but mutable.
Spec *types.Any Spec *types.Any
// RootFS specifies the snapshot key to use for the container's root // SnapshotKey specifies the snapshot key to use for the container's root
// filesystem. When starting a task from this container, a caller should // filesystem. When starting a task from this container, a caller should
// look up the mounts from the snapshot service and include those on the // look up the mounts from the snapshot service and include those on the
// task create request. // task create request.
// //
// This field is not required but immutable. // This field is not required but immutable.
RootFS string SnapshotKey string
// Snapshotter specifies the snapshotter name used for rootfs // Snapshotter specifies the snapshotter name used for rootfs
// //

View File

@ -96,7 +96,7 @@ func containerToProto(container *containers.Container) containersapi.Container {
}, },
Spec: container.Spec, Spec: container.Spec,
Snapshotter: container.Snapshotter, Snapshotter: container.Snapshotter,
RootFS: container.RootFS, SnapshotKey: container.SnapshotKey,
} }
} }
@ -115,7 +115,7 @@ func containerFromProto(containerpb *containersapi.Container) containers.Contain
Runtime: runtime, Runtime: runtime,
Spec: containerpb.Spec, Spec: containerpb.Spec,
Snapshotter: containerpb.Snapshotter, Snapshotter: containerpb.Snapshotter,
RootFS: containerpb.RootFS, SnapshotKey: containerpb.SnapshotKey,
} }
} }

View File

@ -47,7 +47,7 @@ var (
bucketKeyParent = []byte("parent") bucketKeyParent = []byte("parent")
bucketKeyOptions = []byte("options") bucketKeyOptions = []byte("options")
bucketKeySpec = []byte("spec") bucketKeySpec = []byte("spec")
bucketKeyRootFS = []byte("rootfs") bucketKeySnapshotKey = []byte("snapshotKey")
bucketKeySnapshotter = []byte("snapshotter") bucketKeySnapshotter = []byte("snapshotter")
bucketKeyTarget = []byte("target") bucketKeyTarget = []byte("target")
) )

View File

@ -155,8 +155,8 @@ func (s *containerStore) Update(ctx context.Context, container containers.Contai
return containers.Container{}, errors.Wrapf(errdefs.ErrInvalidArgument, "container.Image field is immutable") return containers.Container{}, errors.Wrapf(errdefs.ErrInvalidArgument, "container.Image field is immutable")
} }
if updated.RootFS != container.RootFS { if updated.SnapshotKey != container.SnapshotKey {
return containers.Container{}, errors.Wrapf(errdefs.ErrInvalidArgument, "container.RootFS field is immutable") return containers.Container{}, errors.Wrapf(errdefs.ErrInvalidArgument, "container.SnapshotKey field is immutable")
} }
if updated.Snapshotter != container.Snapshotter { if updated.Snapshotter != container.Snapshotter {
@ -235,8 +235,8 @@ func validateContainer(container *containers.Container) error {
return errors.Wrapf(errdefs.ErrInvalidArgument, "container.Spec must be set") return errors.Wrapf(errdefs.ErrInvalidArgument, "container.Spec must be set")
} }
if container.RootFS != "" && container.Snapshotter == "" { if container.SnapshotKey != "" && container.Snapshotter == "" {
return errors.Wrapf(errdefs.ErrInvalidArgument, "container.Snapshotter must be set if container.RootFS is set") return errors.Wrapf(errdefs.ErrInvalidArgument, "container.Snapshotter must be set if container.SnapshotKey is set")
} }
return nil return nil
@ -284,8 +284,8 @@ func readContainer(container *containers.Container, bkt *bolt.Bucket) error {
return err return err
} }
container.Spec = &any container.Spec = &any
case string(bucketKeyRootFS): case string(bucketKeySnapshotKey):
container.RootFS = string(v) container.SnapshotKey = string(v)
case string(bucketKeySnapshotter): case string(bucketKeySnapshotter):
container.Snapshotter = string(v) container.Snapshotter = string(v)
} }
@ -313,7 +313,7 @@ func writeContainer(bkt *bolt.Bucket, container *containers.Container) error {
for _, v := range [][2][]byte{ for _, v := range [][2][]byte{
{bucketKeyImage, []byte(container.Image)}, {bucketKeyImage, []byte(container.Image)},
{bucketKeySnapshotter, []byte(container.Snapshotter)}, {bucketKeySnapshotter, []byte(container.Snapshotter)},
{bucketKeyRootFS, []byte(container.RootFS)}, {bucketKeySnapshotKey, []byte(container.SnapshotKey)},
} { } {
if err := bkt.Put(v[0], v[1]); err != nil { if err := bkt.Put(v[0], v[1]); err != nil {
return err return err

View File

@ -45,7 +45,7 @@ func TestContainersList(t *testing.T) {
"odd": fmt.Sprint(i%2 != 0), "odd": fmt.Sprint(i%2 != 0),
}, },
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -194,7 +194,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
name: "UpdateIDFail", name: "UpdateIDFail",
original: containers.Container{ original: containers.Container{
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -213,7 +213,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
{ {
name: "UpdateRuntimeFail", name: "UpdateRuntimeFail",
original: containers.Container{ original: containers.Container{
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Spec: encoded, Spec: encoded,
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
@ -233,7 +233,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
name: "UpdateRuntimeClearFail", name: "UpdateRuntimeClearFail",
original: containers.Container{ original: containers.Container{
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -249,7 +249,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
name: "UpdateFail", name: "UpdateFail",
original: containers.Container{ original: containers.Container{
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
@ -262,7 +262,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
}, },
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
// try to clear image field // try to clear image field
}, },
@ -272,7 +272,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
name: "UpdateSpec", name: "UpdateSpec",
original: containers.Container{ original: containers.Container{
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -288,7 +288,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
Name: "testruntime", Name: "testruntime",
}, },
Spec: encodedUpdated, Spec: encodedUpdated,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Image: "test image", Image: "test image",
}, },
@ -301,7 +301,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
"bar": "two", "bar": "two",
}, },
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -320,7 +320,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
"bar": "baz", "bar": "baz",
}, },
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -336,7 +336,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
"bar": "two", "bar": "two",
}, },
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -349,7 +349,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
fieldpaths: []string{"labels"}, fieldpaths: []string{"labels"},
expected: containers.Container{ expected: containers.Container{
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -365,7 +365,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
"bar": "two", "bar": "two",
}, },
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -383,7 +383,7 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
"foo": "one", "foo": "one",
}, },
Spec: encoded, Spec: encoded,
RootFS: "test-rootfs", SnapshotKey: "test-snapshot-key",
Snapshotter: "snapshotter", Snapshotter: "snapshotter",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
@ -392,27 +392,27 @@ func TestContainersCreateUpdateDelete(t *testing.T) {
}, },
}, },
{ {
name: "UpdateRootFSImmutable", name: "UpdateSnapshotKeyImmutable",
original: containers.Container{ original: containers.Container{
Spec: encoded, Spec: encoded,
RootFS: "", SnapshotKey: "",
Snapshotter: "", Snapshotter: "",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",
}, },
}, },
input: containers.Container{ input: containers.Container{
RootFS: "something", SnapshotKey: "something",
Snapshotter: "something", Snapshotter: "something",
}, },
fieldpaths: []string{"rootfs", "snapshotter"}, fieldpaths: []string{"snapshotkey", "snapshotter"},
cause: errdefs.ErrInvalidArgument, cause: errdefs.ErrInvalidArgument,
}, },
{ {
name: "RootFSWithoutSnapshot", name: "SnapshotKeyWithoutSnapshot",
original: containers.Container{ original: containers.Container{
Spec: encoded, Spec: encoded,
RootFS: "/nosnapshot", SnapshotKey: "/nosnapshot",
Snapshotter: "", Snapshotter: "",
Runtime: containers.RuntimeInfo{ Runtime: containers.RuntimeInfo{
Name: "testruntime", Name: "testruntime",

View File

@ -26,7 +26,7 @@ func containerToProto(container *containers.Container) api.Container {
}, },
Spec: container.Spec, Spec: container.Spec,
Snapshotter: container.Snapshotter, Snapshotter: container.Snapshotter,
RootFS: container.RootFS, SnapshotKey: container.SnapshotKey,
} }
} }
@ -45,6 +45,6 @@ func containerFromProto(containerpb *api.Container) containers.Container {
Runtime: runtime, Runtime: runtime,
Spec: containerpb.Spec, Spec: containerpb.Spec,
Snapshotter: containerpb.Snapshotter, Snapshotter: containerpb.Snapshotter,
RootFS: containerpb.RootFS, SnapshotKey: containerpb.SnapshotKey,
} }
} }

View File

@ -136,10 +136,10 @@ func (s *Service) Update(ctx context.Context, req *api.UpdateContainerRequest) (
} }
if err := s.publisher.Publish(ctx, "/containers/update", &eventsapi.ContainerUpdate{ if err := s.publisher.Publish(ctx, "/containers/update", &eventsapi.ContainerUpdate{
ID: resp.Container.ID, ID: resp.Container.ID,
Image: resp.Container.Image, Image: resp.Container.Image,
Labels: resp.Container.Labels, Labels: resp.Container.Labels,
RootFS: resp.Container.RootFS, SnapshotKey: resp.Container.SnapshotKey,
}); err != nil { }); err != nil {
return &resp, err return &resp, err
} }

View File

@ -251,7 +251,7 @@ func withRemappedSnapshotBase(id string, i Image, uid, gid uint32, readonly bool
if _, err := snapshotter.Prepare(ctx, id, usernsID); err != nil { if _, err := snapshotter.Prepare(ctx, id, usernsID); err != nil {
return err return err
} }
c.RootFS = id c.SnapshotKey = id
c.Image = i.Name() c.Image = i.Name()
return nil return nil
} }
@ -274,7 +274,7 @@ func withRemappedSnapshotBase(id string, i Image, uid, gid uint32, readonly bool
if err != nil { if err != nil {
return err return err
} }
c.RootFS = id c.SnapshotKey = id
c.Image = i.Name() c.Image = i.Name()
return nil return nil
} }
@ -319,11 +319,11 @@ func WithUserID(uid uint32) SpecOpts {
if c.Snapshotter == "" { if c.Snapshotter == "" {
return errors.Errorf("no snapshotter set for container") return errors.Errorf("no snapshotter set for container")
} }
if c.RootFS == "" { if c.SnapshotKey == "" {
return errors.Errorf("rootfs not created for container") return errors.Errorf("rootfs snapshot not created for container")
} }
snapshotter := client.SnapshotService(c.Snapshotter) snapshotter := client.SnapshotService(c.Snapshotter)
mounts, err := snapshotter.Mounts(ctx, c.RootFS) mounts, err := snapshotter.Mounts(ctx, c.SnapshotKey)
if err != nil { if err != nil {
return err return err
} }
@ -376,11 +376,11 @@ func WithUsername(username string) SpecOpts {
if c.Snapshotter == "" { if c.Snapshotter == "" {
return errors.Errorf("no snapshotter set for container") return errors.Errorf("no snapshotter set for container")
} }
if c.RootFS == "" { if c.SnapshotKey == "" {
return errors.Errorf("rootfs not created for container") return errors.Errorf("rootfs snapshot not created for container")
} }
snapshotter := client.SnapshotService(c.Snapshotter) snapshotter := client.SnapshotService(c.Snapshotter)
mounts, err := snapshotter.Mounts(ctx, c.RootFS) mounts, err := snapshotter.Mounts(ctx, c.SnapshotKey)
if err != nil { if err != nil {
return err return err
} }

View File

@ -415,7 +415,7 @@ func (t *task) Checkpoint(ctx context.Context, opts ...CheckpointTaskOpts) (d v1
if err := t.checkpointImage(ctx, &index, cr.Image); err != nil { if err := t.checkpointImage(ctx, &index, cr.Image); err != nil {
return d, err return d, err
} }
if err := t.checkpointRWSnapshot(ctx, &index, cr.Snapshotter, cr.RootFS); err != nil { if err := t.checkpointRWSnapshot(ctx, &index, cr.Snapshotter, cr.SnapshotKey); err != nil {
return d, err return d, err
} }
index.Annotations = make(map[string]string) index.Annotations = make(map[string]string)