Commit f533e378 authored by andyzhangx's avatar andyzhangx

specify external resource group in ResizeDisk

fix issue
parent e6fdcb4a
...@@ -148,11 +148,17 @@ func (c *ManagedDiskController) getDisk(diskName string) (string, string, error) ...@@ -148,11 +148,17 @@ func (c *ManagedDiskController) getDisk(diskName string) (string, string, error)
} }
// ResizeDisk Expand the disk to new size // ResizeDisk Expand the disk to new size
func (c *ManagedDiskController) ResizeDisk(diskName string, oldSize resource.Quantity, newSize resource.Quantity) (resource.Quantity, error) { func (c *ManagedDiskController) ResizeDisk(diskURI string, oldSize resource.Quantity, newSize resource.Quantity) (resource.Quantity, error) {
ctx, cancel := getContextWithCancel() ctx, cancel := getContextWithCancel()
defer cancel() defer cancel()
result, err := c.common.cloud.DisksClient.Get(ctx, c.common.resourceGroup, diskName) diskName := path.Base(diskURI)
resourceGroup, err := getResourceGroupFromDiskURI(diskURI)
if err != nil {
return oldSize, err
}
result, err := c.common.cloud.DisksClient.Get(ctx, resourceGroup, diskName)
if err != nil { if err != nil {
return oldSize, err return oldSize, err
} }
......
...@@ -58,7 +58,7 @@ type DiskController interface { ...@@ -58,7 +58,7 @@ type DiskController interface {
DeleteVolume(diskURI string) error DeleteVolume(diskURI string) error
// Expand the disk to new size // Expand the disk to new size
ResizeDisk(diskName string, oldSize resource.Quantity, newSize resource.Quantity) (resource.Quantity, error) ResizeDisk(diskURI string, oldSize resource.Quantity, newSize resource.Quantity) (resource.Quantity, error)
} }
type azureDataDiskPlugin struct { type azureDataDiskPlugin struct {
...@@ -242,7 +242,7 @@ func (plugin *azureDataDiskPlugin) ExpandVolumeDevice( ...@@ -242,7 +242,7 @@ func (plugin *azureDataDiskPlugin) ExpandVolumeDevice(
return oldSize, err return oldSize, err
} }
return diskController.ResizeDisk(spec.PersistentVolume.Spec.AzureDisk.DiskName, oldSize, newSize) return diskController.ResizeDisk(spec.PersistentVolume.Spec.AzureDisk.DataDiskURI, oldSize, newSize)
} }
func (plugin *azureDataDiskPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) { func (plugin *azureDataDiskPlugin) ConstructVolumeSpec(volumeName, mountPath string) (*volume.Spec, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment