Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Allow manila e2e testing with DHSS=true (kubernetes#3049)
When using manila DHSS=true the network needs to be specified to allow
using/creating the share. To allow e2e testing in a DHSS=true env I
added an option to specify network via an environment variable keeping
backward compatibility while allowing testing with DHSS=true

Co-authored-by: eshulman2 <ellashulman1@gmail.com>
  • Loading branch information
k8s-infra-cherrypick-robot and eshulman2 authored Jan 21, 2026
commit e9b49aedbff8e2ac396b1844beadb90496eba6cf
19 changes: 15 additions & 4 deletions tests/e2e/csi/manila/manilavolume.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package test
import (
"bytes"
"context"
"os"
"os/exec"
"strconv"
"strings"
Expand All @@ -13,6 +14,10 @@ import (
storageframework "k8s.io/kubernetes/test/e2e/storage/framework"
)

// Environment variable for DHSS=True mode share network.
// This must match the variable in testdriver.go.
var manilaShareNetworkIDForVolume = os.Getenv("MANILA_SHARE_NETWORK_ID")

func runCmd(name string, args ...string) ([]byte, error) {
var stdout, stderr bytes.Buffer
cmd := exec.Command(name, args...)
Expand Down Expand Up @@ -47,9 +52,8 @@ func manilaCreateVolume(
ginkgo.By("Creating a test Manila volume externally")

// Create share.

out, err := runCmd(
"openstack",
// Build command arguments, optionally including share network for DHSS=True mode.
args := []string{
"share",
"create",
shareProto,
Expand All @@ -58,7 +62,14 @@ func manilaCreateVolume(
"--format=value",
"--column=id",
"--wait",
)
}

// Support for DHSS=True mode: include share network ID if specified
if manilaShareNetworkIDForVolume != "" {
args = append(args, "--share-network="+manilaShareNetworkIDForVolume)
}

out, err := runCmd("openstack", args...)

shareID := strings.TrimSpace(string(out))

Expand Down
12 changes: 12 additions & 0 deletions tests/e2e/csi/manila/testdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package test
import (
"context"
"fmt"
"os"

"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -30,6 +31,12 @@ const (
manilaShareSizeGiB = 1
)

// Environment variables for DHSS=True (driver_handles_share_servers) mode.
// Set MANILA_SHARE_NETWORK_ID to enable testing with share networks.
var (
manilaShareNetworkID = os.Getenv("MANILA_SHARE_NETWORK_ID")
)

type manilaTestDriver struct {
driverInfo storageframework.DriverInfo
volumeAttributes []map[string]string
Expand Down Expand Up @@ -129,6 +136,11 @@ func (d *manilaTestDriver) GetDynamicProvisionStorageClass(ctx context.Context,
"csi.storage.k8s.io/node-publish-secret-namespace": manilaSecretNamespace,
}

// Support for DHSS=True mode: include share network ID if specified
if manilaShareNetworkID != "" {
parameters["shareNetworkID"] = manilaShareNetworkID
}

sc := storageframework.GetStorageClass(
d.driverInfo.Name,
parameters,
Expand Down