Add a new node service implementation for the CSI plugin, supporting local disk backed volumes. The service provides logic for all required node operations, including stage, unstage, publish, and unpublish. The node_stage_volume method allocates a sparse file on the VM's local disk, sets up a loop device, and, if the PVC requests a filesystem, formats and mounts the device to the staging path. If the PVC requests a block device, only the loop device is set up, with no formatting or mounting performed. The node_publish_volume method always bind-mounts the staging path to the target path, making the volume available to the workload as required by the CSI specification. The node_unstage_volume and node_unpublish_volume methods unmount the staging and target paths, respectively, ensuring proper cleanup of resources when a volume is no longer needed. The service respects the requested volume capability, only formatting and mounting when a filesystem is requested, and otherwise presenting a raw block device. The node_get_capabilities and node_get_info methods are implemented to advertise supported node features and provide node identity and volume limits, using the VM's hostname and a static maximum volume count.
14 lines
256 B
Ruby
14 lines
256 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "grpc"
|
|
require "csi_pb"
|
|
require "csi_services_pb"
|
|
|
|
module Csi
|
|
VERSION = "0.1.0"
|
|
end
|
|
|
|
require_relative "ubi_csi/identity_service"
|
|
require_relative "ubi_csi/controller_service"
|
|
require_relative "ubi_csi/node_service"
|