Skip to content

WLDI : Test cases for vsan-max configuration #3371

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions tests/e2e/e2e_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ const (
distributed = "distributed"
vmsvc = "vmsvc"
vc90 = "vc90"
vc90u1 = "vc90u1"
vc80 = "vc80"
vc70 = "vc70"
wldi = "wldi"
Expand Down Expand Up @@ -504,6 +505,8 @@ var (
envZone2DatastoreUrl = "ZONE2_DATASTORE_URL"
envIsolationSharedStoragePolicyNameLateBidning = "WORKLOAD_ISOLATION_SHARED_STORAGE_POLICY_WFFC"
envSharedZone1Zone2Zone3StoragePolicyName = "SHARED_ZONE1_ZONE2_ZONE3_STORAGE_POLICY_IMM"
nimbusWorkerIp = "NIMBUS_WORKER_IP"
vsanMaxFaultDomainName = "VSAN_MAX_FD_NAME"
)

// storage policy usages for storage quota validation
Expand Down
14 changes: 14 additions & 0 deletions tests/e2e/mgmt_wrkld_domain_isolation_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,3 +490,17 @@ func passZonesToStayInMap(allowedTopologyMap map[string][]string,
}
return allowedTopologyMap
}

// This method helps to get the host list from given zone
func getNodesFromZone(ctx context.Context, client clientset.Interface, zoneName string) []v1.Node {
var hostList []v1.Node
nodeList, _ := fnodes.GetReadySchedulableNodes(ctx, client)
for _, node := range nodeList.Items {
if zone, found := node.Labels[v1.LabelTopologyZone]; found {
if strings.Contains(zone, zoneName) {
hostList = append(hostList, node)
}
}
}
return hostList
}
33 changes: 26 additions & 7 deletions tests/e2e/nimbus_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import (

"github.com/davecgh/go-spew/spew"
"github.com/onsi/gomega"
"golang.org/x/crypto/ssh"
"k8s.io/kubernetes/test/e2e/framework"
fssh "k8s.io/kubernetes/test/e2e/framework/ssh"
)

type TestbedBasicInfo struct {
Expand All @@ -50,14 +52,31 @@ func vMPowerMgmt(user string, location string, podname string, hostList string,
nimbusCmd := fmt.Sprintf("USER=%s /mts/git/bin/nimbus-ctl --nimbusLocation %s --nimbus %s %s %s", user,
location, podname, op, hostList)
framework.Logf("Running command: %s", nimbusCmd)
cmd := exec.Command("/bin/bash", "-c", nimbusCmd)
err = cmd.Start()
if err != nil {
return err
}
err = cmd.Wait()

framework.Logf("stdout:\n%v\nstderr:\n%v\n", cmd.Stdout, cmd.Stderr)
// Changes done for WLDI as nimbus-ctl cmd can't run from local mac
if GetAndExpectStringEnvVar(topologyFeature) == topologyDomainIsolation {
sshClientConfig := &ssh.ClientConfig{
User: "worker",
Auth: []ssh.AuthMethod{
ssh.Password(GetAndExpectStringEnvVar(vcUIPwd)),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
}
powerOffVm, er := sshExec(sshClientConfig, GetAndExpectStringEnvVar(nimbusWorkerIp), nimbusCmd)
if er != nil && powerOffVm.Code != 0 {
fssh.LogResult(powerOffVm)
err = er
}
} else {
cmd := exec.Command("/bin/bash", "-c", nimbusCmd)
err = cmd.Start()
if err != nil {
return err
}
err = cmd.Wait()

framework.Logf("stdout:\n%v\nstderr:\n%v\n", cmd.Stdout, cmd.Stderr)
}
return err
}

Expand Down
15 changes: 15 additions & 0 deletions tests/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -8117,3 +8117,18 @@ func createtWcpNsWithZonesAndPolicies(

return namespace, statusCode, nil
}

// Get vm name from testbedInfo.json for given host IP
func getVmNameFromHostIp(hostIps []string) string {
// Assuming testbed info is read before calling this method
hostlist := ""
for _, hostIp := range hostIps {
for _, esxHost := range tbinfo.esxHosts {
if esxHost["ip"] == hostIp {
hostIp = esxHost["ip"]
hostlist += esxHost["vmName"] + " "
}
}
}
return hostlist
}
Loading