Skip to content

Commit

Permalink
Merge pull request #100 from YeYoot/V3.2
Browse files Browse the repository at this point in the history
V3.2.0 init
  • Loading branch information
YeYoot authored Dec 30, 2022
2 parents 4454695 + e73006d commit 3f8bf8c
Show file tree
Hide file tree
Showing 42 changed files with 1,327 additions and 534 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

[Releases](https://github.com/Huawei/eSDK_K8S_Plugin/releases)

## Changes since v3.1.0

**Enhancements**

- The PV prefix can be customized.
- The description of the filesystem can be customized.
- The reserved snapshot space can be modified.
- The Pacific namespace can be expanded.
- Support k8s 1.13 - 1.25
- Support OpenShift 4.11
- Support Ubuntu 22.04, SUSE 15 SP3
- Support EulerOS V2R10

## Changes since v3.0.0

**Enhancements**
Expand Down
12 changes: 9 additions & 3 deletions CI/.cloudbuild/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ params:
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'

Expand All @@ -31,6 +33,10 @@ env:
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
Expand All @@ -39,7 +45,7 @@ steps:
POST_BUILD:
- get_build_metadata
- upload_cloud_artifact:
file_path: '*.zip'
file_path: '*.zip*'
- version_set
- when:
condition: upload_to_Cloudcmc == 'true'
Expand All @@ -55,7 +61,7 @@ steps:
agent: .
cache: /home/
add_source_code: true
params: {'version':'${Cloudversion}','dir':'eSDK_Huawei_Storage*.zip','dist':'${dist}','offering':'eSDK Cloud Storage Plugins'}
params: {'version':'${Cloudversion}','dir':'eSDK_Huawei_Storage*.zip*','dist':'${dist}','offering':'eSDK Cloud Storage Plugins'}
- get_build_metadata
- when:
condition: upload_to_Enterprisecmc == 'true'
Expand All @@ -71,6 +77,6 @@ steps:
agent: .
cache: /home/
add_source_code: true
params: {'version':'${Enterpriseversion}','dir':'eSDK_Huawei_Storage*.zip','dist':'${dist}','offering':'eSDK Enterprise Storage Plugins'}
params: {'version':'${Enterpriseversion}','dir':'eSDK_Huawei_Storage*.zip*','dist':'${dist}','offering':'eSDK Enterprise Storage Plugins'}
- get_build_metadata

11 changes: 10 additions & 1 deletion CI/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,13 @@ mv huawei-csi-v${VER}-${plat}.tar k8s/${package_name}/image

rm -rf ${package_name}.zip
cd k8s
zip -rq ../${package_name}.zip *
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/* .
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM busybox:stable-glibc

LABEL maintainers="The Huawei CSI Team"
LABEL description="Huawei Storage CSI Driver"
LABEL version="3.1.0"
LABEL description="Kubernetes CSI Driver for Huawei Storage"
LABEL version="3.2.0"

COPY huawei-csi /

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# usage: make -f Makefile VER=3.1.0 PLATFORM=X86 RELEASE_VER=2.5.RC2
# usage: make -f Makefile VER=3.2.0 PLATFORM=X86 RELEASE_VER=2.5.RC2

# (required) [3.1.0]
# (required) [3.2.0]
VER=VER
# (required) [X86 ARM]
PLATFORM=PLATFORM
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Huawei Storage CSI Driver for Kubernetes
# Kubernetes CSI Driver for Huawei Storage

![GitHub](https://img.shields.io/github/license/Huawei/eSDK_K8S_Plugin)
[![Go Report Card](https://goreportcard.com/badge/github.com/huawei/esdk_k8s_plugin)](https://goreportcard.com/report/github.com/huawei/esdk_k8s_plugin)
Expand Down Expand Up @@ -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.1.0 PLATFORM=X86
make -f Makefile VER=3.2.0 PLATFORM=X86

Step 3. After the compilation is finished, a bin directory will be created in the current
directory, the structure is as follows:
Expand Down
34 changes: 32 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
# 3.2.0

## Supported Huawei storage products

| Storage Product | Version |
| ------------------- |------------------------------------------|
| OceanStor Dorado V6 | 6.0.0, 6.0.1, 6.1.0, 6.1.2, 6.1.3, 6.1.5 |
| OceanStor Dorado V3 | V300R002 |
| OceanStor V6 | 6.1.3, 6.1.5 |
| OceanStor V5/F V5 | V500R007, V500R007 Kunpeng |
| OceanStor V3/F V3 | V300R006 |
| FusionStorage | V100R006C30 |
| FusionStorage Block | 8.0.0, 8.0.1 |
| OceanStor Pacific | 8.1.0, 8.1.1, 8.1.2, 8.1.3 |

## Supported container platforms and operating systems (OSs)

| Container platform/OS | Version |
| --------------------- | ------------------------------------------------------------ |
| Kubernetes | 1.13 - 1.25 |
| Red Hat OpenShift | 4.6 EUS, 4.7, 4.8, 4.9, 4.10, 4.11 |
| Tanzu Kubernetes | TKGI 1.14.1 + Kubernetes 1.23.7 |
| CentOS | 7.6 x86_64, 7.7 x86_64, 7.9 x86_64, 8.2 x86_64 |
| SUSE | 15 SP2 x86_64, 15 SP3 x86_64, |
| Red Hat CoreOS | 4.6 x86_64, 4.7 x86_64, 4.8 x86_64, 4.9 x86_64, 4.10 x86_64, 4.11 x86_64 |
| Ubuntu | 18.04 x86_64, 20.04 x86_64, 22.04 x86_64 |
| Kylin V10 | SP1 Arm/x86_64, SP2 Arm/x86_64 |
| Debian | 11 x86_64 |
| EulerOS | V2R10 Arm/x86_64 |

# 3.1.0

## Supported Huawei storage products

| Storage Product | Version |
| ------------------- | ---------------------------------------- |
| ------------------- |------------------------------------------|
| OceanStor Dorado V6 | 6.0.0, 6.0.1, 6.1.0, 6.1.2, 6.1.3, 6.1.5 |
| OceanStor Dorado V3 | V300R002 |
| OceanStor V6 | 6.1.3, 6.1.5 |
Expand All @@ -30,7 +60,7 @@
## Supported Huawei storage products

| Storage Product | Version |
| ------------------- | --------------------------------- |
| ------------------- |-----------------------------------|
| OceanStor Dorado V6 | 6.0.0, 6.0.1, 6.1.0, 6.1.2, 6.1.3 |
| OceanStor Dorado V3 | V300R002 |
| OceanStor V6 | 6.1.3 |
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# limitations under the License.
#

# usage: sh build.sh 3.1.0 X86
# usage: sh build.sh 3.2.0 X86

# [3.1.0]
# [3.2.0]
VER=$1
# [X86 ARM]
PLATFORM=$2
Expand Down
14 changes: 0 additions & 14 deletions cli/command/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package command
import (
"fmt"
"os"
"os/exec"
"time"

logging "github.com/sirupsen/logrus"
Expand All @@ -34,7 +33,6 @@ const (

HUAWEICSIConfigMap = "huawei-csi-configmap"
HUAWEICSISecret = "huawei-csi-secret"
HUAWEINamespace = "kube-system"
)

var (
Expand Down Expand Up @@ -109,15 +107,3 @@ func processInstallationArguments() {
minOptionalCSIVersion.ShortString())
}
}

func generateKeyText() (string, error) {
cmd := "head -c32 /dev/urandom | base64"
shCmd := exec.Command("/bin/sh", "-c", cmd)
output, err := shCmd.CombinedOutput()
if err != nil {
fmt.Printf("Generate random string error: %v", err)
return "", err
}
output = output[:32]
return string(output), nil
}
6 changes: 1 addition & 5 deletions cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,5 @@
package config

const (
DefaultNameSpace = "huawei-csi"
OrchestratorName = "Huawei"
OrchestratorVersion = "3.1.0"
MinKubernetesCSIVersion = "v1.21.0"
MaxKubernetesCSIVersion = "v1.24.x"
DefaultNameSpace = "huawei-csi"
)
13 changes: 9 additions & 4 deletions connector/connector_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,12 +524,17 @@ func findMultiPathMaps(foundDevices []string) (map[string][]string, string) {
}

func getSCSIWwnByScsiID(ctx context.Context, hostDevice string) (string, error) {
cmd := fmt.Sprintf("/lib/udev/scsi_id --page 0x83 --whitelisted %s", hostDevice)
output, err := utils.ExecShellCmd(ctx, cmd)
priorityCmd := fmt.Sprintf("/usr/lib/udev/scsi_id --page 0x83 --whitelisted %s", hostDevice)
output, err := utils.ExecShellCmd(ctx, priorityCmd)
if err != nil {
return "", utils.Errorf(ctx, "Failed to get scsi id of device %s, err is %v", hostDevice, err)
if strings.Contains(strings.ToLower(output), "no such file or directory") {
alternateCmd := fmt.Sprintf("/lib/udev/scsi_id --page 0x83 --whitelisted %s", hostDevice)
output, err = utils.ExecShellCmd(ctx, alternateCmd)
}
if err != nil {
return "", utils.Errorf(ctx, "Failed to get scsi id of device %s, err is %v", hostDevice, err)
}
}

return strings.TrimSpace(output), nil
}

Expand Down
9 changes: 4 additions & 5 deletions connector/utils/lock/lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ var (
curDriverName string
lockMutex sync.Mutex
semaphoreMap map[string]*utils.Semaphore
lockDir = fmt.Sprintf("%s/lock/", lockDirPrefix)
)

const (
connectVolume = "connect"
disConnectVolume = "disConnect"
extendVolume = "extend"
lockNamePrefix = "hw-pvc-lock-"
lockDirPrefix = "/var/lib/kubelet/plugins/"
lockDirPrefix = "/csi"

filePermission = 0644
dirPermission = 0755
Expand All @@ -73,8 +74,7 @@ func InitLock(driverName string) error {
return err
}

lockPath := fmt.Sprintf("%s%s/lock/", lockDirPrefix, driverName)
err = checkLockPath(lockPath)
err = checkLockPath(lockDir)
if err != nil {
return err
}
Expand All @@ -92,7 +92,7 @@ func InitLock(driverName string) error {
// SyncLock provide lock for device connect, disconnect and expand
func SyncLock(ctx context.Context, lockName, operationType string) error {
startTime := time.Now()
lockDir := fmt.Sprintf("%s%s/lock/", lockDirPrefix, curDriverName)

err := createLockDir(filepath.Dir(lockDir))
if err != nil {
return fmt.Errorf("create dir failed, reason: %s", err)
Expand Down Expand Up @@ -123,7 +123,6 @@ func SyncUnlock(ctx context.Context, lockName, operationType string) error {
startTime := time.Now()
releaseSemaphore(ctx, operationType)

lockDir := fmt.Sprintf("%s%s/lock/", lockDirPrefix, curDriverName)
err := deleteLockFile(ctx, lockDir, lockName)
if err != nil {
return err
Expand Down
14 changes: 3 additions & 11 deletions csi/backend/plugin/fusionstorage-nas.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"context"
"errors"
"fmt"
"net"

"huawei-csi-driver/storage/fusionstorage/volume"
"huawei-csi-driver/utils"
Expand All @@ -47,26 +46,18 @@ func (p *FusionStorageNasPlugin) Init(config, parameters map[string]interface{},
}

p.protocol = protocol

var portal string
if protocol == "nfs" {
portals, exist := parameters["portals"].([]interface{})
if !exist || len(portals) != 1 {
return errors.New("portals must be provided for fusionstorage-nas nfs backend and just support one portal")
}

portal = portals[0].(string)
ip := net.ParseIP(portal)
if ip == nil {
return fmt.Errorf("portal %s is invalid", portal)
}
p.portal = portals[0].(string)
}

err := p.init(config, keepLogin)
if err != nil {
return err
}
p.portal = portal
return nil
}

Expand Down Expand Up @@ -164,7 +155,8 @@ func (p *FusionStorageNasPlugin) DeleteSnapshot(ctx context.Context,
func (p *FusionStorageNasPlugin) ExpandVolume(ctx context.Context,
name string,
size int64) (bool, error) {
return false, fmt.Errorf("unimplemented")
nas := volume.NewNAS(p.cli)
return false, nas.Expand(ctx, name, size)
}

func (p *FusionStorageNasPlugin) UpdatePoolCapabilities(poolNames []string) (map[string]interface{}, error) {
Expand Down
5 changes: 3 additions & 2 deletions csi/backend/plugin/fusionstorage-san.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ func (p *FusionStorageSanPlugin) Init(config, parameters map[string]interface{},
func (p *FusionStorageSanPlugin) getParams(name string,
parameters map[string]interface{}) (map[string]interface{}, error) {
params := map[string]interface{}{
"name": name,
"capacity": utils.RoundUpSize(parameters["size"].(int64), CAPACITY_UNIT),
"name": name,
"description": parameters["description"].(string),
"capacity": utils.RoundUpSize(parameters["size"].(int64), CAPACITY_UNIT),
}

paramKeys := []string{
Expand Down
5 changes: 3 additions & 2 deletions csi/backend/plugin/fusionstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ func (p *FusionStoragePlugin) init(config map[string]interface{}, keepLogin bool
func (p *FusionStoragePlugin) getParams(name string,
parameters map[string]interface{}) (map[string]interface{}, error) {
params := map[string]interface{}{
"name": name,
"capacity": utils.RoundUpSize(parameters["size"].(int64), CAPACITY_UNIT),
"name": name,
"description": parameters["description"].(string),
"capacity": utils.RoundUpSize(parameters["size"].(int64), CAPACITY_UNIT),
}

paramKeys := []string{
Expand Down
8 changes: 4 additions & 4 deletions csi/backend/plugin/oceanstor-san.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func (p *OceanstorSanPlugin) DetachVolume(ctx context.Context, name string, para
metroCli = p.metroRemotePlugin.cli
}

lunName := utils.GetLunName(name)
lunName := p.cli.MakeLunName(name)
lun, err := p.getLunInfo(ctx, localCli, metroCli, lunName)
if err != nil {
log.AddContext(ctx).Errorf("Get lun %s error: %v", lunName, err)
Expand Down Expand Up @@ -307,7 +307,7 @@ func (p *OceanstorSanPlugin) getStageVolumeInfo(ctx context.Context,
}
defer p.releaseClient(ctx, cli, metroCli)

lunName := utils.GetLunName(name)
lunName := p.cli.MakeLunName(name)
lun, err := p.getLunInfo(ctx, cli, metroCli, lunName)
if err != nil {
return nil, err
Expand Down Expand Up @@ -372,7 +372,7 @@ func (p *OceanstorSanPlugin) getUnStageVolumeInfo(ctx context.Context,
}
defer p.releaseClient(ctx, cli, metroCli)

lunName := utils.GetLunName(name)
lunName := p.cli.MakeLunName(name)
lun, err := p.getLunInfo(ctx, cli, metroCli, lunName)
if err != nil {
return nil, err
Expand Down Expand Up @@ -448,7 +448,7 @@ func (p *OceanstorSanPlugin) NodeExpandVolume(ctx context.Context,
}
defer p.releaseClient(ctx, cli, metroCli)

lunName := utils.GetLunName(name)
lunName := p.cli.MakeLunName(name)
lun, err := p.getLunInfo(ctx, cli, metroCli, lunName)
if err != nil {
log.AddContext(ctx).Errorf("Get lun %s error: %v", lunName, err)
Expand Down
Loading

0 comments on commit 3f8bf8c

Please sign in to comment.