コード例 #1
0
ファイル: hbsd_snm2.py プロジェクト: ebalduf/cinder-backports
    def _wait_for_exec_hsnm(self, args, printflag, noretry, timeout, start):
        lock = basic_lib.get_process_lock(self.hsnm_lock_file)
        with self.hsnm_lock, lock:
            ret, stdout, stderr = self.exec_command('env', args=args,
                                                    printflag=printflag)

        if not ret or noretry:
            raise loopingcall.LoopingCallDone((ret, stdout, stderr))

        if time.time() - start >= timeout:
            LOG.error("snm2 command timeout.")
            raise loopingcall.LoopingCallDone((ret, stdout, stderr))

        if (re.search('DMEC002047', stderr)
                or re.search('DMEC002048', stderr)
                or re.search('DMED09000A', stderr)
                or re.search('DMED090026', stderr)
                or re.search('DMED0E002B', stderr)
                or re.search('DMER03006A', stderr)
                or re.search('DMER030080', stderr)
                or re.search('DMER0300B8', stderr)
                or re.search('DMER0800CF', stderr)
                or re.search('DMER0800D[0-6D]', stderr)
                or re.search('DMES052602', stderr)):
            LOG.error("Unexpected error occurs in snm2.")
            raise loopingcall.LoopingCallDone((ret, stdout, stderr))
コード例 #2
0
    def _wait_for_exec_hsnm(self, args, printflag, noretry, timeout, start):
        lock = basic_lib.get_process_lock(self.hsnm_lock_file)
        with self.hsnm_lock, lock:
            ret, stdout, stderr = self.exec_command('env',
                                                    args=args,
                                                    printflag=printflag)

        if not ret or noretry:
            raise loopingcall.LoopingCallDone((ret, stdout, stderr))

        if time.time() - start >= timeout:
            LOG.error(_LE("snm2 command timeout."))
            raise loopingcall.LoopingCallDone((ret, stdout, stderr))

        if (re.search('DMEC002047', stderr) or re.search('DMEC002048', stderr)
                or re.search('DMED09000A', stderr)
                or re.search('DMED090026', stderr)
                or re.search('DMED0E002B', stderr)
                or re.search('DMER03006A', stderr)
                or re.search('DMER030080', stderr)
                or re.search('DMER0300B8', stderr)
                or re.search('DMER0800CF', stderr)
                or re.search('DMER0800D[0-6D]', stderr)
                or re.search('DMES052602', stderr)):
            LOG.error(_LE("Unexpected error occurs in snm2."))
            raise loopingcall.LoopingCallDone((ret, stdout, stderr))
コード例 #3
0
    def _wait_for_exec_hsnm(self, args, printflag, noretry, timeout, start):
        lock = basic_lib.get_process_lock(self.hsnm_lock_file)
        with nested(self.hsnm_lock, lock):
            ret, stdout, stderr = self.exec_command("env", args=args, printflag=printflag)

        if not ret or noretry:
            raise loopingcall.LoopingCallDone((ret, stdout, stderr))

        if time.time() - start >= timeout:
            LOG.error(_LE("snm2 command timeout."))
            raise loopingcall.LoopingCallDone((ret, stdout, stderr))

        if (
            re.search("DMEC002047", stderr)
            or re.search("DMEC002048", stderr)
            or re.search("DMED09000A", stderr)
            or re.search("DMED090026", stderr)
            or re.search("DMED0E002B", stderr)
            or re.search("DMER03006A", stderr)
            or re.search("DMER030080", stderr)
            or re.search("DMER0300B8", stderr)
            or re.search("DMER0800CF", stderr)
            or re.search("DMER0800D[0-6D]", stderr)
            or re.search("DMES052602", stderr)
        ):
            LOG.error(_LE("Unexpected error occurs in snm2."))
            raise loopingcall.LoopingCallDone((ret, stdout, stderr))
コード例 #4
0
    def output_param_to_log(self):
        lock = basic_lib.get_process_lock(self.common.system_lock_file)

        with lock:
            self.common.output_param_to_log("iSCSI")
            for opt in volume_opts:
                if not opt.secret:
                    value = getattr(self.configuration, opt.name)
                    LOG.info(_LI("\t%(name)-35s : %(value)s"), {"name": opt.name, "value": value})
コード例 #5
0
    def output_param_to_log(self):
        lock = basic_lib.get_process_lock(self.common.system_lock_file)

        with lock:
            self.common.output_param_to_log('iSCSI')
            for opt in volume_opts:
                if not opt.secret:
                    value = getattr(self.configuration, opt.name)
                    LOG.info('\t%-35s%s' % (opt.name + ': ',
                             six.text_type(value)))
コード例 #6
0
    def output_param_to_log(self):
        lock = basic_lib.get_process_lock(self.common.system_lock_file)

        with lock:
            self.common.output_param_to_log('iSCSI')
            for opt in volume_opts:
                if not opt.secret:
                    value = getattr(self.configuration, opt.name)
                    LOG.info('\t%-35s%s' %
                             (opt.name + ': ', six.text_type(value)))
コード例 #7
0
ファイル: hbsd_common.py プロジェクト: Qeas/cinder
    def _create_volume(self, size, is_vvol=False):
        ldev_range = self.configuration.hitachi_ldev_range
        if not ldev_range:
            ldev_range = DEFAULT_LDEV_RANGE
        pool_id = self.configuration.hitachi_pool_id

        lock = basic_lib.get_process_lock(self.storage_lock_file)
        with nested(self.storage_obj_lock, lock):
            ldev = self.create_ldev(size, ldev_range, pool_id, is_vvol)
        return ldev
