Change:
With version 1.4.7 I could use a datastore that is in a cluster as a vsphere volume as . When I upgraded to 1.6.0, this same exact path does not work and throws a error. I'm struggling to find what changed, but am guessing it's difference in how the datastore is being looked up in vcenter. Has anyone had luck with this?
We have verified creating pod using static PV and dynamic provisioning, both works fine with Can you post here? cc:
Did that include using a datastore that was in a datastore cluster? That seemed to be working before because the datastore previously (before 1.5) was read out of the global config, which supported datastore path with cluster name. But post 1.5 datastore is parsed from the entry, which if you include the path to the cluster it gets you past the datastore lookup, but then when you go to add the disk it fails because that is not valid to vCenter. It's kind of this weird mixed mode, because to look up the datastore you need the path including the cluster, but to create the file you need the path without the cluster. I presume the PV is working because they use the cloud config values? I was not using a PV but putting a volumePath directly in my deployment yaml. Should I be using a PV to do this? If the deployment is deleted and re-created how do I guarantee that my pod would get the same PV claim? That was why I did not go down that path originally. I'm pretty sure I have narrowed down where in the provider this is happening, but didn't see a good path to get it to work. I have, admittantly, not tried PV/PVCs yet, due to the concern raised above, but could try those to see. The pertinent part of the deployment yaml: The cloud config:
Just confirmed I have the same issue using a PV and PVC....
Here it needs it in format: (which it gets on line 791 by parsing . But here it needs it in true format, without the datastorecluster: Therefore if you do it gets you past line 796 but fails on 802. But if you do then you don't get past line 796.
Thanks for detailed look up. This is the commit which caused this regression. We will work on the fix. cc:
Ah yes, I see that now. What is the lifecycle of a dynamic disk? Does that disk live on after the PVC is released? After the PV is deleted? It seems like I may just not fully be exercising the power of the volume plugins as well. I would still have the issue with existing volumes as they have data that I need to maintain, but would be interesting for new volumes to look into these more.
RECLAIMPOLICY for PV created using Dynamic Provisioning is Delete PV will get deleted if you delete PVC. Disk also gets deleted from datastore.

Discussion:
"net/url" "path" "path/filepath" <ins> "regexp" </ins> "runtime" "strings" "sync"

glog.Errorf("Failed while searching for datastore %+q. err %s", datastorePathObj.Datastore, err) return "", "", err } <ins> vmDiskPath = removeClusterFromVDiskPath(vmDiskPath) </ins> disk := vmDevices.CreateDisk(scsiController, ds.Reference(), vmDiskPath) unitNumber, err := getNextUnitNumber(vmDevices, scsiController) if err != nil {

// Returns the object key that denotes the controller object to which vmdk is attached. func getVirtualDiskControllerKey(volPath string, vmDevices object.VirtualDeviceList, dc *object.Datacenter, client *govmomi.Client) (int32, error) { <ins> volPath = removeClusterFromVDiskPath(volPath) </ins> volumeUUID, err := getVirtualDiskUUIDByPath(volPath, dc, client) if err != nil {

if err != nil { return err } <ins> volPath = removeClusterFromVDiskPath(volPath) </ins> diskID, err := getVirtualDiskID(volPath, vmDevices, dc, vs.client) if err != nil { glog.Warningf("disk ID not found for %v ", volPath)

return "", fmt.Errorf("Failed to create the virtual disk having name: %+q with err: %+v", destVolPath, err) } } <ins> if filepath.Base(datastore) != datastore { // If Datastore is within cluster, add cluster path to the destVolPath destVolPath = strings.Replace(destVolPath, filepath.Base(datastore), datastore, 1) } </ins> glog.V(1).Infof("VM Disk path is %+q", destVolPath) return destVolPath, nil }

} // Delete virtual disk <ins> vmDiskPath = removeClusterFromVDiskPath(vmDiskPath) </ins> task, err := virtualDiskManager.DeleteVirtualDisk(ctx, vmDiskPath, dc) if err != nil { return err

} return destroyTask.Wait(ctx) } <ins> // Remove the cluster or folder path from the vDiskPath // for vDiskPath [DatastoreCluster/sharedVmfs-0] kubevols/e2e-vmdk-1234.vmdk, return value is [sharedVmfs-0] kubevols/e2e-vmdk-1234.vmdk // for vDiskPath [sharedVmfs-0] kubevols/e2e-vmdk-1234.vmdk, return value remains same [sharedVmfs-0] kubevols/e2e-vmdk-1234.vmdk func removeClusterFromVDiskPath(vDiskPath string) string { datastore := regexp.MustCompile("[(.*?)]").FindStringSubmatch(vDiskPath)[1] if filepath.Base(datastore) != datastore { vDiskPath = strings.Replace(vDiskPath, datastore, filepath.Base(datastore), 1) } return vDiskPath } </ins>