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

Initialize the HNAS driver #277

Merged
merged 3 commits into from
Oct 25, 2021
Merged
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
Empty file.
89 changes: 89 additions & 0 deletions delfin/drivers/hitachi/hnas/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Copyright 2021 The SODA Authors.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import re

from delfin.common import constants

PATTERN = re.compile('[-]{3,}')
STORAGE_VENDOR = 'HITACHI'
TIME_TYPE = '%Y-%m-%d %H:%M:%S'

OID_TRAP_DATA = '1.3.6.1.4.1.11096.6.1.1'

STORAGE_INFO_COMMAND = "cluster-show"
STORAGE_MODEL_COMMAND = "ver"
LOCATION_COMMAND = 'system-information-get'

DISK_INFO_COMMAND = "sd-list --scsi"

POOL_INFO_COMMAND = "span-list"
POOL_SIZE_COMMAND = "span-space-distribution"

CONTROLLER_INFO_COMMAND = "cluster-show -y"

ALERT_INFO_COMMAND = "event-log-show -w -s"

FC_PORT_COMMAND = "fc-hports"
FC_SPEED_COMMAND = "fc-link-speed"
ETH_PORT_COMMAND = "ifconfig"

FS_INFO_COMMAND = 'df -k'
FS_STATUS_COMMAND = 'filesystem-list'

CHECK_EVS = 'evs-select %s'
QUOTA_INFO_COMMAND = "quota list %s"

TREE_INFO_COMMAND = 'virtual-volume list --verbose %s'

CIFS_SHARE_COMMAND = 'cifs-share list'

NFS_SHARE_COMMAND = "nfs-export list"

CLUSTER_STATUS = {
'Robust': constants.StorageStatus.NORMAL,
'Degraded': constants.StorageStatus.ABNORMAL,
'Critical': constants.StorageStatus.ABNORMAL,
'OK': constants.StorageStatus.NORMAL,
'Failure(s)': constants.StorageStatus.ABNORMAL
}

SEVERITY_MAP = {
'Severe': constants.Severity.FATAL,
'Warning': constants.Severity.WARNING,
'Information': constants.Severity.INFORMATIONAL
}

FS_STATUS_MAP = {
'Fail!': constants.FilesystemStatus.FAULTY,
'OK': constants.FilesystemStatus.NORMAL,
'NoEVS': constants.FilesystemStatus.NORMAL,
'EVS-D': constants.FilesystemStatus.NORMAL,
'Hiddn': constants.FilesystemStatus.NORMAL,
'Clust': constants.FilesystemStatus.FAULTY,
'Unavl': constants.FilesystemStatus.NORMAL,
'Check': constants.FilesystemStatus.NORMAL,
'Fixng': constants.FilesystemStatus.NORMAL,
'Mount': constants.FilesystemStatus.NORMAL,
'MntRO': constants.FilesystemStatus.NORMAL,
'SysLk': constants.FilesystemStatus.NORMAL,
'SysRO': constants.FilesystemStatus.NORMAL,
'RepTg': constants.FilesystemStatus.NORMAL,
'Rcvry': constants.FilesystemStatus.NORMAL,
'UnMnt': constants.FilesystemStatus.FAULTY,
'Mntg': constants.FilesystemStatus.NORMAL,
'Formt': constants.FilesystemStatus.NORMAL,
'Failg': constants.FilesystemStatus.FAULTY,
None: constants.FilesystemStatus.NORMAL,
}
85 changes: 85 additions & 0 deletions delfin/drivers/hitachi/hnas/hds_nas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Copyright 2021 The SODA Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from delfin.drivers import driver
from delfin.drivers.hitachi.hnas import nas_handler


class HitachiHNasDriver(driver.StorageDriver):

def __init__(self, **kwargs):
super().__init__(**kwargs)
self.nas_handler = nas_handler.NasHandler(**kwargs)
self.nas_handler.login()

def reset_connection(self, context, **kwargs):
self.nas_handler.login()

def get_storage(self, context):
return self.nas_handler.get_storage()

def list_storage_pools(self, context):
return self.nas_handler.get_pool(self.storage_id)

def list_volumes(self, context):
pass

def list_controllers(self, context):
return self.nas_handler.list_controllers(self.storage_id)

def list_ports(self, context):
return self.nas_handler.list_ports(self.storage_id)

def list_disks(self, context):
return self.nas_handler.get_disk(self.storage_id)

def list_alerts(self, context, query_para=None):
return self.nas_handler.list_alerts(query_para)

def list_qtrees(self, context):
return self.nas_handler.list_qtrees(self.storage_id)

def list_quotas(self, context):
return self.nas_handler.list_quotas(self.storage_id)

def list_filesystems(self, context):
return self.nas_handler.list_filesystems(self.storage_id)

def list_shares(self, context):
return self.nas_handler.list_shares(self.storage_id)

def add_trap_config(self, context, trap_config):
pass

def remove_trap_config(self, context, trap_config):
pass

@staticmethod
def parse_alert(context, alert):
return nas_handler.NasHandler.parse_alert(alert)

def clear_alert(self, context, alert):
pass

@staticmethod
def get_access_url():
return 'https://{ip}'

def collect_perf_metrics(self, context, storage_id,
resource_metrics, start_time, end_time):
pass

@staticmethod
def get_capabilities(context):
pass
Loading