Skip to content

Commit

Permalink
Merge pull request #1 from silentred/bugfix
Browse files Browse the repository at this point in the history
update real allocated size of a volume, after it is created
  • Loading branch information
silentred authored Nov 29, 2023
2 parents ebb490b + 950a583 commit 7184e03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pkg/agent/pool/engine/service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package engine

import v1 "code.alipay.com/dbplatform/node-disk-controller/pkg/api/volume.antstor.alipay.com/v1"
import (
v1 "code.alipay.com/dbplatform/node-disk-controller/pkg/api/volume.antstor.alipay.com/v1"
)

type VolumeServiceIface interface {
CreateVolume(req CreateVolumeRequest) (resp CreateVolumeResponse, err error)
Expand Down
5 changes: 3 additions & 2 deletions pkg/agent/sync/sync_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,15 +639,16 @@ func GetSocketPathFromeUUID(uuid string) (path string) {

func (vs *VolumeSyncer) applyVolume(volume *v1.AntstorVolume) (needReturn bool, err error) {
// apply allocated size of LV to Annotation
if _, has := volume.Annotations[v1.AllocatedSizeAnnoKey]; !has {
if _, has := volume.Annotations[v1.AllocatedSizeAnnoKey]; !has && volume.Status.Status == v1.VolumeStatusReady {
// get allocated size
var (
lvName = volume.Name
vol engine.VolumeInfo
sizeByte uint64
)
vol, err = vs.poolService.PoolEngine().GetVolume(lvName)
if err != nil {
// ignore NotFoundDeviceError, because this error blocks the volume creation process
if err != nil && !spdk.IsNotFoundDeviceError(err) {
return
}

Expand Down

0 comments on commit 7184e03

Please sign in to comment.