Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug#56 #60

Merged
merged 4 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ test/sanity-crc/sanity-crc.yaml

# certification-related files
.redhat_*
preflight-*
.preflight*
preflight*
*.tgz

# Backup files
*~
~.bak
artifacts*
36 changes: 24 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ endif
ifdef VERSION
VERSION := $(VERSION)
else
VERSION := v1.5.3
VERSION := v1.5.7
endif

VERSION_FLAG = -X github.com/Seagate/seagate-exos-x-csi/pkg/common.Version=$(VERSION)
Expand All @@ -18,13 +18,15 @@ ifndef BIN
BIN = seagate-exos-x-csi
endif

HELM_VERSION := 1.0.0
HELM_VERSION := 1.0.1
HELM_KEY := css-host-software
HELM_IMAGE_REPO := $(DOCKER_HUB_REPOSITORY)/$(BIN)
# $HELM_KEY should be the name of a secret key in the invoker's default keyring
ifneq (,$(HELM_KEY))
HELM_KEYRING := --keyring ~/.gnupg/secring.gpg
HELM_SIGN := --sign --key $(HELM_KEY) $(HELM_KEYRING)
HELM_KEYRING := ~/.gnupg/secring.gpg
HELM_SIGN := --sign --key $(HELM_KEY) --keyring $(HELM_KEYRING)
endif
HELM_PACKAGE := $(BIN)-$(HELM_VERSION).tgz

IMAGE = $(DOCKER_HUB_REPOSITORY)/$(BIN):$(VERSION)

Expand Down Expand Up @@ -92,16 +94,25 @@ openshift:
docker build -f Dockerfile.redhat -t $(IMAGE) .
docker inspect $(IMAGE)

PREFLIGHT=/tmp/preflight-linux-amd64
PREFLIGHT=../openshift-preflight/preflight
PREFLIGHT_REGISTRY=localhost:5000
PREFLIGHT_IMAGE=$(PREFLIGHT_REGISTRY)/$(BIN):$(VERSION)
# PREFLIGHT_OPTIONS would typically include "--certification-project-id=xxx --pyxis-api-token=xxx"
PREFLIGHT_OPTIONS:=$(strip $(shell test ! -f .preflight_options || cat .preflight_options))
PREFLIGHT_SUBMIT=

preflight:
# make sure local registry is running
-docker run -d -p 5000:5000 --name registry registry:2
-docker run -d -p 5000:5000 --name registry registry:2 # make sure local registry is running
docker tag $(IMAGE) $(PREFLIGHT_IMAGE)
docker push $(PREFLIGHT_IMAGE)
$(PREFLIGHT) check container $(PREFLIGHT_IMAGE)
$(PREFLIGHT) check container $(PREFLIGHT_SUBMIT) $(PREFLIGHT_OPTIONS) $(PREFLIGHT_IMAGE)

preflight-submit: .preflight_options
$(MAKE) preflight PREFLIGHT_SUBMIT=--submit

build-preflight:
(cd ..; git clone https://github.com/redhat-openshift-ecosystem/openshift-preflight.git)
cd ../openshift-preflight && make build

push:
@echo ""
Expand All @@ -116,16 +127,17 @@ clean:

# Create a helm package that can be installed from a remote HTTPS URL with, e.g.
# helm install seagate-csi https://<server>/<path>/seagate-exos-x-csi-1.0.0.tgz
HELM_PACKAGE := $(BIN)-$(HELM_VERSION).tgz
helm-package: $(HELM_PACKAGE)

# To create a package without signing it, specify "make helm-package HELM_KEY="
# Note that helm doesn't support GPG v2.1 kbx files. If signing fails, try:
# Note that helm doesn't support GPG v2.1 kbx files; if signing fails, try:
# gpg --export-secret-keys > ~/.gnupg/secring.gpg
$(HELM_PACKAGE):
cd helm; helm package $(HELM_SIGN) $$PWD/csi-charts
cd helm; helm package $(HELM_SIGN) \
--set image.tag=$(VERSION) --set image.repository=$(HELM_IMAGE_REPO) \
$$PWD/csi-charts
cp -p helm/$@* .
ifdef HELM_KEYRING
helm verify $(HELM_KEYRING) $@
helm verify --keyring $(HELM_KEYRING) $@
zip -r $(subst .tgz,-signed-helm-package.zip,$@) $@ [email protected]
endif
8 changes: 6 additions & 2 deletions pkg/controller/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ func parseTopology(topologies []*csi.Topology, storageProtocol string, parameter
}

}
if len(accessibleTopology) == 0 {
accessibleTopology = nil
}
return accessibleTopology, nil
}

Expand All @@ -75,8 +78,9 @@ func (controller *Controller) CreateVolume(ctx context.Context, req *csi.CreateV

//insert topology keys into the parameters map, so they will be available in ControllerPublishVolume
accessibleTopology, err := parseTopology(req.GetAccessibilityRequirements().GetRequisite(), storageProtocol, &parameters)
if err != nil || len(accessibleTopology) == 0 {
return nil, status.Error(codes.Unavailable, "could not parse topology requirements")
if err != nil {
klog.Errorf("parseTopology() returned error: %v", err)
return nil, err
}
klog.V(5).Infof("accessibleTopology: %v", accessibleTopology)

Expand Down
7 changes: 5 additions & 2 deletions pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ func New() *Node {

node.InitServer(
func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
klog.Infof(">>> %s", info.FullMethod)
if info.FullMethod == "/csi.v1.Node/NodePublishVolume" {
if !node.semaphore.TryAcquire(1) {
return nil, status.Error(codes.Aborted, "node busy: too many concurrent volume publication, try again later")
if err := node.semaphore.Acquire(ctx, 1); err != nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did your testing prove that Acquire is more effective and successful than TryAcquire()?

klog.Infof(">>> %s FAILED to acquire semaphore", info.FullMethod)
return nil, status.Error(codes.Aborted, "node busy: too many concurrent volume publications, try again later")
}
defer node.semaphore.Release(1)
klog.Infof(">>> %s acquired semaphore", info.FullMethod)
}
return handler(ctx, req)
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/sasNode.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func (sas *sasStorage) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnp

func checkPreviouslyRemovedDevices(ctx context.Context) error {
klog.Info("Checking previously removed devices")
for wwn, _ := range globalRemovedDevicesMap {
for wwn := range globalRemovedDevicesMap {
klog.Infof("Checking for rediscovery of wwn:%s", wwn)

dm, devices := saslib.FindDiskById(klog.FromContext(ctx), wwn, &saslib.OSioHandler{})
Expand Down