func (vs *VSphere) DeleteVolume(volumePath string, dataCenterRef types.ManagedObjectReference) error {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()
	Connect(ctx, vs)

	datacenter := object.NewDatacenter(vs.Client.Client, dataCenterRef)
	virtualDiskManager := object.NewVirtualDiskManager(datacenter.Client())
	diskPath := removeStorageClusterORFolderNameFromVDiskPath(volumePath)
	// Delete virtual disk
	task, err := virtualDiskManager.DeleteVirtualDisk(ctx, diskPath, datacenter)
	if err != nil {
		framework.Logf("Failed to delete virtual disk. err: %v", err)
		return err
	}
	err = task.Wait(ctx)
	if err != nil {
		framework.Logf("Failed to delete virtual disk. err: %v", err)
		return err
	}
	return nil
}
// DeleteVolume deletes the vmdk file specified in the volumePath.
// if an error is encountered while deleting volume, error is returned.
DeleteVolume deletes the vmdk file specified in the volumePath.
if an error is encountered while deleting volume, error is returned.
// DeleteVolume deletes the vmdk file specified in the volumePath . // if an error is encountered while deleting volume error is returned .
func (vs *VSphere) DeleteVolume(volumePath string, dataCenterRef types.ManagedObjectReference) error {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()
	Connect(ctx, vs)
	datacenter := object.NewDatacenter(vs.Client.Client, dataCenterRef)
	virtualDiskManager := object.NewVirtualDiskManager(datacenter.Client())
	diskPath := removeStorageClusterORFolderNameFromVDiskPath(volumePath)
	task, err := virtualDiskManager.DeleteVirtualDisk(ctx, diskPath, datacenter)
	if err != nil {
		framework.Logf("Failed to delete virtual disk. err: %v", err)
		return err
	}
	err = task.Wait(ctx)
	if err != nil {
		framework.Logf("Failed to delete virtual disk. err: %v", err)
		return err
	}
	return nil
}
func ( vs * VSphere ) DeleteVolume ( volumePath string , dataCenterRef types . ManagedObjectReference ) error { ctx , cancel := context . WithCancel ( context . Background ( ) ) defer cancel ( ) Connect ( ctx , vs ) datacenter := object . NewDatacenter ( vs . Client . Client , dataCenterRef ) virtualDiskManager := object . NewVirtualDiskManager ( datacenter . Client ( ) ) diskPath := removeStorageClusterORFolderNameFromVDiskPath ( volumePath ) task , err := virtualDiskManager . DeleteVirtualDisk ( ctx , diskPath , datacenter ) if err != nil { framework . Logf ( " " , err ) return err } err = task . Wait ( ctx ) if err != nil { framework . Logf ( " " , err ) return err } return nil }
DeleteVolume deletes the vmdk file specified in the volumePath.
DeleteVolume deletes the vmdk file specified in the volumePath .
// Delete virtual disk