fix CreateVolume: search mode for Dedicated kind
This commit is contained in:
@@ -28,8 +28,8 @@ import (
|
||||
|
||||
// interface exposed by the cloud provider implementing Disk functionlity
|
||||
type DiskController interface {
|
||||
CreateBlobDisk(dataDiskName string, storageAccountType storage.SkuName, sizeGB int, forceStandAlone bool) (string, error)
|
||||
DeleteBlobDisk(diskUri string, wasForced bool) error
|
||||
CreateBlobDisk(dataDiskName string, storageAccountType storage.SkuName, sizeGB int) (string, error)
|
||||
DeleteBlobDisk(diskUri string) error
|
||||
|
||||
CreateManagedDisk(diskName string, storageAccountType storage.SkuName, sizeGB int, tags map[string]string) (string, error)
|
||||
DeleteManagedDisk(diskURI string) error
|
||||
|
||||
@@ -55,14 +55,13 @@ func (d *azureDiskDeleter) Delete() error {
|
||||
return err
|
||||
}
|
||||
|
||||
wasStandAlone := (*volumeSource.Kind != v1.AzureSharedBlobDisk)
|
||||
managed := (*volumeSource.Kind == v1.AzureManagedDisk)
|
||||
|
||||
if managed {
|
||||
return diskController.DeleteManagedDisk(volumeSource.DataDiskURI)
|
||||
}
|
||||
|
||||
return diskController.DeleteBlobDisk(volumeSource.DataDiskURI, wasStandAlone)
|
||||
return diskController.DeleteBlobDisk(volumeSource.DataDiskURI)
|
||||
}
|
||||
|
||||
func (p *azureDiskProvisioner) Provision() (*v1.PersistentVolume, error) {
|
||||
@@ -149,26 +148,13 @@ func (p *azureDiskProvisioner) Provision() (*v1.PersistentVolume, error) {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
forceStandAlone := (kind == v1.AzureDedicatedBlobDisk)
|
||||
if kind == v1.AzureDedicatedBlobDisk {
|
||||
if location != "" && account != "" {
|
||||
// use dedicated kind (by default) for compatibility
|
||||
_, diskURI, _, err = diskController.CreateVolume(name, account, skuName, location, requestGB)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
if location != "" || account != "" {
|
||||
return nil, fmt.Errorf("AzureDisk - location(%s) and account(%s) must be both empty or specified for dedicated kind, only one value specified is not allowed",
|
||||
location, account)
|
||||
}
|
||||
diskURI, err = diskController.CreateBlobDisk(name, skuName, requestGB, forceStandAlone)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, diskURI, _, err = diskController.CreateVolume(name, account, skuName, location, requestGB)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
diskURI, err = diskController.CreateBlobDisk(name, skuName, requestGB, forceStandAlone)
|
||||
diskURI, err = diskController.CreateBlobDisk(name, skuName, requestGB)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user