summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>2023-05-16 15:10:07 +0900
committerGitHub <noreply@github.com>2023-05-16 15:10:07 +0900
commit1371aee3cc38134778e2e85f1a4122d1b31d344d (patch)
tree8947b57138e50f434702aab158bb6d40d33d02da
parent9548916aa83ded9f90c93a3d3b37074a03b47dc9 (diff)
parent913b0f51cab18a56247a950f5f1e75ca79b63039 (diff)
downloaddocker-1371aee3cc38134778e2e85f1a4122d1b31d344d.tar.gz
Merge pull request #45469 from thaJeztah/deprecate_virtualsize_STEP2
API: omit deprecated VirtualSize field for API v1.44 and up
-rw-r--r--api/server/router/image/image_routes.go9
-rw-r--r--api/server/router/system/system_routes.go5
-rw-r--r--api/swagger.yaml16
-rw-r--r--api/types/image_summary.go7
-rw-r--r--api/types/types.go7
-rw-r--r--daemon/containerd/image_list.go1
-rw-r--r--daemon/images/image_list.go9
-rw-r--r--docs/api/version-history.md4
-rw-r--r--integration/system/disk_usage_test.go9
9 files changed, 29 insertions, 38 deletions
diff --git a/api/server/router/image/image_routes.go b/api/server/router/image/image_routes.go
index 23185b9024..a8aaee3b3b 100644
--- a/api/server/router/image/image_routes.go
+++ b/api/server/router/image/image_routes.go
@@ -263,6 +263,10 @@ func (ir *imageRouter) getImagesByName(ctx context.Context, w http.ResponseWrite
return err
}
+ version := httputils.VersionFromContext(ctx)
+ if versions.LessThan(version, "1.44") {
+ imageInspect.VirtualSize = imageInspect.Size //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
+ }
return httputils.WriteJSON(w, http.StatusOK, imageInspect)
}
@@ -299,7 +303,6 @@ func (ir *imageRouter) toImageInspect(img *image.Image) (*types.ImageInspect, er
Os: img.OperatingSystem(),
OsVersion: img.OSVersion,
Size: img.Details.Size,
- VirtualSize: img.Details.Size, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
GraphDriver: types.GraphDriverData{
Name: img.Details.Driver,
Data: img.Details.Metadata,
@@ -357,6 +360,7 @@ func (ir *imageRouter) getImagesJSON(ctx context.Context, w http.ResponseWriter,
}
useNone := versions.LessThan(version, "1.43")
+ withVirtualSize := versions.LessThan(version, "1.44")
for _, img := range images {
if useNone {
if len(img.RepoTags) == 0 && len(img.RepoDigests) == 0 {
@@ -371,6 +375,9 @@ func (ir *imageRouter) getImagesJSON(ctx context.Context, w http.ResponseWriter,
img.RepoDigests = []string{}
}
}
+ if withVirtualSize {
+ img.VirtualSize = img.Size //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
+ }
}
return httputils.WriteJSON(w, http.StatusOK, images)
diff --git a/api/server/router/system/system_routes.go b/api/server/router/system/system_routes.go
index e918215fdb..6bfcd673f1 100644
--- a/api/server/router/system/system_routes.go
+++ b/api/server/router/system/system_routes.go
@@ -185,6 +185,11 @@ func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter,
b.Parent = "" //nolint:staticcheck // ignore SA1019 (Parent field is deprecated)
}
}
+ if versions.LessThan(version, "1.44") {
+ for _, b := range systemDiskUsage.Images {
+ b.VirtualSize = b.Size //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
+ }
+ }
du := types.DiskUsage{
BuildCache: buildCache,
diff --git a/api/swagger.yaml b/api/swagger.yaml
index aa82fe0f5e..418251377a 100644
--- a/api/swagger.yaml
+++ b/api/swagger.yaml
@@ -1781,13 +1781,7 @@ definitions:
description: |
Total size of the image including all layers it is composed of.
- In versions of Docker before v1.10, this field was calculated from
- the image itself and all of its parent images. Images are now stored
- self-contained, and no longer use a parent-chain, making this field
- an equivalent of the Size field.
-
- > **Deprecated**: this field is kept for backward compatibility, but
- > will be removed in API v1.44.
+ Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 1239828
@@ -1925,12 +1919,7 @@ definitions:
description: |-
Total size of the image including all layers it is composed of.
- In versions of Docker before v1.10, this field was calculated from
- the image itself and all of its parent images. Images are now stored
- self-contained, and no longer use a parent-chain, making this field
- an equivalent of the Size field.
-
- Deprecated: this field is kept for backward compatibility, and will be removed in API v1.44.
+ Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
type: "integer"
format: "int64"
example: 172064416
@@ -9066,7 +9055,6 @@ paths:
Created: 1466724217
Size: 1092588
SharedSize: 0
- VirtualSize: 1092588
Labels: {}
Containers: 1
Containers:
diff --git a/api/types/image_summary.go b/api/types/image_summary.go
index 0f6f144840..076848ad5f 100644
--- a/api/types/image_summary.go
+++ b/api/types/image_summary.go
@@ -84,11 +84,6 @@ type ImageSummary struct {
// Total size of the image including all layers it is composed of.
//
- // In versions of Docker before v1.10, this field was calculated from
- // the image itself and all of its parent images. Images are now stored
- // self-contained, and no longer use a parent-chain, making this field
- // an equivalent of the Size field.
- //
- // Deprecated: this field is kept for backward compatibility, and will be removed in API v1.44.
+ // Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
VirtualSize int64 `json:"VirtualSize,omitempty"`
}
diff --git a/api/types/types.go b/api/types/types.go
index b413e02000..d6aa3d6385 100644
--- a/api/types/types.go
+++ b/api/types/types.go
@@ -118,12 +118,7 @@ type ImageInspect struct {
// VirtualSize is the total size of the image including all layers it is
// composed of.
//
- // In versions of Docker before v1.10, this field was calculated from
- // the image itself and all of its parent images. Docker v1.10 and up
- // store images self-contained, and no longer use a parent-chain, making
- // this field an equivalent of the Size field.
- //
- // Deprecated: Unused in API 1.43 and up, but kept for backward compatibility with older API versions.
+ // Deprecated: this field is omitted in API v1.44, but kept for backward compatibility. Use Size instead.
VirtualSize int64 `json:"VirtualSize,omitempty"`
// GraphDriver holds information about the storage driver used to store the
diff --git a/daemon/containerd/image_list.go b/daemon/containerd/image_list.go
index a9f3405353..66326c1207 100644
--- a/daemon/containerd/image_list.go
+++ b/daemon/containerd/image_list.go
@@ -250,7 +250,6 @@ func (i *ImageService) singlePlatformImage(ctx context.Context, contentStore con
RepoDigests: repoDigests,
RepoTags: repoTags,
Size: totalSize,
- VirtualSize: totalSize, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
// -1 indicates that the value has not been set (avoids ambiguity
// between 0 (default) and "not set". We cannot use a pointer (nil)
// for this, as the JSON representation uses "omitempty", which would
diff --git a/daemon/images/image_list.go b/daemon/images/image_list.go
index 1c3331c8b7..00161434c4 100644
--- a/daemon/images/image_list.go
+++ b/daemon/images/image_list.go
@@ -257,11 +257,10 @@ func (i *ImageService) Images(ctx context.Context, opts types.ImageListOptions)
func newImageSummary(image *image.Image, size int64) *types.ImageSummary {
summary := &types.ImageSummary{
- ParentID: image.Parent.String(),
- ID: image.ID().String(),
- Created: image.Created.Unix(),
- Size: size,
- VirtualSize: size, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
+ ParentID: image.Parent.String(),
+ ID: image.ID().String(),
+ Created: image.Created.Unix(),
+ Size: size,
// -1 indicates that the value has not been set (avoids ambiguity
// between 0 (default) and "not set". We cannot use a pointer (nil)
// for this, as the JSON representation uses "omitempty", which would
diff --git a/docs/api/version-history.md b/docs/api/version-history.md
index 993f3193f2..61d2545118 100644
--- a/docs/api/version-history.md
+++ b/docs/api/version-history.md
@@ -17,6 +17,10 @@ keywords: "API, Docker, rcli, REST, documentation"
[Docker Engine API v1.44](https://docs.docker.com/engine/api/v1.44/) documentation
+* The `VirtualSize` field in the `GET /images/{name}/json`, `GET /images/json`,
+ and `GET /system/df` responses is now omitted. Use the `Size` field instead,
+ which contains the same information.
+
## v1.43 API changes
[Docker Engine API v1.43](https://docs.docker.com/engine/api/v1.43/) documentation
diff --git a/integration/system/disk_usage_test.go b/integration/system/disk_usage_test.go
index 17d3b2c318..c0513073c1 100644
--- a/integration/system/disk_usage_test.go
+++ b/integration/system/disk_usage_test.go
@@ -57,11 +57,10 @@ func TestDiskUsage(t *testing.T) {
LayersSize: du.LayersSize,
Images: []*types.ImageSummary{
{
- Created: du.Images[0].Created,
- ID: du.Images[0].ID,
- RepoTags: []string{"busybox:latest"},
- Size: du.LayersSize,
- VirtualSize: du.LayersSize, //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
+ Created: du.Images[0].Created,
+ ID: du.Images[0].ID,
+ RepoTags: []string{"busybox:latest"},
+ Size: du.LayersSize,
},
},
Containers: []*types.Container{},