diff --git a/CI/.cloudbuild/build.yml b/CI/.cloudbuild/build.yml deleted file mode 100644 index 79724aa5..00000000 --- a/CI/.cloudbuild/build.yml +++ /dev/null @@ -1,82 +0,0 @@ - ---- -version: 2.0 - -# 构建环境 - - -# 构建参数定义, 构建脚本可从环境变量中读取使用这些参数 -params: - - name: upload_to_Cloudcmc - value: 'false' - - name: upload_to_Enterprisecmc - value: 'false' - - name: RELEASE_VER - value: 2.3.2 - - name: VER - value: 2.2.13.4 - - name: PLATFORM - value: X86 - - name: esdk_ci_branch - value: master - - name: dockerimg - value: 'szvecr02.his.huawei.com:80/ecr-build/esdk_suse_x86_12sp5:2.1.RC1' - - -env: - resource: - type: docker - image: ${dockerimg} - resource_class: 4U4G - pool: eks-build-x86-gz-kunpeng-ondocker-16u-02 - -steps: - PRE_BUILD: - - checkout - - codehub: - url: https://codehub-dg-y.huawei.com/esdk/esdk_public/esdk_ci.git - branch: ${esdk_ci_branch} - path: esdk_ci - BUILD: - - build_execute: - command: sh CI/build.sh ${RELEASE_VER} ${VER} ${PLATFORM};echo "buildVersion=${eSDK_version}.$(date "+%Y%m%d%H%M%S")" > buildInfo.properties - accelerate: false - check: true - POST_BUILD: - - get_build_metadata - - upload_cloud_artifact: - file_path: '*.zip*' - - version_set - - when: - condition: upload_to_Cloudcmc == 'true' - steps: - - get_build_metadata - - artget: - artifact_type: cmcbinary - action: push - dependency: CI/conf/cmc_dependency.xml - version_output_path: . - username: ${cmc_username} - password: ${cmc_password} - agent: . - cache: /home/ - add_source_code: true - params: {'version':'${Cloudversion}','dir':'eSDK_Huawei_Storage*.zip*','dist':'${dist}','offering':'eSDK Cloud Storage Plugins'} - - get_build_metadata - - when: - condition: upload_to_Enterprisecmc == 'true' - steps: - - get_build_metadata - - artget: - artifact_type: cmcbinary - action: push - dependency: CI/conf/cmc_dependency.xml - version_output_path: . - username: ${cmc_username} - password: ${cmc_password} - agent: . - cache: /home/ - add_source_code: true - params: {'version':'${Enterpriseversion}','dir':'eSDK_Huawei_Storage*.zip*','dist':'${dist}','offering':'eSDK Enterprise Storage Plugins'} - - get_build_metadata - diff --git a/CI/build.sh b/CI/build.sh deleted file mode 100644 index fdf8a013..00000000 --- a/CI/build.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Huawei Technologies Co., Ltd. 2020-2022. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -export GOPROXY=http://mirrors.tools.huawei.com/goproxy/ - -make -f Makefile RELEASE_VER=$1 VER=$2 PLATFORM=$3 - -if [ ${PLATFORM} == X86 ];then - wget http://10.29.160.97/busybox-x86.tar - docker load -i busybox-x86.tar > imageidfile - imageId=$(cat imageidfile|awk '{print $4}') - docker tag ${imageId} busybox:stable-glibc -elif [ ${PLATFORM} == ARM ]; then - wget http://10.29.160.97/busybox-arm.tar - docker load -i busybox-arm.tar > imageidfile - imageId=$(cat imageidfile|awk '{print $4}') - docker tag ${imageId} busybox:stable-glibc -fi - -package_name="eSDK_Huawei_Storage_${RELEASE_VER}_Kubernetes_CSI_Plugin_V${VER}_${PLATFORM}_64" -unzip -d k8s -q ${package_name}.zip -\cp -rf k8s/${package_name}/bin/huawei-csi . - -if [ ${PLATFORM} == X86 ];then - docker build --platform linux/amd64 -f Dockerfile -t huawei-csi:${VER} . -elif [ ${PLATFORM} == ARM ]; then - docker build --platform linux/arm64 -f Dockerfile -t huawei-csi:${VER} . -fi - -plat=$(echo ${PLATFORM}|tr 'A-Z' 'a-z') -docker save huawei-csi:${VER} -o huawei-csi-v${VER}-${plat}.tar - -mkdir k8s/${package_name}/image -mv huawei-csi-v${VER}-${plat}.tar k8s/${package_name}/image - -rm -rf ${package_name}.zip -cd k8s -zip -rq ../${package_name}.zip * -#签名 -cd .. -mkdir sign -mv ${package_name}.zip sign -sh esdk_ci/ci/build_product_signature.sh $(pwd)/sign -mkdir cms -mv sign/*.cms . -sh esdk_ci/ci/build_product_signature_hwp7s.sh $(pwd)/sign -mv sign/* . \ No newline at end of file diff --git a/CI/conf/cmc_dependency.xml b/CI/conf/cmc_dependency.xml deleted file mode 100644 index 3ab70b8f..00000000 --- a/CI/conf/cmc_dependency.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - BVersion - Generic - - ${offering} - ${version} - - N - - - ${dir} - ${dist} - - - - - - BVersion - Generic - - eSDK Enterprise Storage Plugins - eSDK Enterprise Storage Plugins 2.3.RC1.B040 - - - - pkg - - - - - - \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index a12cef9c..7328ad17 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM busybox:stable-glibc LABEL maintainers="The Huawei CSI Team" LABEL description="Kubernetes CSI Driver for Huawei Storage" -LABEL version="3.2.0" +LABEL version="3.2.2" COPY huawei-csi / diff --git a/Makefile b/Makefile index 2ba361c4..668c35d0 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -# usage: make -f Makefile VER=3.2.0 PLATFORM=X86 RELEASE_VER=2.5.RC2 +# usage: make -f Makefile VER=3.2.2 PLATFORM=X86 RELEASE_VER=2.5.RC3 -# (required) [3.2.0] +# (required) [3.2.2] VER=VER # (required) [X86 ARM] PLATFORM=PLATFORM diff --git a/README.md b/README.md index a02d083c..3bd26759 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Step 1. Download the package and **cd** into the package Step 2. Run following command to compile the Huawei CSI Driver // PLATFORM support [X86|ARM] - make -f Makefile VER=3.2.0 PLATFORM=X86 + make -f Makefile VER=3.2.2 PLATFORM=X86 Step 3. After the compilation is finished, a bin directory will be created in the current directory, the structure is as follows: diff --git a/build.sh b/build.sh index df226ef9..b4571a2b 100644 --- a/build.sh +++ b/build.sh @@ -15,9 +15,9 @@ # limitations under the License. # -# usage: sh build.sh 3.2.0 X86 +# usage: sh build.sh 3.2.2 X86 -# [3.2.0] +# [3.2.2] VER=$1 # [X86 ARM] PLATFORM=$2 diff --git a/connector/connector_utils.go b/connector/connector_utils.go index e20107ab..c9d1bf93 100644 --- a/connector/connector_utils.go +++ b/connector/connector_utils.go @@ -30,6 +30,7 @@ import ( "strings" "time" + "huawei-csi-driver/csi/app" "huawei-csi-driver/utils" "huawei-csi-driver/utils/log" ) @@ -166,7 +167,7 @@ var GetVirtualDevice = func(ctx context.Context, tgtLunGUID string) (string, int if err != nil { return "", 0, utils.Errorf(ctx, "check device: %s is a partition device failed. error: %v", device, err) } else if partitionDev { - log.AddContext(ctx).Infof("Device: %s is a partition device, skip", device) + log.AddContext(ctx).Infof("Device: %s is a partition device,skip", device) continue } @@ -440,7 +441,7 @@ func WatchDMDevice(ctx context.Context, lunWWN string, expectPathNumber int) (DM dm, err = findDMDeviceByWWN(ctx, lunWWN) if err == nil { - if len(dm.Devices) == expectPathNumber { + if !app.GetGlobalConfig().AllPathOnline || len(dm.Devices) == expectPathNumber { return dm, nil } log.AddContext(ctx).Warningf("Querying DM Disk Path Information. "+ diff --git a/connector/connector_utils_test.go b/connector/connector_utils_test.go index c7420fea..50afdc47 100644 --- a/connector/connector_utils_test.go +++ b/connector/connector_utils_test.go @@ -27,6 +27,7 @@ import ( "github.com/prashantv/gostub" "github.com/stretchr/testify/assert" + "huawei-csi-driver/csi/app" "huawei-csi-driver/utils" ) @@ -384,9 +385,9 @@ func TestGetVirtualDevice(t *testing.T) { {"NormalPhysicalSd*", args{context.TODO(), "7100e98b8e19b76d00e4069a00000003"}, outputs{[]string{"sdd"}, "", nil, nil}, "sdd", NotUseMultipath, false}, {"NormalPhysicalNVMe*", args{context.TODO(), "7100e98b8e19b76d00e4069a00000003"}, outputs{[]string{"nvme1n1"}, "", nil, nil}, "nvme1n1", NotUseMultipath, false}, {"ErrorMultiUltrapath*", args{context.TODO(), "7100e98b8e19b76d00e4069a00000003"}, outputs{[]string{"ultrapathh", "ultrapathi"}, "", nil, nil}, "", 0, true}, - {"ErrorPartitionUltrapath*", args{context.TODO(), "7100e98b8e19b76d00e4069a00000003"}, outputs{[]string{"ultrapathh", "ultrapathh2"}, "", nil, nil}, "", 0, true}, - {"ErrorPartitionDm-*", args{context.TODO(), "7100e98b8e19b76d00e4069a00000003"}, outputs{[]string{"dm-2"}, "lrwxrwxrwx. 1 root root 7 Mar 14 10:26 mpatha2 -> ../dm-2", nil, nil}, "", 0, true}, - {"ErrorPartitionNvme*", args{context.TODO(), "7100e98b8e19b76d00e4069a00000003"}, outputs{[]string{"nvme1n1", "nvme1n1p1"}, "", nil, nil}, "", 0, true}, + {"ErrorPartitionUltrapath*", args{context.TODO(), "7100e98b8e19b76d00e4069a00000003"}, outputs{[]string{"ultrapathh", "ultrapathh2"}, "", nil, nil}, "ultrapathh", UseUltraPathNVMe, false}, + {"ErrorPartitionDm-*", args{context.TODO(), "7100e98b8e19b76d00e4069a00000003"}, outputs{[]string{"dm-2"}, "lrwxrwxrwx. 1 root root 7 Mar 14 10:26 mpatha2 -> ../dm-2", nil, nil}, "", 0, false}, + {"ErrorPartitionNvme*", args{context.TODO(), "7100e98b8e19b76d00e4069a00000003"}, outputs{[]string{"nvme1n1", "nvme1n1p1"}, "", nil, nil}, "nvme1n1", 0, false}, } stub := GetDevicesByGUID @@ -462,7 +463,7 @@ func TestWatchDMDevice(t *testing.T) { for _, c := range cases { var startTime = time.Now() - + app.Builder().WithAllPathOnline(true).Build() stubs.Stub(&utils.ExecShellCmd, func(ctx context.Context, format string, args ...interface{}) (string, error) { if time.Now().Sub(startTime) > c.aggregatedTime { return fmt.Sprintf("name sysfs uuid \nmpathja %s %s", c.lunName, c.lunWWN), nil diff --git a/connector/iscsi/iscsi_helper.go b/connector/iscsi/iscsi_helper.go index 639f4088..94fd49ef 100644 --- a/connector/iscsi/iscsi_helper.go +++ b/connector/iscsi/iscsi_helper.go @@ -31,6 +31,7 @@ import ( "huawei-csi-driver/connector" connutils "huawei-csi-driver/connector/utils" + "huawei-csi-driver/csi/app" "huawei-csi-driver/utils" "huawei-csi-driver/utils/log" ) @@ -805,9 +806,8 @@ func disconnectSessions(ctx context.Context, devConnectorInfos []singleConnector for _, connectorInfo := range devConnectorInfos { tgtPortal := connectorInfo.tgtPortal tgtIQN := connectorInfo.tgtIQN - cmd := fmt.Sprintf("ls /dev/disk/by-path/ |grep -w %s |grep -w %s |wc -l |awk '{if($1>0) print 1; "+ - "else print 0}'", tgtPortal, utils.MaskSensitiveInfo(tgtIQN)) - output, err := utils.ExecShellCmd(ctx, cmd) + cmd := buildCheckSessionCmd(tgtPortal, tgtIQN) + output, err := utils.ExecShellCmdFilterLog(ctx, cmd) if err != nil { log.AddContext(ctx).Infof("Disconnect iSCSI target %s failed, err: %v", tgtPortal, err) return err @@ -820,6 +820,22 @@ func disconnectSessions(ctx context.Context, devConnectorInfos []singleConnector return nil } +// buildCheckSessionCmd build check iscsi session cmd +func buildCheckSessionCmd(tgtPortal, tgtIQN string) string { + // If using UltraPath , exec 'upadmin show path' . + // the terminal echo is as follows: + // $ upadmin show path + // Path ID Initiator Port Array Name Controller Target Port Path State Check State Port Type Port ID + // 1 127.0.0.1::2 101_112 0A iqn.xxx:127.0.0.1 Normal -- iSCSI CTE0.A.x + countCmd := "|wc -l |awk '{if($1>0) print 1; else print 0}'" + if app.GetGlobalConfig().VolumeUseMultiPath && app.GetGlobalConfig().ScsiMultiPathType == connector.HWUltraPath { + return fmt.Sprintf("upadmin show path |grep -w %s %s", tgtIQN, countCmd) + } + + return fmt.Sprintf("ls /dev/disk/by-path/ |grep -w %s |grep -w %s %s", + tgtPortal, tgtIQN, countCmd) +} + func tryDisConnectVolume(ctx context.Context, tgtLunWWN string) error { return connector.DisConnectVolume(ctx, tgtLunWWN, tryToDisConnectVolume) } diff --git a/connector/nfs/nfs_helper.go b/connector/nfs/nfs_helper.go index f7bffd1c..56d565ed 100644 --- a/connector/nfs/nfs_helper.go +++ b/connector/nfs/nfs_helper.go @@ -30,6 +30,7 @@ import ( "time" "github.com/container-storage-interface/spec/lib/go/csi" + "huawei-csi-driver/connector" "huawei-csi-driver/utils" "huawei-csi-driver/utils/log" @@ -240,7 +241,8 @@ func mountUnix(ctx context.Context, sourcePath, targetPath string, flags mountPa } // if the checkSourcePath is false, check the filesystem by comparing the sourcePath and mountPath - if value == sourcePath || path.Base(path.Dir(targetPath)) == path.Base(path.Dir(sourcePath)) { + if value == sourcePath || path.Base(path.Dir(targetPath)) == path.Base(path.Dir(sourcePath)) || + containSourceDevice(ctx, sourcePath, value) { log.AddContext(ctx).Infof("Mount %s to %s is already exist", sourcePath, targetPath) return nil } @@ -268,6 +270,26 @@ func mountUnix(ctx context.Context, sourcePath, targetPath string, flags mountPa return nil } +// containSourceDevice used to check target path referenced source device is equal sourceDev +func containSourceDevice(ctx context.Context, targetPath, sourceDev string) bool { + for _, value := range findSourceDevice(ctx, targetPath) { + if value == sourceDev { + return true + } + } + return false +} + +// findSourceDevice use findmnt command to find mountPath referenced source device +func findSourceDevice(ctx context.Context, targetPath string) []string { + output, err := utils.ExecShellCmd(ctx, "findmnt -o source --noheadings --target %s", targetPath) + if err != nil { + return []string{} + } + + return strings.Split(output, "\n") +} + func getFSType(ctx context.Context, sourcePath string) (string, error) { // the errorCode 2 means an unFormatted filesystem and the unavailable filesystem. So ensure the device is // available before calling command blkid diff --git a/connector/utils/lock/lock.go b/connector/utils/lock/lock.go index 8b1c73d5..35e16424 100644 --- a/connector/utils/lock/lock.go +++ b/connector/utils/lock/lock.go @@ -103,8 +103,7 @@ func SyncLock(ctx context.Context, lockName, operationType string) error { return err } - subCtx, cancel := context.WithTimeout(ctx, GetLockTimeoutSec*time.Second) - err = waitGetSemaphore(subCtx, cancel, operationType) + err = waitGetSemaphore(ctx, operationType) if err != nil { newErr := deleteLockFile(ctx, lockDir, lockName) if newErr != nil { diff --git a/connector/utils/lock/lock_utils.go b/connector/utils/lock/lock_utils.go index 9c071735..959434d1 100644 --- a/connector/utils/lock/lock_utils.go +++ b/connector/utils/lock/lock_utils.go @@ -19,6 +19,7 @@ package lock import ( "context" + "errors" "fmt" "io/ioutil" "os" @@ -156,17 +157,15 @@ func waitGetLock(ctx context.Context, lockDir, lockName string) error { return nil } -func acquireSemaphore(ctx context.Context, operationType string) bool { +func acquireSemaphore(ctx context.Context, operationType string) chan int { semaphore, exist := semaphoreMap[operationType] if !exist { log.AddContext(ctx).Errorf("Acquire semaphore type: %s not exist in %v.", operationType, semaphoreMap) - return false + return nil } log.AddContext(ctx).Infof("Before acquire, available permits is %d", semaphore.AvailablePermits()) - semaphore.Acquire() - log.AddContext(ctx).Infof("After acquire, available permits is %d", semaphore.AvailablePermits()) - return true + return semaphore.GetChannel() } func releaseSemaphore(ctx context.Context, operationType string) { @@ -179,28 +178,20 @@ func releaseSemaphore(ctx context.Context, operationType string) { log.AddContext(ctx).Infof("After release, available permits is %d", semaphore.AvailablePermits()) } -func waitGetSemaphore(ctx context.Context, cancel context.CancelFunc, operationType string) error { - go func(ctx context.Context, cancel context.CancelFunc, operationType string) { - defer cancel() - - acquireSemaphore(ctx, operationType) - select { - case <-ctx.Done(): - log.AddContext(ctx).Warningf("acquire [%s] semaphore timeout, release this semaphore.", operationType) - releaseSemaphore(ctx, operationType) - default: - log.AddContext(ctx).Debugf("acquire [%s] semaphore finish.", operationType) - } - }(ctx, cancel, operationType) - +func waitGetSemaphore(ctx context.Context, operationType string) error { + c := acquireSemaphore(ctx, operationType) + if c == nil { + msg := fmt.Sprintf("acquire semaphore failed, wrong type: [%s]", operationType) + log.AddContext(ctx).Errorln(msg) + return errors.New(msg) + } select { - case <-ctx.Done(): - if strings.Contains(ctx.Err().Error(), "context deadline exceeded") { - // If the exit is due to timeout, "context deadline exceeded" is contains in ctx.Err().Error() - return utils.Errorf(ctx, "%s, operation type: [%s] .", GetSemaphoreTimeout, operationType) - } - - log.AddContext(ctx).Debugf("get [%s] semaphore finish.", operationType) + case c <- 0: + log.AddContext(ctx).Infof("acquire [%s] semaphore finish. Used: [%d]", operationType, len(c)) return nil + case <-time.After(GetLockTimeoutSec * time.Second): + msg := fmt.Sprintf("acquire [%s] semaphore timeout", operationType) + log.AddContext(ctx).Errorln(msg) + return errors.New(msg) } } diff --git a/csi/app/config.go b/csi/app/config.go new file mode 100644 index 00000000..7a3e2fcb --- /dev/null +++ b/csi/app/config.go @@ -0,0 +1,32 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package app + +var globalCfg *Config + +// Config contains the configurations from env +type Config struct { + VolumeUseMultiPath bool + ScsiMultiPathType string + NvmeMultiPathType string + AllPathOnline bool +} + +// GetGlobalConfig used to get global configuration +func GetGlobalConfig() *Config { + return globalCfg +} diff --git a/csi/app/options.go b/csi/app/options.go new file mode 100644 index 00000000..98225595 --- /dev/null +++ b/csi/app/options.go @@ -0,0 +1,57 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2023-2023. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package app + +import "sync" + +var once sync.Once + +func Builder() *Config { + once.Do(func() { + globalCfg = &Config{} + }) + return globalCfg +} + +// WithVolumeUseMultipath Used to set whether to use multipath +func (c *Config) WithVolumeUseMultipath(volumeUseMultipath bool) *Config { + c.VolumeUseMultiPath = volumeUseMultipath + return c +} + +// WithScsiMultipathType Used to set the multipath type used by the scsi protocol +func (c *Config) WithScsiMultipathType(scsiMultipathType string) *Config { + c.ScsiMultiPathType = scsiMultipathType + return c +} + +// WithNvmeMultipathType Used to set the multipath type used by the nvme protocol +func (c *Config) WithNvmeMultipathType(nvmeMultipathType string) *Config { + c.NvmeMultiPathType = nvmeMultipathType + return c +} + +// WithAllPathOnline Used to check the number of paths for DM-multipath aggregation +func (c *Config) WithAllPathOnline(allPathOnline bool) *Config { + c.AllPathOnline = allPathOnline + return c +} + +//Build Used to set global configuration +func (c *Config) Build() { + globalCfg = c +} diff --git a/csi/main.go b/csi/main.go index 66565beb..82b30c53 100644 --- a/csi/main.go +++ b/csi/main.go @@ -36,6 +36,7 @@ import ( "huawei-csi-driver/connector" connutils "huawei-csi-driver/connector/utils" "huawei-csi-driver/connector/utils/lock" + "huawei-csi-driver/csi/app" "huawei-csi-driver/csi/backend" "huawei-csi-driver/csi/driver" "huawei-csi-driver/utils" @@ -53,7 +54,7 @@ const ( nodeLogFile = "huawei-csi-node" csiLogFile = "huawei-csi" - csiVersion = "3.2.1" + csiVersion = "3.2.2" defaultDriverName = "csi.huawei.com" endpointDirPerm = 0755 @@ -104,6 +105,9 @@ var ( 3, "The timeout for waiting for multipath aggregation "+ "when DM-multipath is used on the host") + allPathOnline = flag.Bool("all-path-online", + false, + "Whether to check the number of online paths for DM-multipath aggregation, default false") config CSIConfig secret CSISecret @@ -321,6 +325,12 @@ func checkMultiPathType() { notify.Stop("The nvme-multipath-type=%v configuration is incorrect.", nvmeMultiPathType) } } + // set connect config to global config. + app.Builder().WithVolumeUseMultipath(*volumeUseMultiPath). + WithScsiMultipathType(*scsiMultiPathType). + WithNvmeMultipathType(*nvmeMultiPathType). + WithAllPathOnline(*allPathOnline). + Build() } func checkMultiPathService() { @@ -358,12 +368,10 @@ func triggerGarbageCollector(k8sUtils k8sutils.Interface) { // Trigger stale device clean up and exit after cleanup completion or during timeout log.Debugf("Enter func triggerGarbageCollector") cleanupReport := make(chan error, 1) - defer func() { - close(cleanupReport) - }() go func(ch chan error) { res := nodeStaleDeviceCleanup(context.Background(), k8sUtils, *kubeletRootDir, *driverName, *nodeName) ch <- res + close(ch) }(cleanupReport) timeoutInterval := time.Second * time.Duration(*deviceCleanupTimeout) select { diff --git a/docs/eSDK Huawei Storage Kubernetes CSI Plugins V3.2.2 User Guide 01.pdf b/docs/eSDK Huawei Storage Kubernetes CSI Plugins V3.2.2 User Guide 01.pdf new file mode 100644 index 00000000..581e89be Binary files /dev/null and b/docs/eSDK Huawei Storage Kubernetes CSI Plugins V3.2.2 User Guide 01.pdf differ diff --git "a/docs/eSDK Huawei Storage Kubernetes CSI Plugins V3.2.2 \347\224\250\346\210\267\346\214\207\345\215\227 01.pdf" "b/docs/eSDK Huawei Storage Kubernetes CSI Plugins V3.2.2 \347\224\250\346\210\267\346\214\207\345\215\227 01.pdf" new file mode 100644 index 00000000..8d4a1525 Binary files /dev/null and "b/docs/eSDK Huawei Storage Kubernetes CSI Plugins V3.2.2 \347\224\250\346\210\267\346\214\207\345\215\227 01.pdf" differ diff --git a/helm/esdk/Chart.yaml b/helm/esdk/Chart.yaml index 7a92f20b..eda662d5 100644 --- a/helm/esdk/Chart.yaml +++ b/helm/esdk/Chart.yaml @@ -25,7 +25,7 @@ kubeVersion: ">= 1.13.0" # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. # It is strongly recommended not to modify this parameter -appVersion: "3.2.0" +appVersion: "3.2.2" home: https://github.com/Huawei/eSDK_K8S_Plugin sources: diff --git a/helm/esdk/templates/huawei-csi-node.yaml b/helm/esdk/templates/huawei-csi-node.yaml index 7bd19f9b..fe730720 100644 --- a/helm/esdk/templates/huawei-csi-node.yaml +++ b/helm/esdk/templates/huawei-csi-node.yaml @@ -113,6 +113,7 @@ spec: - "--nvme-multipath-type={{ .Values.csi_driver.nvmeMultipathType }}" {{ end }} - "--scan-volume-timeout={{ .Values.csi_driver.scanVolumeTimeout }}" + - "--all-path-online={{ default false .Values.csi_driver.allPathOnline }}" - --loggingModule={{ .Values.csi_driver.nodeLogging.module }} - --logLevel={{ .Values.csi_driver.nodeLogging.level }} {{ if eq .Values.csi_driver.nodeLogging.module "file" }} diff --git a/helm/esdk/values.yaml b/helm/esdk/values.yaml index bd8b94cd..7f46d6bb 100644 --- a/helm/esdk/values.yaml +++ b/helm/esdk/values.yaml @@ -18,7 +18,7 @@ snapshot: images: # The image name and tag for the Huawei CSI Service container # Replace the appropriate tag name - huaweiCSIService: huawei-csi:3.2.0 + huaweiCSIService: huawei-csi:3.2.2 # The image name and tag for the sidecars. These must match the appropriate Kubernetes version. sidecar: @@ -57,6 +57,12 @@ csi_driver: nvmeMultipathType: HW-UltraPath-NVMe # Timeout interval for waiting for multipath aggregation when DM-multipath is used on the host. support 1~600 scanVolumeTimeout: 3 + # check the number of paths for multipath aggregation + # Allowed values: + # true: the number of paths aggregated by DM-multipath is equal to the number of online paths + # false: the number of paths aggregated by DM-multipath is not checked. + # Default value: false + allPathOnline: false # Interval for updating backend capabilities. support 60~600 backendUpdateInterval: 60 # Huawei-csi-controller log configuration diff --git a/utils/client_semaphore.go b/utils/client_semaphore.go index c8fef300..8100adc8 100644 --- a/utils/client_semaphore.go +++ b/utils/client_semaphore.go @@ -36,6 +36,10 @@ func (s *Semaphore) Release() { <-s.channel } +func (s *Semaphore) GetChannel() chan int { + return s.channel +} + func (s *Semaphore) AvailablePermits() int { return s.permits - len(s.channel) } diff --git a/utils/utils.go b/utils/utils.go index ae5a50d2..71b83494 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -113,7 +113,7 @@ func MaskSensitiveInfo(info interface{}) string { for _, value := range maskObject { if strings.Contains(strings.ToLower(message), strings.ToLower(value)) { - rePattern := fmt.Sprintf(`(?is)%s.*\s-p`, value) + rePattern := fmt.Sprintf(`(?is)%s.*?\s`, value) re := regexp.MustCompile(rePattern) message = re.ReplaceAllString(message, substitute) } diff --git a/utils/utils_test.go b/utils/utils_test.go index f819baa1..25b1e73e 100644 --- a/utils/utils_test.go +++ b/utils/utils_test.go @@ -79,7 +79,7 @@ func TestMaskSensitiveInfo(t *testing.T) { { "stringMaskInfo", "iscsiadm -m node -T iqn.2003-01.io.k8s:e2e.volume -p 192.168.0.2 --interface default --op new", - "iscsiadm -m node -T *** 192.168.0.2 --interface default --op new", + "iscsiadm -m node -T ***-p 192.168.0.2 --interface default --op new", }, } for _, c := range testCases {