!32 Optimize the apply patch method

From: @xu_lei_123 
Reviewed-by: @yangzhao_kl 
Signed-off-by: @yangzhao_kl
This commit is contained in:
openeuler-ci-bot 2023-09-19 08:36:30 +00:00 committed by Gitee
commit 3c22d58561
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 14 additions and 80 deletions

View File

@ -1,34 +0,0 @@
#!/bin/bash
# Description: This shell script is used to apply patches for the project
# Author: zhangzhihui@xfusion.com
# Create: 2023-03-27
set -ex
pkg=moby-20.10.24
cwd=$PWD
src=$cwd/$pkg
if [ ! -d patch ];then
tar -xzf patch.tar.gz
fi
cd $src
git init
git add .
git config user.name 'build'
git config user.email 'build@obs.com'
git commit -m "init build"
cd $cwd
series=$cwd/series.conf
while IPF=read -r line
do
if [[ "$line" =~ ^patch* ]];then
echo git apply $cwd/$line
cd $src && git apply $cwd/$line
fi
done < "$series"
mv $src/.git $src/git

View File

@ -31,14 +31,13 @@ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Cory Snider <csnider@mirantis.com>
---
daemon/mounts.go | 4 ++++
integration/daemon/daemon_test.go | 18 ++++++++++++++++++
2 files changed, 22 insertions(+)
1 files changed, 4 insertions(+)
diff --git a/daemon/mounts.go b/daemon/mounts.go
index 424e375037..3c79b0d447 100644
--- a/daemon/mounts.go
+++ b/daemon/mounts.go
@@ -17,6 +17,10 @@ func (daemon *Daemon) prepareMountPoints(container *container.Container) error {
@@ -15,6 +15,10 @@ func (daemon *Daemon) prepareMountPoints(container *container.Container) error {
if err := daemon.lazyInitializeVolume(container.ID, config); err != nil {
return err
}
@ -46,36 +45,10 @@ index 424e375037..3c79b0d447 100644
+ // FIXME(thaJeztah): should we check for config.Type here as well? (i.e., skip bind-mounts etc)
+ continue
+ }
if alive {
logrus.WithFields(logrus.Fields{
"container": container.ID,
diff --git a/integration/daemon/daemon_test.go b/integration/daemon/daemon_test.go
index 47dac3b762..416b19d2b5 100644
--- a/integration/daemon/daemon_test.go
+++ b/integration/daemon/daemon_test.go
@@ -102,4 +102,22 @@ func testLiveRestoreVolumeReferences(t *testing.T) {
err = c.VolumeRemove(ctx, v.Name, false)
assert.NilError(t, err)
})
+
+ // Make sure that we don't panic if the container has bind-mounts
+ // (which should not be "restored")
+ // Regression test for https://github.com/moby/moby/issues/45898
+ t.Run("container with bind-mounts", func(t *testing.T) {
+ m := mount.Mount{
+ Type: mount.TypeBind,
+ Source: os.TempDir(),
+ Target: "/foo",
+ }
+ cID := container.Run(ctx, t, c, container.WithMount(m), container.WithCmd("top"))
+ defer c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+
+ d.Restart(t, "--live-restore", "--iptables=false")
+
+ err := c.ContainerRemove(ctx, cID, types.ContainerRemoveOptions{Force: true})
+ assert.NilError(t, err)
+ })
}
return nil
}
--
--
2.32.0 (Apple Git-132)

Binary file not shown.

View File

@ -7,7 +7,7 @@
Name: moby
Version: 20.10.24
Release: 4
Release: 5
Summary: The open-source application container engine
License: ASL 2.0
URL: https://www.docker.com
@ -20,9 +20,8 @@ Source2: tini-0.19.0.tar.gz
Source3: docker.service
Source4: docker.socket
Source5: docker.sysconfig
Source6: apply-patches
Source7: series.conf
Source8: patch.tar.gz
Patch0000: awslogs-fix-non-blocking-log-drop-bug.patch
Patch0001: daemon-prepare-MountPoints-fix-panic-if-mount.patch
Requires: %{name}-engine = %{version}-%{release}
@ -92,15 +91,10 @@ Docker client binary and related utilities
%prep
%setup -q -n %{_source_client}
%setup -q -T -n %{_source_engine} -b 1
%patch0000 -p1
%patch0001 -p1
%setup -q -T -n %{_source_docker_init} -b 2
cd %{_builddir}
cp %{SOURCE6} .
cp %{SOURCE7} .
cp %{SOURCE8} .
sh ./apply-patches
%build
export GO111MODULE=off
# build docker daemon
@ -200,6 +194,9 @@ fi
%systemd_postun_with_restart docker.service
%changelog
* Mon Sep 18 2023 xulei<xulei@xfusion.com> - 20.10.24-5
- Optimize the apply patch method
* Thu Sep 14 2023 xulei<xulei@xfusion.com> - 20.10.24-4
- DESC: Fix missing runc dependencies
The declaration conflicts with the installation of docker-engine

View File

@ -1,2 +0,0 @@
patch/0001-awslogs-fix-non-blocking-log-drop-bug.patch
patch/0002-daemon-daemon.prepareMountPoints-fix-panic-if-mount-.patch