Exemple #1
0
    def check_param(self):
        conf = self.configuration

        if conf.hitachi_unit_name and conf.hitachi_serial_number:
            msg = basic_lib.output_err(604)
            raise exception.HBSDError(message=msg)

        if not conf.hitachi_unit_name and not conf.hitachi_serial_number:
            msg = basic_lib.output_err(605)
            raise exception.HBSDError(message=msg)

        if conf.hitachi_pool_id is None:
            msg = basic_lib.output_err(601, param='hitachi_pool_id')
            raise exception.HBSDError(message=msg)

        for param in PARAM_RANGE.keys():
            _value = getattr(conf, param)
            if (_value and
                    (not PARAM_RANGE[param]['min'] <= _value <=
                     PARAM_RANGE[param]['max'])):
                msg = basic_lib.output_err(601, param=param)
                raise exception.HBSDError(message=msg)

        if conf.hitachi_default_copy_method not in COPY_METHOD:
            msg = basic_lib.output_err(601,
                                       param='hitachi_default_copy_method')
            raise exception.HBSDError(message=msg)

        if (conf.hitachi_default_copy_method == 'THIN'
                and conf.hitachi_thin_pool_id is None):
            msg = basic_lib.output_err(601, param='hitachi_thin_pool_id')
            raise exception.HBSDError(message=msg)

        for param in ('hitachi_ldev_range', 'hitachi_group_range'):
            if not getattr(conf, param):
                continue
            else:
                _value = self._range2list(conf, param)
                setattr(conf, param, _value)

        if conf.hitachi_target_ports:
            conf.hitachi_target_ports = conf.hitachi_target_ports.split(',')

        for opt in volume_opts:
            getattr(conf, opt.name)

        if conf.hitachi_unit_name:
            self.command = snm2.HBSDSNM2(conf)
        else:
            conf.append_config_values(horcm.volume_opts)
            self.command = horcm.HBSDHORCM(conf)
            self.command.check_param()
        self.pair_flock = self.command.set_pair_flock()
        self.horcmgr_flock = self.command.set_horcmgr_flock()
Exemple #2
0
 def setUp(self, arg1, arg2, arg3, arg4):
     super(HBSDHORCMFCDriverTest, self).setUp()
     self._setup_config()
     self._setup_driver()
     self.driver.check_param()
     self.driver.common.pair_flock = hbsd_basiclib.NopLock()
     self.driver.common.command = hbsd_horcm.HBSDHORCM(self.configuration)
     self.driver.common.command.horcmgr_flock = hbsd_basiclib.NopLock()
     self.driver.common.create_lock_file()
     self.driver.common.command.connect_storage()
     self.driver.max_hostgroups = \
         self.driver.common.command.get_max_hostgroups()
     self.driver.add_hostgroup()
     self.driver.output_param_to_log()
     self.driver.do_setup_status.set()