Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/go_modules/google.golang.org/g…
Browse files Browse the repository at this point in the history
…rpc-1.56.3
  • Loading branch information
kasserater authored Apr 15, 2024
2 parents 27db941 + 86eab2a commit bb44dbb
Show file tree
Hide file tree
Showing 45 changed files with 4,597 additions and 4,653 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ updates:
labels:
- github_actions
- dependencies
- testing
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Run link check
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-controllers.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright IBM Corporation 2019.
# Copyright IBM Corporation 2024.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
12 changes: 10 additions & 2 deletions Dockerfile-csi-controller
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright IBM Corporation 2019.
# Copyright IBM Corporation 2024.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -26,6 +26,7 @@ RUN pip3 install -r ./requirements.txt

USER root
COPY controllers/scripts/csi_general .
RUN chmod +x csi_pb2.sh
RUN ./csi_pb2.sh
RUN pip3 install .

Expand Down Expand Up @@ -53,9 +54,16 @@ COPY ./controllers/ /driver/controllers/
COPY ./LICENSE /licenses/
COPY ./NOTICES /licenses/

USER root
RUN chmod +x /driver/controllers/scripts/entrypoint.sh
USER default

WORKDIR /driver
ENV PYTHONPATH=/driver

# Note: UBI runs with app-user by default.
USER root
RUN yum update -y

USER default
# Note: UBI runs with app-user by default.
ENTRYPOINT ["/driver/controllers/scripts/entrypoint.sh"]
5 changes: 5 additions & 0 deletions Dockerfile-csi-host-definer
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN pip3 install -r ./csi_requirements.txt -r ./host_definer_requirements.txt

USER root
COPY controllers/scripts/csi_general .
RUN chmod +x csi_pb2.sh
RUN ./csi_pb2.sh
RUN pip3 install .

Expand Down Expand Up @@ -43,4 +44,8 @@ COPY ./NOTICES /licenses/
WORKDIR /driver/controllers/servers/host_definer/
ENV PYTHONPATH=/driver

USER root
RUN yum update -y

USER default
CMD ["python3", "/driver/controllers/servers/host_definer/main.py"]
7 changes: 5 additions & 2 deletions Dockerfile-csi-node
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright IBM Corporation 2019.
# Copyright IBM Corporation 2024.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@ COPY . .
RUN make ibm-block-csi-driver

# Final stage
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7-1107
FROM registry.access.redhat.com/ubi9-minimal:9.3-1612
MAINTAINER IBM Storage

ARG VERSION=1.12.0
Expand Down Expand Up @@ -74,5 +74,8 @@ RUN ln -s /chroot/chroot-host-wrapper.sh /chroot/blkid \
&& ln -s /chroot/chroot-host-wrapper.sh /chroot/xfs_growfs

ENV PATH="/chroot:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
USER root
RUN microdnf update -y

USER default
ENTRYPOINT ["/root/entrypoint.sh"]
2 changes: 1 addition & 1 deletion Dockerfile-csi-node.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright IBM Corporation 2019.
# Copyright IBM Corporation 2024.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-csi-test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright IBM Corporation 2019.
# Copyright IBM Corporation 2024.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4,798 changes: 2,399 additions & 2,399 deletions NOTICES

Large diffs are not rendered by default.

116 changes: 58 additions & 58 deletions controllers/array_action/ds8k_volume_cache.py
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
from collections import defaultdict
from threading import RLock

from controllers.common.csi_logger import get_stdout_logger

logger = get_stdout_logger()


class VolumeCacheByAddress:
def __init__(self):
logger.debug("creating a new cache")
self._volume_cache_by_address = defaultdict(dict)
self._cache_lock = RLock()

def add(self, address, key, value):
logger.debug("adding {} to cache".format(key))
with self._cache_lock:
self._volume_cache_by_address[address][key] = value

def remove(self, address, key):
logger.debug("removing {} from cache".format(key))
with self._cache_lock:
if self._volume_cache_by_address[address].get(key) is not None:
del self._volume_cache_by_address[address][key]

def get(self, address, key):
logger.debug("getting {} from cache".format(key))
with self._cache_lock:
return self._volume_cache_by_address[address].get(key)

def add_or_delete(self, address, key, value):
with self._cache_lock:
if self._volume_cache_by_address[address].get(key) is None:
logger.debug("adding {} to cache".format(key))
self._volume_cache_by_address[address][key] = value
else:
logger.debug("removing {} from cache".format(key))
del self._volume_cache_by_address[address][key]


volume_cache_by_address = VolumeCacheByAddress()


class VolumeCache:
def __init__(self, service_address):
self._service_address = service_address

def add(self, key, value):
volume_cache_by_address.add(self._service_address, key, value)

def remove(self, key):
volume_cache_by_address.remove(self._service_address, key)

def get(self, key):
return volume_cache_by_address.get(self._service_address, key)

def add_or_delete(self, key, value):
volume_cache_by_address.add_or_delete(self._service_address, key, value)
from collections import defaultdict
from threading import RLock

from controllers.common.csi_logger import get_stdout_logger

logger = get_stdout_logger()


class VolumeCacheByAddress:
def __init__(self):
logger.debug("creating a new cache")
self._volume_cache_by_address = defaultdict(dict)
self._cache_lock = RLock()

def add(self, address, key, value):
logger.debug("adding {} to cache".format(key))
with self._cache_lock:
self._volume_cache_by_address[address][key] = value

def remove(self, address, key):
logger.debug("removing {} from cache".format(key))
with self._cache_lock:
if self._volume_cache_by_address[address].get(key) is not None:
del self._volume_cache_by_address[address][key]

