func PodsUseStaticPVsOrFail(f *framework.Framework, podCount int, image string) {
	var err error
	c := f.ClientSet
	ns := f.Namespace.Name

	zones, err := e2enode.GetClusterZones(c)
	framework.ExpectNoError(err)
	zonelist := zones.List()
	ginkgo.By("Creating static PVs across zones")
	configs := make([]*staticPVTestConfig, podCount)
	for i := range configs {
		configs[i] = &staticPVTestConfig{}
	}

	defer func() {
		ginkgo.By("Cleaning up pods and PVs")
		for _, config := range configs {
			e2epod.DeletePodOrFail(c, ns, config.pod.Name)
		}
		for _, config := range configs {
			e2epod.WaitForPodNoLongerRunningInNamespace(c, config.pod.Name, ns)
			e2epv.PVPVCCleanup(c, ns, config.pv, config.pvc)
			err = e2epv.DeletePVSource(config.pvSource)
			framework.ExpectNoError(err)
		}
	}()

	for i, config := range configs {
		zone := zonelist[i%len(zones)]
		config.pvSource, err = e2epv.CreatePVSource(zone)
		framework.ExpectNoError(err)

		pvConfig := e2epv.PersistentVolumeConfig{
			NamePrefix: "multizone-pv",
			PVSource:   *config.pvSource,
			Prebind:    nil,
		}
		className := ""
		pvcConfig := e2epv.PersistentVolumeClaimConfig{StorageClassName: &className}

		config.pv, config.pvc, err = e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, true)
		framework.ExpectNoError(err)
	}

	ginkgo.By("Waiting for all PVCs to be bound")
	for _, config := range configs {
		e2epv.WaitOnPVandPVC(c, ns, config.pv, config.pvc)
	}

	ginkgo.By("Creating pods for each static PV")
	for _, config := range configs {
		podConfig := e2epod.MakePod(ns, nil, []*v1.PersistentVolumeClaim{config.pvc}, false, "")
		config.pod, err = c.CoreV1().Pods(ns).Create(context.TODO(), podConfig, metav1.CreateOptions{})
		framework.ExpectNoError(err)
	}

	ginkgo.By("Waiting for all pods to be running")
	for _, config := range configs {
		err = e2epod.WaitForPodRunningInNamespace(c, config.pod)
		framework.ExpectNoError(err)
	}
}
// PodsUseStaticPVsOrFail Check that the pods using statically
// created PVs get scheduled to the same zone that the PV is in.
PodsUseStaticPVsOrFail Check that the pods using statically
created PVs get scheduled to the same zone that the PV is in.
// PodsUseStaticPVsOrFail Check that the pods using statically // created PVs get scheduled to the same zone that the PV is in .
func PodsUseStaticPVsOrFail(f *framework.Framework, podCount int, image string) {
	var err error
	c := f.ClientSet
	ns := f.Namespace.Name
	zones, err := e2enode.GetClusterZones(c)
	framework.ExpectNoError(err)
	zonelist := zones.List()
	ginkgo.By("Creating static PVs across zones")
	configs := make([]*staticPVTestConfig, podCount)
	for i := range configs {
		configs[i] = &staticPVTestConfig{}
	}
	defer func() {
		ginkgo.By("Cleaning up pods and PVs")
		for _, config := range configs {
			e2epod.DeletePodOrFail(c, ns, config.pod.Name)
		}
		for _, config := range configs {
			e2epod.WaitForPodNoLongerRunningInNamespace(c, config.pod.Name, ns)
			e2epv.PVPVCCleanup(c, ns, config.pv, config.pvc)
			err = e2epv.DeletePVSource(config.pvSource)
			framework.ExpectNoError(err)
		}
	}()
	for i, config := range configs {
		zone := zonelist[i%len(zones)]
		config.pvSource, err = e2epv.CreatePVSource(zone)
		framework.ExpectNoError(err)
		pvConfig := e2epv.PersistentVolumeConfig{
			NamePrefix: "multizone-pv",
			PVSource:   *config.pvSource,
			Prebind:    nil,
		}
		className := ""
		pvcConfig := e2epv.PersistentVolumeClaimConfig{StorageClassName: &className}
		config.pv, config.pvc, err = e2epv.CreatePVPVC(c, pvConfig, pvcConfig, ns, true)
		framework.ExpectNoError(err)
	}
	ginkgo.By("Waiting for all PVCs to be bound")
	for _, config := range configs {
		e2epv.WaitOnPVandPVC(c, ns, config.pv, config.pvc)
	}
	ginkgo.By("Creating pods for each static PV")
	for _, config := range configs {
		podConfig := e2epod.MakePod(ns, nil, []*v1.PersistentVolumeClaim{config.pvc}, false, "")
		config.pod, err = c.CoreV1().Pods(ns).Create(context.TODO(), podConfig, metav1.CreateOptions{})
		framework.ExpectNoError(err)
	}
	ginkgo.By("Waiting for all pods to be running")
	for _, config := range configs {
		err = e2epod.WaitForPodRunningInNamespace(c, config.pod)
		framework.ExpectNoError(err)
	}
}
func PodsUseStaticPVsOrFail ( f * framework . Framework , podCount int , image string ) { var err error c := f . ClientSet ns := f . Namespace . Name zones , err := e2enode . GetClusterZones ( c ) framework . ExpectNoError ( err ) zonelist := zones . List ( ) ginkgo . By ( " " ) configs := make ( [ ] * staticPVTestConfig , podCount ) for i := range configs { configs [ i ] = & staticPVTestConfig { } } defer func ( ) { ginkgo . By ( " " ) for _ , config := range configs { e2epod . DeletePodOrFail ( c , ns , config . pod . Name ) } for _ , config := range configs { e2epod . WaitForPodNoLongerRunningInNamespace ( c , config . pod . Name , ns ) e2epv . PVPVCCleanup ( c , ns , config . pv , config . pvc ) err = e2epv . DeletePVSource ( config . pvSource ) framework . ExpectNoError ( err ) } } ( ) for i , config := range configs { zone := zonelist [ i % len ( zones ) ] config . pvSource , err = e2epv . CreatePVSource ( zone ) framework . ExpectNoError ( err ) pvConfig := e2epv . PersistentVolumeConfig { NamePrefix : " " , PVSource : * config . pvSource , Prebind : nil , } className := " " pvcConfig := e2epv . PersistentVolumeClaimConfig { StorageClassName : & className } config . pv , config . pvc , err = e2epv . CreatePVPVC ( c , pvConfig , pvcConfig , ns , true ) framework . ExpectNoError ( err ) } ginkgo . By ( " " ) for _ , config := range configs { e2epv . WaitOnPVandPVC ( c , ns , config . pv , config . pvc ) } ginkgo . By ( " " ) for _ , config := range configs { podConfig := e2epod . MakePod ( ns , nil , [ ] * v1 . PersistentVolumeClaim { config . pvc } , false , " " ) config . pod , err = c . CoreV1 ( ) . Pods ( ns ) . Create ( context . TODO ( ) , podConfig , metav1 . CreateOptions { } ) framework . ExpectNoError ( err ) } ginkgo . By ( " " ) for _ , config := range configs { err = e2epod . WaitForPodRunningInNamespace ( c , config . pod ) framework . ExpectNoError ( err ) } }
PodsUseStaticPVsOrFail Check that the pods using statically
created PVs get scheduled to the same zone that the PV is in.
PodsUseStaticPVsOrFail Check that the pods using statically created PVs get scheduled to the same zone that the PV is in .