Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSI-5663 | add VG servicer to csi addons server #681

Open
wants to merge 1 commit into
base: feature/CSI-5536_fence_design_tests
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions controllers/scripts/csi_general/csi_pb2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ set -x

CSI_VERSION="v1.5.0"
ADDONS_VERSION="v0.1.1"
VG_VERSION="v0.9.0"
PB2_DIR="csi_general"

mkdir -p ./proto/${PB2_DIR}
cd ./proto/${PB2_DIR}

curl -O https://raw.githubusercontent.com/container-storage-interface/spec/${CSI_VERSION}/csi.proto
curl -O https://raw.githubusercontent.com/IBM/csi-volume-group/${VG_VERSION}/volumegroup/volumegroup.proto
curl -O https://raw.githubusercontent.com/matancarmeli7/spec/add_volume_group_spec/volumegroup/volumegroup.proto
curl -O https://raw.githubusercontent.com/csi-addons/spec/v0.2.0/replication/replication.proto
curl -O https://raw.githubusercontent.com/csi-addons/spec/v0.2.0/fence/fence.proto
curl -O https://raw.githubusercontent.com/csi-addons/spec/main/identity/identity.proto
curl -O https://raw.githubusercontent.com/matancarmeli7/spec/add_volume_group_spec/identity/identity.proto
sed -i 's|github.com/container-storage-interface/spec/lib/go/csi/csi.proto|csi_general/csi.proto|g' replication.proto
sed -i 's|github.com/container-storage-interface/spec/lib/go/csi/csi.proto|csi_general/csi.proto|g' volumegroup.proto
sed -i 's|github.com/container-storage-interface/spec/lib/go/csi/csi.proto|csi_general/csi.proto|g' fence.proto
cd -

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ def GetCapabilities(self, request, context):
response = pb2.GetCapabilitiesResponse(
capabilities=[self._get_replication_capability(),
self._get_controller_capability(),
self._get_network_fence_capability()])
self._get_network_fence_capability(),
self._get_volume_group_capability(),
self._get_vg_limit_volume_to_one_vg_capability(),
self._get_vg_disable_deleting_volumes_when_vg_deleted_capability()])

logger.info("finished GetCapabilities")
return response
Expand All @@ -52,6 +55,24 @@ def _get_network_fence_capability(self):
return pb2.Capability(
network_fence=pb2.Capability.NetworkFence(type=capability_enum_value))

def _get_volume_group_capability(self):
types = pb2.Capability.VolumeGroup.Type
capability_enum_value = types.Value("VOLUME_GROUP")
return pb2.Capability(
volume_group=pb2.Capability.VolumeGroup(type=capability_enum_value))

def _get_vg_limit_volume_to_one_vg_capability(self):
types = pb2.Capability.VolumeGroup.Type
capability_enum_value = types.Value("LIMIT_VOLUME_TO_ONE_VG")
return pb2.Capability(
volume_group=pb2.Capability.VolumeGroup(type=capability_enum_value))

def _get_vg_disable_deleting_volumes_when_vg_deleted_capability(self):
types = pb2.Capability.VolumeGroup.Type
capability_enum_value = types.Value("DO_NOT_ALLOW_VG_TO_DELETE_VOLUMES")
return pb2.Capability(
volume_group=pb2.Capability.VolumeGroup(type=capability_enum_value))

def Probe(self, request, context):
context.set_code(grpc.StatusCode.OK)
return pb2.ProbeResponse()
4 changes: 3 additions & 1 deletion controllers/servers/csi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from controllers.common.csi_logger import set_log_level
from controllers.common.settings import CSI_CONTROLLER_SERVER_WORKERS
from controllers.servers.csi.controller_server.csi_controller_server import CSIControllerServicer
from controllers.servers.csi.controller_server.volume_group_server import VolumeGroupControllerServicer
from controllers.servers.csi.common_servers.volume_group_server import VolumeGroupControllerServicer
from controllers.servers.csi.csi_addons_server.fence_controller_servicer import FenceControllerServicer
from controllers.servers.csi.csi_addons_server.identity_controller_servicer import IdentityControllerServicer
from controllers.servers.csi.csi_addons_server.replication_controller_servicer import ReplicationControllerServicer
Expand Down Expand Up @@ -57,9 +57,11 @@ def _add_csi_addons_servicers(csi_addons_server):
replication_servicer = ReplicationControllerServicer()
identity_servicer = IdentityControllerServicer()
fence_servicer = FenceControllerServicer()
volume_group_servicer = VolumeGroupControllerServicer()
replication_pb2_grpc.add_ControllerServicer_to_server(replication_servicer, csi_addons_server)
identity_pb2_grpc.add_IdentityServicer_to_server(identity_servicer, csi_addons_server)
fence_pb2_grpc.add_FenceControllerServicer_to_server(fence_servicer, csi_addons_server)
volumegroup_pb2_grpc.add_ControllerServicer_to_server(volume_group_servicer, csi_addons_server)
return csi_addons_server


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

from controllers.array_action import errors as array_errors
from controllers.servers import settings as servers_settings
from controllers.servers.csi.controller_server.volume_group_server import VolumeGroupControllerServicer
from controllers.servers.csi.common_servers.volume_group_server import VolumeGroupControllerServicer
from controllers.tests import utils
from controllers.tests.common.test_settings import SECRET, VOLUME_GROUP_NAME, NAME_PREFIX, REQUEST_VOLUME_GROUP_ID, \
VOLUME_GROUP_UID, REQUEST_VOLUME_ID, VOLUME_UID, REQUEST_REAL_VOLUME_ID, REAL_NGUID
from controllers.tests.controller_server.common import mock_array_type, mock_mediator, mock_get_agent
from controllers.tests.controller_server.controller_server.csi_controller_server_test import CommonControllerTest
from controllers.tests.utils import ProtoBufMock

VG_CONTROLLER_SERVER_PATH = "controllers.servers.csi.controller_server.volume_group_server"
VG_CONTROLLER_SERVER_PATH = "controllers.servers.csi.common_servers.volume_group_server"


class BaseVgControllerSetUp(unittest.TestCase):
Expand Down