diff --git a/0003-retry-10-times-to-avoid-isulad-unavailable.patch b/0003-retry-10-times-to-avoid-isulad-unavailable.patch new file mode 100644 index 0000000000000000000000000000000000000000..4f263b1b05d00577c77e1519b019d18a1a1e7287 --- /dev/null +++ b/0003-retry-10-times-to-avoid-isulad-unavailable.patch @@ -0,0 +1,60 @@ +From 77e01d06b90d167f013417455a30eebe22ca3674 Mon Sep 17 00:00:00 2001 +From: yangjiaqi +Date: Mon, 15 Aug 2022 20:30:14 +0800 +Subject: [PATCH] retry 10 times to avoid isulad unavailable + +--- + remountcmd.go | 23 ++++++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +diff --git a/remountcmd.go b/remountcmd.go +index 7cf42c6..b3cac19 100644 +--- a/remountcmd.go ++++ b/remountcmd.go +@@ -180,7 +180,7 @@ func waitForLxcfs() error { + + func remountAll(initMountns, initUserns string) error { + lxcfs_log.Info("begin remount All runing container...") +- out, err := execCommond("isula", []string{"ps", "--format", "{{.ID}} {{.Pid}}"}) ++ out, err := getContainerIDAndPid() + if err != nil { + return err + } +@@ -213,6 +213,24 @@ func remountAll(initMountns, initUserns string) error { + return nil + } + ++func getContainerIDAndPid() ([]string, error) { ++ var ( ++ out []string ++ err error ++ ) ++ for i := 0; i < 10; i++ { ++ out, err = execCommond("isula", []string{"ps", "--format", "{{.ID}} {{.Pid}}"}) ++ if err == nil { ++ break ++ } ++ time.Sleep(1 * time.Second) ++ } ++ if err != nil { ++ return nil, err ++ } ++ return out, nil ++} ++ + func remountToContainer(initMountns, initUserns, containerid string, pid string, isAll bool) error { + if isAll == false { + var err error +@@ -260,8 +278,7 @@ func isContainerExsit(containerid string) (string, error) { + if containerid == "" { + return "", fmt.Errorf("Containerid mustn't be empty") + } +- +- out, err := execCommond("isula", []string{"ps", "--format", "{{.ID}} {{.Pid}}"}) ++ out, err := getContainerIDAndPid() + if err != nil { + onfail(err) + } +-- +2.30.0 + diff --git a/lxcfs-tools.spec b/lxcfs-tools.spec index 71c49b82fda3cc307e7ca9b5741a051acff45981..3f0b854b7497750f5f233f2e08855fd29806faed 100644 --- a/lxcfs-tools.spec +++ b/lxcfs-tools.spec @@ -1,7 +1,7 @@ #Basic Information Name: lxcfs-tools Version: 0.3 -Release: 25 +Release: 26 Summary: toolkit for lxcfs to remount a running isulad License: Mulan PSL v2 URL: https://gitee.com/openeuler/lxcfs-tools @@ -10,6 +10,7 @@ BuildRoot: %{_tmppath}/%{name}-root Patch1: 0001-lxcfs-tools-build-security-option.patch Patch2: 0002-enable-external-linkmode-for-cgo-build.patch +Patch3: 0003-retry-10-times-to-avoid-isulad-unavailable.patch #Dependency BuildRequires: golang > 1.7 @@ -91,6 +92,9 @@ rm -rfv %{buildroot} %changelog +* Wed Aug 17 2022 vegbir - 0.3-26 +- retry 10 times to avoid isulad unavailable + * Thu Sep 02 2021 zhangsong234 - 0.3-25 - enable external linkmode for cgo build