Skip to content
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
2 changes: 1 addition & 1 deletion pkg/autohealing/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var rootCmd = &cobra.Command{
Name: "k8s-auto-healer",
})

sigCh := make(chan os.Signal)
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGINT, syscall.SIGTERM)
<-sigCh
},
Expand Down
5 changes: 4 additions & 1 deletion pkg/csi/cinder/controllerserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,10 @@ func (cs *controllerServer) CreateSnapshot(ctx context.Context, req *csi.CreateS
properties := map[string]string{cinderCSIClusterIDKey: cs.Driver.cluster}

// see https://github.com/kubernetes-csi/external-snapshotter/pull/375/
for _, mKey := range []string{"csi.storage.k8s.io/volumesnapshot/name", "csi.storage.k8s.io/volumesnapshot/namespace", "csi.storage.k8s.io/volumesnapshotcontent/name"} {
// Also, we don't want to tag every param but we still want to send the
// 'force-create' flag to openstack layer so that we will honor the
// force create functions
for _, mKey := range []string{"csi.storage.k8s.io/volumesnapshot/name", "csi.storage.k8s.io/volumesnapshot/namespace", "csi.storage.k8s.io/volumesnapshotcontent/name", openstack.SnapshotForceCreate} {
if v, ok := req.Parameters[mKey]; ok {
properties[mKey] = v
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/csi/cinder/controllerserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ func TestCreateSnapshotWithExtraMetadata(t *testing.T) {
"csi.storage.k8s.io/volumesnapshot/name": FakeSnapshotName,
"csi.storage.k8s.io/volumesnapshotcontent/name": FakeSnapshotContentName,
"csi.storage.k8s.io/volumesnapshot/namespace": FakeSnapshotNamespace,
openstack.SnapshotForceCreate: "true",
}

osmock.On("CreateSnapshot", FakeSnapshotName, FakeVolID, &properties).Return(&FakeSnapshotRes, nil)
Expand All @@ -458,6 +459,7 @@ func TestCreateSnapshotWithExtraMetadata(t *testing.T) {
"csi.storage.k8s.io/volumesnapshot/name": FakeSnapshotName,
"csi.storage.k8s.io/volumesnapshotcontent/name": FakeSnapshotContentName,
"csi.storage.k8s.io/volumesnapshot/namespace": FakeSnapshotNamespace,
openstack.SnapshotForceCreate: "true",
},
}

Expand Down
6 changes: 3 additions & 3 deletions pkg/csi/cinder/openstack/openstack_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const (
snapReadySteps = 10

snapshotDescription = "Created by OpenStack Cinder CSI driver"
snapshotForceCreate = "force-create"
SnapshotForceCreate = "force-create"
)

// CreateSnapshot issues a request to take a Snapshot of the specified Volume with the corresponding ID and
Expand All @@ -47,14 +47,14 @@ func (os *OpenStack) CreateSnapshot(name, volID string, tags *map[string]string)
force := false
// if no flag given, then force will be false by default
// if flag it given , check it
if item, ok := (*tags)[snapshotForceCreate]; ok {
if item, ok := (*tags)[SnapshotForceCreate]; ok {
var err error
force, err = strconv.ParseBool(item)
if err != nil {
klog.V(5).Infof("Make force create flag to false due to: %v", err)
}

delete(*tags, snapshotForceCreate)
delete(*tags, SnapshotForceCreate)
}
// Force the creation of snapshot even the Volume is in in-use state
opts := &snapshots.CreateOpts{
Expand Down
1 change: 1 addition & 0 deletions pkg/util/blockdevice/blockdevice_unsupported.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !linux
// +build !linux

/*
Expand Down