Skip to content

Commit

Permalink
NBSNEBIUS-177: support overlay disk creation in csi-driver (#751)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanek325 authored Mar 15, 2024
1 parent d9fa8ff commit 291da0a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ spec:
limits:
storage: 1Gi
storageClassName: nbs-csi-sc
volumeName: my-pv
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ spec:
type: DirectoryOrCreate
- name: sockets-dir
hostPath:
path: /run/nbsd/sockets/
path: /run/nbsd/sockets
type: DirectoryOrCreate
imagePullSecrets:
- name: nbs-puller-secret
tolerations:
- operator: Exists
23 changes: 19 additions & 4 deletions cloud/blockstore/tools/csi_driver/internal/driver/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,27 @@ func (c *nbsServerControllerService) CreateVolume(
)
}

var baseDiskID string
var baseDiskCheckpointID string
if req.Parameters != nil {
for key, value := range req.Parameters {
if key == "base-disk-id" {
baseDiskID = value
}
if key == "base-disk-checkpoint-id" {
baseDiskCheckpointID = value
}
}
}

diskId := req.Name
createVolumeRequest := &nbsblockstorepublicapi.TCreateVolumeRequest{
DiskId: diskId,
BlockSize: diskBlockSize,
BlocksCount: uint64(requiredBytes) / uint64(diskBlockSize),
StorageMediaKind: nbsstoragecoreapi.EStorageMediaKind_STORAGE_MEDIA_SSD,
DiskId: diskId,
BlockSize: diskBlockSize,
BlocksCount: uint64(requiredBytes) / uint64(diskBlockSize),
StorageMediaKind: nbsstoragecoreapi.EStorageMediaKind_STORAGE_MEDIA_SSD,
BaseDiskId: baseDiskID,
BaseDiskCheckpointId: baseDiskCheckpointID,
}

_, err := c.nbsClient.CreateVolume(ctx, createVolumeRequest)
Expand Down

0 comments on commit 291da0a

Please sign in to comment.