def get(self, address, key):
logger.debug("getting {} from cache".format(key))
with self._cache_lock:
return self._volume_cache_by_address[address].get(key)

def add_or_delete(self, address, key, value):
with self._cache_lock:
if self._volume_cache_by_address[address].get(key) is None:
logger.debug("adding {} to cache".format(key))
self._volume_cache_by_address[address][key] = value
else:
logger.debug("removing {} from cache".format(key))
del self._volume_cache_by_address[address][key]


volume_cache_by_address = VolumeCacheByAddress()


class VolumeCache:
def __init__(self, service_address):
self._service_address = service_address

def add(self, key, value):
volume_cache_by_address.add(self._service_address, key, value)

def remove(self, key):
volume_cache_by_address.remove(self._service_address, key)

def get(self, key):
return volume_cache_by_address.get(self._service_address, key)

def add_or_delete(self, key, value):
volume_cache_by_address.add_or_delete(self._service_address, key, value)
76 changes: 38 additions & 38 deletions controllers/array_action/utils.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import encodings

from controllers.array_action.settings import WWN_OUI_END, WWN_VENDOR_IDENTIFIER_END, VENDOR_IDENTIFIER_LENGTH, \
NGUID_OUI_END
from controllers.common.csi_logger import get_stdout_logger

UTF_8 = encodings.utf_8.getregentry().name

logger = get_stdout_logger()


def convert_scsi_id_to_nguid(volume_id):
logger.debug("Converting scsi uuid : {} to nguid".format(volume_id))
oui = volume_id[1:WWN_OUI_END]
vendor_identifier = volume_id[WWN_OUI_END:WWN_VENDOR_IDENTIFIER_END]
vendor_identifier_extension = volume_id[WWN_VENDOR_IDENTIFIER_END:]
final_nguid = ''.join((vendor_identifier_extension, oui, '0', vendor_identifier))
logger.debug("Nguid is : {}".format(final_nguid))
return final_nguid


def convert_nguid_to_scsi_id(volume_id):
logger.debug("Converting nguid : {} to scsi uuid".format(volume_id))
oui = volume_id[WWN_VENDOR_IDENTIFIER_END:NGUID_OUI_END]
vendor_identifier = volume_id[-VENDOR_IDENTIFIER_LENGTH:]
vendor_identifier_extension = volume_id[:WWN_VENDOR_IDENTIFIER_END]
final_scsi_id = ''.join((oui, vendor_identifier, vendor_identifier_extension))
logger.debug("scsi uuid is : {}".format(final_scsi_id))
return final_scsi_id


class ClassProperty:

def __init__(self, function):
self._function = function

def __get__(self, instance, owner):
return self._function(owner)
import encodings

from controllers.array_action.settings import WWN_OUI_END, WWN_VENDOR_IDENTIFIER_END, VENDOR_IDENTIFIER_LENGTH, \
NGUID_OUI_END
from controllers.common.csi_logger import get_stdout_logger

UTF_8 = encodings.utf_8.getregentry().name

logger = get_stdout_logger()


def convert_scsi_id_to_nguid(volume_id):
logger.debug("Converting scsi uuid : {} to nguid".format(volume_id))
oui = volume_id[1:WWN_OUI_END]
vendor_identifier = volume_id[WWN_OUI_END:WWN_VENDOR_IDENTIFIER_END]
vendor_identifier_extension = volume_id[WWN_VENDOR_IDENTIFIER_END:]
final_nguid = ''.join((vendor_identifier_extension, oui, '0', vendor_identifier))
logger.debug("Nguid is : {}".format(final_nguid))
return final_nguid


def convert_nguid_to_scsi_id(volume_id):
logger.debug("Converting nguid : {} to scsi uuid".format(volume_id))
oui = volume_id[WWN_VENDOR_IDENTIFIER_END:NGUID_OUI_END]
vendor_identifier = volume_id[-VENDOR_IDENTIFIER_LENGTH:]
vendor_identifier_extension = volume_id[:WWN_VENDOR_IDENTIFIER_END]
final_scsi_id = ''.join((oui, vendor_identifier, vendor_identifier_extension))
logger.debug("scsi uuid is : {}".format(final_scsi_id))
return final_scsi_id


class ClassProperty:

def __init__(self, function):
self._function = function

def __get__(self, instance, owner):
return self._function(owner)
22 changes: 11 additions & 11 deletions controllers/common/config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os.path

import yaml
from munch import DefaultMunch

_this_file_path = os.path.abspath(os.path.dirname(__file__))
_config_path = os.path.join(_this_file_path, "../../common/config.yaml")

with open(_config_path, 'r', encoding="utf-8") as yamlfile:
_cfg = yaml.safe_load(yamlfile)
config = DefaultMunch.fromDict(_cfg)
import os.path

import yaml
from munch import DefaultMunch

_this_file_path = os.path.abspath(os.path.dirname(__file__))
_config_path = os.path.join(_this_file_path, "../../common/config.yaml")

with open(_config_path, 'r', encoding="utf-8") as yamlfile:
_cfg = yaml.safe_load(yamlfile)
config = DefaultMunch.fromDict(_cfg)
6 changes: 3 additions & 3 deletions controllers/scripts/csi_general/setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import setuptools

setuptools.setup(name='csi_general', packages=['csi_general'])
import setuptools

setuptools.setup(name='csi_general', packages=['csi_general'])
Loading

0 comments on commit bb44dbb

Please sign in to comment.