コード例 #1
0
ファイル: ssh_handler.py プロジェクト: PravinRanjan10/delfin
 def remove_alerts(self, alert_id):
     """Clear alert from storage system.
         Currently not implemented   removes command : removealert
     """
     ssh_client = SSHClient(**self.kwargs)
     command_str = SSHHandler.HPE3PAR_COMMAND_REMOVEALERT % alert_id
     res = ssh_client.do_exec(command_str)
     if res:
         if self.ALERT_NOT_EXIST_MSG not in res:
             raise exception.InvalidResults(six.text_type(res))
         LOG.warning("Alert %s doesn't exist.", alert_id)
コード例 #2
0
ファイル: ssh_handler.py プロジェクト: PravinRanjan10/delfin
 def get_all_alerts(self):
     """Get list of Hpe3parStor alerts
        return: all alerts
     """
     re = ''
     try:
         ssh_client = SSHClient(**self.kwargs)
         re = ssh_client.do_exec(SSHHandler.HPE3PAR_COMMAND_SHOWALERT)
     except Exception as e:
         LOG.error("Get all alerts error: %s", six.text_type(e))
         raise e
     return re
コード例 #3
0
ファイル: ssh_handler.py プロジェクト: PravinRanjan10/delfin
    def get_health_state(self):
        """Check the hardware and software health
           status of the storage system

           return: System is healthy
        """
        re = ''
        try:
            ssh_client = SSHClient(**self.kwargs)
            re = ssh_client.do_exec(SSHHandler.HPE3PAR_COMMAND_CHECKHEALTH)
        except Exception as e:
            LOG.error("Get health state error: %s", six.text_type(e))
            raise e
        return re
コード例 #4
0
ファイル: ssh_handler.py プロジェクト: PravinRanjan10/delfin
    def login(self, context):
        """Test SSH connection """
        version = ''
        try:
            ssh_client = SSHClient(**self.kwargs)
            re = ssh_client.do_exec(SSHHandler.HPE3PAR_COMMAND_SHOWWSAPI)
            wsapi_infos = re.split('\n')
            if len(wsapi_infos) > 1:
                version = self.get_version(wsapi_infos)

        except Exception as e:
            LOG.error("Login error: %s", six.text_type(e))
            raise e
        return version
コード例 #5
0
ファイル: hpe_3parstor.py プロジェクト: merliyatf/delfin
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     # init rest client
     self.restclient = rest_client.RestClient(**kwargs)
     self.restclient.login()
     # init ssh client
     self.sshclient = SSHClient(**kwargs)
     self.version = self.sshclient.login(context)
     # init component handler
     self.comhandler = component_handler.ComponentHandler(
         restclient=self.restclient, sshclient=self.sshclient)
     # init component handler
     self.alert_handler = alert_handler.AlertHandler(
         restclient=self.restclient, sshclient=self.sshclient)
コード例 #6
0
ファイル: hpe_3parstor.py プロジェクト: merliyatf/delfin
class Hpe3parStorDriver(driver.StorageDriver):
    """Hpe3parStorDriver implement Hpe 3par Stor driver,
    """
    # ssh command
    hpe3par_command_checkhealth = 'checkhealth'  # return: System is healthy

    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        # init rest client
        self.restclient = rest_client.RestClient(**kwargs)
        self.restclient.login()
        # init ssh client
        self.sshclient = SSHClient(**kwargs)
        self.version = self.sshclient.login(context)
        # init component handler
        self.comhandler = component_handler.ComponentHandler(
            restclient=self.restclient, sshclient=self.sshclient)
        # init component handler
        self.alert_handler = alert_handler.AlertHandler(
            restclient=self.restclient, sshclient=self.sshclient)

    def get_storage(self, context):
        # get storage info
        return self.comhandler.get_storage(context)

    def list_storage_pools(self, context):
        # Get list of Hpe3parStor pool details
        self.comhandler.set_storage_id(self.storage_id)
        return self.comhandler.list_storage_pools(context)

    def list_volumes(self, context):
        self.comhandler.set_storage_id(self.storage_id)
        return self.comhandler.list_volumes(context)

    def list_alerts(self, context):
        # Get list of Hpe3parStor alerts
        return self.alert_handler.list_alerts(context)

    def add_trap_config(self, context, trap_config):
        pass

    def remove_trap_config(self, context, trap_config):
        pass

    def parse_alert(self, context, alert):
        return self.alert_handler.parse_alert(context, alert)

    def clear_alert(self, context, alert):
        return self.alert_handler.clear_alert(context, self.sshclient, alert)