コード例 #8
0
    def _create_volume(self, size, is_vvol=False):
        ldev_range = self.configuration.hitachi_ldev_range
        if not ldev_range:
            ldev_range = DEFAULT_LDEV_RANGE
        pool_id = self.configuration.hitachi_pool_id

        lock = basic_lib.get_process_lock(self.storage_lock_file)
        with self.storage_obj_lock, lock:
            ldev = self.create_ldev(size, ldev_range, pool_id, is_vvol)
        return ldev
コード例 #9
0
    def output_param_to_log(self):
        lock = basic_lib.get_process_lock(self.common.system_lock_file)

        with lock:
            self.common.output_param_to_log('iSCSI')
            for opt in volume_opts:
                if not opt.secret:
                    value = getattr(self.configuration, opt.name)
                    LOG.info('\t%(name)-35s : %(value)s',
                             {'name': opt.name, 'value': value})
コード例 #10
0
    def output_param_to_log(self):
        lock = basic_lib.get_process_lock(self.common.system_lock_file)

        with lock:
            self.common.output_param_to_log('iSCSI')
            for opt in volume_opts:
                if not opt.secret:
                    value = getattr(self.configuration, opt.name)
                    LOG.info('\t%(name)-35s : %(value)s', {
                        'name': opt.name,
                        'value': value
                    })
コード例 #11
0
    def do_setup(self, context):
        self.context = context
        self.common = common.HBSDCommon(self.configuration, self, context, self.db)

        self.check_param()

        self.common.create_lock_file()

        self.common.command.connect_storage()

        lock = basic_lib.get_process_lock(self.common.service_lock_file)
        with lock:
            self.add_hostgroup()

        self.output_param_to_log()
        self.do_setup_status.set()
コード例 #12
0
    def do_setup(self, context):
        self.context = context
        self.common = common.HBSDCommon(self.configuration, self, context,
                                        self.db)

        self.check_param()

        self.common.create_lock_file()

        self.common.command.connect_storage()

        lock = basic_lib.get_process_lock(self.common.service_lock_file)
        with lock:
            self.add_hostgroup()

        self.output_param_to_log()
        self.do_setup_status.set()
コード例 #13
0
    def do_setup(self, context):
        self.context = context
        self.common = common.HBSDCommon(self.configuration, self, context,
                                        self.db)
        msg = _("The HBSD iSCSI driver is deprecated and "
                "will be removed in P release")
        versionutils.report_deprecated_feature(LOG, msg)

        self.check_param()

        self.common.create_lock_file()

        self.common.command.connect_storage()

        lock = basic_lib.get_process_lock(self.common.service_lock_file)
        with lock:
            self.add_hostgroup()

        self.output_param_to_log()
        self.do_setup_status.set()
コード例 #14
0
    def do_setup(self, context):
        self.context = context
        self.common = common.HBSDCommon(self.configuration, self,
                                        context, self.db)
        msg = _("The HBSD iSCSI driver is deprecated and "
                "will be removed in P release")
        versionutils.report_deprecated_feature(LOG, msg)

        self.check_param()

        self.common.create_lock_file()

        self.common.command.connect_storage()

        lock = basic_lib.get_process_lock(self.common.service_lock_file)
        with lock:
            self.add_hostgroup()

        self.output_param_to_log()
        self.do_setup_status.set()
コード例 #15
0
    def _wait_for_add_chap_user(self, cmd, auth_username, auth_password, start):
        # Don't move 'import pexpect' to the beginning of the file so that
        # a tempest can work.
        import pexpect

        lock = basic_lib.get_process_lock(self.hsnm_lock_file)
        with nested(self.hsnm_lock, lock):
            try:
                child = pexpect.spawn(cmd)
                child.expect("Secret: ", timeout=CHAP_TIMEOUT)
                child.sendline(auth_password)
                child.expect("Re-enter Secret: ", timeout=CHAP_TIMEOUT)
                child.sendline(auth_password)
                child.expect("The CHAP user information has " "been added successfully.", timeout=CHAP_TIMEOUT)
            except Exception:
                if time.time() - start >= EXEC_TIMEOUT:
                    msg = basic_lib.output_err(642, user=auth_username)
                    raise exception.HBSDError(message=msg)
            else:
                raise loopingcall.LoopingCallDone(True)
コード例 #16
0
    def _wait_for_add_chap_user(self, cmd, auth_username, auth_password,
                                start):
        # Don't move 'import pexpect' to the beginning of the file so that
        # a tempest can work.
        import pexpect

        lock = basic_lib.get_process_lock(self.hsnm_lock_file)
        with self.hsnm_lock, lock:
            try:
                child = pexpect.spawn(cmd)
                child.expect('Secret: ', timeout=CHAP_TIMEOUT)
                child.sendline(auth_password)
                child.expect('Re-enter Secret: ', timeout=CHAP_TIMEOUT)
                child.sendline(auth_password)
                child.expect(
                    'The CHAP user information has '
                    'been added successfully.',
                    timeout=CHAP_TIMEOUT)
            except Exception:
                if time.time() - start >= EXEC_TIMEOUT:
                    msg = basic_lib.output_err(642, user=auth_username)
                    raise exception.HBSDError(message=msg)
            else:
                raise loopingcall.LoopingCallDone(True)
コード例 #17
0
ファイル: hbsd_common.py プロジェクト: Qeas/cinder
 def add_lun(self, command, hostgroups, ldev, is_once=False):
     lock = basic_lib.get_process_lock(self.storage_lock_file)
     with lock:
         self.command.comm_add_lun(command, hostgroups, ldev, is_once)
コード例 #18
0
 def add_lun(self, command, hostgroups, ldev, is_once=False):
     lock = basic_lib.get_process_lock(self.storage_lock_file)
     with lock:
         self.command.comm_add_lun(command, hostgroups, ldev, is_once)