Exemplo n.º 1
0
    def disks(self,
              search_key=None,
              search_value=None,
              flags=Client.FLAG_RSVD):

        rc_lsm_disks = []
        controllerList = []

        getconfig_disks_info = []
        total_cntrl = self._get_arcconf_controllers_count()
        sys_id = ''

        for cntrl in range(total_cntrl):
            sys_id = cntrl + 1
            cntrl_num = int(cntrl + 1)
            disks_info = self._arcconf_exec(["getconfigJSON", str(cntrl + 1)])
            disk_info_json = disks_info.split("\n")[1]
            decoded_json = json.loads(disk_info_json)

            for channel in range(len(decoded_json['Controller']['Channel'])):
                if 'HardDrive' in decoded_json['Controller']['Channel'][
                        channel]:
                    hd_disks_num = len(decoded_json['Controller']['Channel']
                                       [channel]['HardDrive'])
                    if hd_disks_num > 0:
                        for hd_disk in range(hd_disks_num):

                            rc_lsm_disks.append(
                                Arcconf._arcconf_disk_to_lsm_disk(
                                    decoded_json['Controller']['Channel']
                                    [channel]['HardDrive'][hd_disk], sys_id,
                                    cntrl_num))

        return search_property(rc_lsm_disks, search_key, search_value)
Exemplo n.º 2
0
    def volumes(self,
                search_key=None,
                search_value=None,
                flags=Client.FLAG_RSVD):
        """
        """
        lsm_vols = []
        getconfig_cntrls_info = self._get_detail_info_list()
        consumer_array_id = ''
        cntrl = 0

        for decoded_json in getconfig_cntrls_info:
            sys_id = decoded_json['Controller']['serialNumber']
            arcconf_ctrl_num = str(cntrl + 1)
            cntrl += 1

            if 'LogicalDrive' in decoded_json['Controller']:
                ld_infos = decoded_json['Controller']['LogicalDrive']
                num_lds = len(ld_infos)
                for ld in range(num_lds):
                    ld_info = ld_infos[ld]
                    chunk_data = ld_info['Chunk']
                    for array_id in chunk_data:
                        # consumerArrayID in all the chunk will be same
                        consumer_array_id = array_id['consumerArrayID']
                    lsm_vol = Arcconf._arcconf_ld_to_lsm_vol(
                        ld_info, consumer_array_id, sys_id, arcconf_ctrl_num)
                    lsm_vols.append(lsm_vol)

        return search_property(lsm_vols, search_key, search_value)
Exemplo n.º 3
0
    def disks(self, search_key=None, search_value=None,
              flags=Client.FLAG_RSVD):

        rc_lsm_disks = []

        getconfig_cntrls_info = self._get_detail_info_list()
        sys_id = ''
        cntrl = 0

        for decoded_json in getconfig_cntrls_info:
            sys_id = cntrl + 1
            cntrl_num = int(cntrl + 1)
            cntrl += 1

            for channel in range(len(decoded_json['Controller']['Channel'])):
                channel_range = decoded_json['Controller']['Channel'][channel]
                if 'HardDrive' in channel_range:
                    hd_disks_num = len(channel_range['HardDrive'])
                    if hd_disks_num > 0:
                        for hd_disk in range(hd_disks_num):
                            arcconf_disk = \
                                channel_range['HardDrive'][hd_disk]
                            rc_lsm_disks.append(
                                Arcconf._arcconf_disk_to_lsm_disk(
                                    arcconf_disk, sys_id, cntrl_num))

        return search_property(rc_lsm_disks, search_key, search_value)
Exemplo n.º 4
0
 def fs(self, search_key=None, search_value=None, flags=0):
     rc = []
     for fs in self._jsonrequest("fs_list"):
         # self, id, name, total_space, free_space, pool_id, system_id
         rc.append(FileSystem(fs['uuid'], fs['name'], fs['total_space'],
                              fs['free_space'], fs['pool'], self.system.id))
     return search_property(rc, search_key, search_value)
Exemplo n.º 5
0
    def access_groups(self, search_key=None, search_value=None, flags=0):
        rc_lsm_ags = []

        # For backward compatibility
        if self._flag_ag_support is True:
            tgt_inits = self._jsonrequest(
                'initiator_list', {'standalone_only': True})
        else:
            tgt_inits = list(
                {'init_id': x}
                for x in set(
                    i['initiator_wwn']
                    for i in self._jsonrequest("export_list")))

        rc_lsm_ags.extend(
            list(
                TargetdStorage._tgt_init_to_lsm(i, self.system.id)
                for i in tgt_inits))

        if self._flag_ag_support is True:
            for tgt_ag in self._jsonrequest('access_group_list'):
                rc_lsm_ags.append(
                    TargetdStorage._tgt_ag_to_lsm(
                        tgt_ag, self.system.id))

        return search_property(rc_lsm_ags, search_key, search_value)
Exemplo n.º 6
0
    def volumes(self, search_key=None, search_value=None,
                flags=Client.FLAG_RSVD):
        """
        Depend on command:
            hpssacli ctrl all show config detail
        """
        lsm_vols = []
        ctrl_all_conf = self._sacli_exec(
            ["ctrl", "all", "show", "config", "detail"])
        for ctrl_data in ctrl_all_conf.values():
            ctrl_num = ctrl_data['Slot']
            sys_id = _sys_id_of_ctrl_data(ctrl_data)
            for key_name in ctrl_data.keys():
                if not key_name.startswith("Array:"):
                    continue
                pool_id = _pool_id_of(sys_id, key_name)
                array_num = key_name[len('Array: '):]
                for array_key_name in ctrl_data[key_name].keys():
                    if not array_key_name.startswith("Logical Drive"):
                        continue

                    try:
                        lsm_vol = SmartArray._hp_ld_to_lsm_vol(
                           ctrl_data[key_name][array_key_name],
                           pool_id, sys_id, ctrl_num, array_num,
                           array_key_name)
                    except DeviceNotFoundError:
                        pass
                    else:
                        lsm_vols.append(lsm_vol)

        return search_property(lsm_vols, search_key, search_value)
Exemplo n.º 7
0
    def pools(self,
              search_key=None,
              search_value=None,
              flags=Client.FLAG_RSVD):
        lsm_pools = []
        total_cntrl = self._get_arcconf_controllers_count()
        sys_id = ''

        for cntrl in range(total_cntrl):
            cntrl_num = str(int(cntrl + 1))
            sys_id = cntrl_num

            disks_info = self._arcconf_exec(["getconfigJSON", str(cntrl + 1)])
            disk_info_json = disks_info.split("\n")[1]
            decoded_json = json.loads(disk_info_json)

            if 'LogicalDrive' in decoded_json['Controller']:
                for ld in range(len(
                        decoded_json['Controller']['LogicalDrive'])):
                    lsm_pools.append(
                        Arcconf._arcconf_array_to_lsm_pool(
                            decoded_json['Controller']['LogicalDrive'][ld]
                            ['logicalDriveID'], decoded_json['Controller']
                            ['LogicalDrive'][ld]['logicalDriveID'], sys_id,
                            cntrl_num))
        return search_property(lsm_pools, search_key, search_value)
Exemplo n.º 8
0
    def volumes(self, search_key=None, search_value=None, flags=0):
        """
        Returns an array of volume objects

        """
        vol_list = []
        lu_list = self._request("get_names", "zvol", [""])

        #        lu_list = self._ns_request('rest/nms',
        #            {"method": "get_lu_list",
        #             "object": "scsidisk",
        #             "params": ['']})
        for lu in lu_list:
            try:
                lu_props = self._request("get_lu_props", "scsidisk", [lu])
            except:
                lu_props = {'guid': '', 'state': 'N/A'}

            zvol_props = self._request("get_child_props", "zvol", [lu, ""])

            block_size = NexentaStor._to_bytes(zvol_props['volblocksize'])
            size_bytes = int(zvol_props['size_bytes'])
            num_of_blocks = size_bytes / block_size
            admin_state = Volume.ADMIN_STATE_ENABLED

            vol_list.append(
                Volume(lu, lu, lu_props['guid'].lower(),
                       block_size, num_of_blocks,
                       admin_state, self.system.id,
                       NexentaStor._get_pool_id(lu)))

        return search_property(vol_list, search_key, search_value)
Exemplo n.º 9
0
 def fs(self, search_key=None, search_value=None, flags=0):
     rc = []
     for fs in self._jsonrequest("fs_list"):
         # self, id, name, total_space, free_space, pool_id, system_id
         rc.append(FileSystem(fs['uuid'], fs['name'], fs['total_space'],
                              fs['free_space'], fs['pool'], self.system.id))
     return search_property(rc, search_key, search_value)
Exemplo n.º 10
0
    def volumes(self,
                search_key=None,
                search_value=None,
                flags=Client.FLAG_RSVD):
        lsm_vols = []
        for ctrl_num in range(self._ctrl_count()):
            vol_show_output = self._storcli_exec(
                ["/c%d/vall" % ctrl_num, "show", "all"])
            sys_id = self._sys_id_of_ctrl_num(ctrl_num)
            if vol_show_output is None or len(vol_show_output) == 0:
                continue
            for key_name in list(vol_show_output.keys()):
                if key_name.startswith('/c'):
                    vd_basic_info = vol_show_output[key_name][0]
                    (dg_id, vd_id) = vd_basic_info['DG/VD'].split('/')
                    dg_id = int(dg_id)
                    vd_id = int(vd_id)
                    vd_pd_info_list = vol_show_output['PDs for VD %d' % vd_id]

                    vd_prop_info = vol_show_output['VD%d Properties' % vd_id]

                    lsm_vols.append(
                        MegaRAID._vd_to_lsm_vol(vd_id, dg_id, sys_id,
                                                vd_basic_info, vd_pd_info_list,
                                                vd_prop_info, key_name))

        return search_property(lsm_vols, search_key, search_value)
Exemplo n.º 11
0
    def pools(self,
              search_key=None,
              search_value=None,
              flags=Client.FLAG_RSVD):
        lsm_pools = []
        getconfig_cntrls_info = self._get_detail_info_list()
        cntrl = 0

        for decoded_json in getconfig_cntrls_info:
            sys_id = decoded_json['Controller']['serialNumber']
            arcconf_ctrl_num = str(cntrl + 1)
            cntrl += 1

            if 'Array' in decoded_json['Controller']:
                array_infos = decoded_json['Controller']['Array']
                num_array = len(array_infos)
                arcconf_array = {}
                for array in range(num_array):
                    arcconf_array['arrayID'] = array_infos[array]['arrayID']
                    arcconf_array['arrayName'] = array_infos[array][
                        'arrayName']
                    arcconf_array['blockSize'] = array_infos[array][
                        'blockSize']
                    arcconf_array['totalSize'] = array_infos[array][
                        'totalSize']
                    arcconf_array['unUsedSpace'] = \
                        array_infos[array]['unUsedSpace']
                    arcconf_array['sys_id'] = sys_id
                    arcconf_array['ctrl_num'] = arcconf_ctrl_num
                    lsm_pools.append(
                        Arcconf._arcconf_array_to_lsm_pool(arcconf_array))
        return search_property(lsm_pools, search_key, search_value)
Exemplo n.º 12
0
    def volumes(self,
                search_key=None,
                search_value=None,
                flags=Client.FLAG_RSVD):
        _ = flags
        lsm_vols = []
        for ctrl_num in range(self._ctrl_count()):
            vol_show_output = self._storcli_exec(
                f"/c{ctrl_num:d}/vall show all")
            sys_id = self._sys_id_of_ctrl_num(ctrl_num)
            if vol_show_output is None or len(vol_show_output) == 0:
                continue
            for key_name in list(vol_show_output.keys()):
                if key_name.startswith("/c"):
                    vd_basic_info = vol_show_output[key_name][0]
                    (dg_id, vd_id) = vd_basic_info["DG/VD"].split("/")
                    dg_id = int(dg_id)
                    vd_id = int(vd_id)
                    vd_pd_info_list = vol_show_output[f"PDs for VD {vd_id:d}"]

                    vd_prop_info = vol_show_output[f"VD{vd_id:d} Properties"]

                    lsm_vols.append(
                        MegaRAID._vd_to_lsm_vol(
                            vd_id,
                            dg_id,
                            sys_id,
                            vd_basic_info,
                            vd_pd_info_list,
                            vd_prop_info,
                            key_name,
                        ), )

        return search_property(lsm_vols, search_key, search_value)
Exemplo n.º 13
0
    def batteries(self,
                  search_key=None,
                  search_value=None,
                  flags=Client.FLAG_RSVD):
        """
        Depending on these commands:
            storcli /c0/bbu show all J
            storcli /c0/cv show all J
        """
        lsm_bats = []
        for ctrl_num in range(self._ctrl_count()):
            ctrl_show_all_output = self._storcli_exec(
                ["/c%d" % ctrl_num, "show", "all"])
            sys_id = self._sys_id_of_ctrl_num(ctrl_num, ctrl_show_all_output)

            try:
                bbu_show_all_output = self._storcli_exec(
                    ["/c%d/bbu" % ctrl_num, "show", "all"])
            except ExecError as exec_error:
                bbu_show_all_output = None

            if bbu_show_all_output:
                lsm_bats.append(_mega_bbu_to_lsm(sys_id, bbu_show_all_output))

            # Capacitor
            try:
                cv_show_all_output = self._storcli_exec(
                    ["/c%d/cv" % ctrl_num, "show", "all"])
            except ExecError as exec_error:
                cv_show_all_output = None

            if cv_show_all_output:
                lsm_bats.append(_mega_cv_to_lsm(sys_id, cv_show_all_output))

        return search_property(lsm_bats, search_key, search_value)
Exemplo n.º 14
0
    def fs(self, search_key=None, search_value=None, flags=0):
        fs_list = self._request("get_all_names", "folder", [""])

        fss = []
        pools = {}
        for fs in fs_list:
            try:
                pool_name = NexentaStor._get_pool_id(fs)
                if pool_name == 'syspool':
                    continue
                if pool_name not in pools:
                    pool_info = self._request("get_child_props", "volume",
                                              [str(fs), ""])
                    pools[pool_name] = pool_info
                else:
                    pool_info = pools[pool_name]
                fss.append(
                    FileSystem(fs, fs,
                               NexentaStor._to_bytes(pool_info['size']),
                               self._to_bytes(pool_info['available']),
                               pool_name, self.system.id))
            except LsmError as e:
                error('nstor:fs: %s' % str(e))
                pass

        return search_property(fss, search_key, search_value)
Exemplo n.º 15
0
    def volumes(self, search_key=None, search_value=None,
                flags=Client.FLAG_RSVD):
        lsm_vols = []
        for ctrl_num in range(self._ctrl_count()):
            vol_show_output = self._storcli_exec(
                ["/c%d/vall" % ctrl_num, "show", "all"])
            sys_id = self._sys_id_of_ctrl_num(ctrl_num)
            if vol_show_output is None or len(vol_show_output) == 0:
                continue
            for key_name in vol_show_output.keys():
                if key_name.startswith('/c'):
                    vd_basic_info = vol_show_output[key_name][0]
                    (dg_id, vd_id) = vd_basic_info['DG/VD'].split('/')
                    dg_id = int(dg_id)
                    vd_id = int(vd_id)
                    vd_pd_info_list = vol_show_output['PDs for VD %d' % vd_id]

                    vd_prop_info = vol_show_output['VD%d Properties' % vd_id]

                    lsm_vols.append(
                        MegaRAID._vd_to_lsm_vol(
                            vd_id, dg_id, sys_id, vd_basic_info,
                            vd_pd_info_list, vd_prop_info, key_name))

        return search_property(lsm_vols, search_key, search_value)
Exemplo n.º 16
0
    def volumes(self,
                search_key=None,
                search_value=None,
                flags=Client.FLAG_RSVD):
        """
        Depend on command:
            hpssacli ctrl all show config detail
        """
        lsm_vols = []
        ctrl_all_conf = self._sacli_exec(
            ["ctrl", "all", "show", "config", "detail"])
        for ctrl_data in ctrl_all_conf.values():
            ctrl_num = ctrl_data['Slot']
            sys_id = ctrl_data['Serial Number']
            for key_name in ctrl_data.keys():
                if not key_name.startswith("Array:"):
                    continue
                pool_id = _pool_id_of(sys_id, key_name)
                array_num = key_name[len('Array: '):]
                for array_key_name in ctrl_data[key_name].keys():
                    if not array_key_name.startswith("Logical Drive"):
                        continue
                    lsm_vols.append(
                        SmartArray._hp_ld_to_lsm_vol(
                            ctrl_data[key_name][array_key_name], pool_id,
                            sys_id, ctrl_num, array_num, array_key_name))

        return search_property(lsm_vols, search_key, search_value)
Exemplo n.º 17
0
    def pools(self, search_key=None, search_value=None,
              flags=Client.FLAG_RSVD):
        lsm_pools = []
        for ctrl_num in range(self._ctrl_count()):
            cc_vd_ids = []
            cc_dg_ids = []
            dg_show_output = self._storcli_exec(
                ["/c%d/dall" % ctrl_num, "show", "all"])
            consist_check_output = self._storcli_exec(
                ["/c%d/vall" % ctrl_num, "show", "cc"])
            free_space_list = dg_show_output.get("FREE SPACE DETAILS", [])

            if "TOPOLOGY" not in dg_show_output:
                continue

            for vd_stat in consist_check_output["VD Operation Status"]:
                if vd_stat["Status"] == "In progress":
                    cc_vd_ids.append(int(vd_stat["VD"]))

            for vd in dg_show_output["VD LIST"]:
                (dg_id, vd_id) = vd["DG/VD"].split("/")
                if int(vd_id) in cc_vd_ids:
                    cc_dg_ids.append(int(dg_id))

            for dg_top in dg_show_output['TOPOLOGY']:
                if dg_top['Arr'] != '-':
                    continue
                if dg_top['DG'] == '-':
                    continue
                lsm_pools.append(
                    self._dg_top_to_lsm_pool(
                        dg_top, free_space_list, ctrl_num, dg_show_output,
                        int(dg_top['DG']) in cc_dg_ids))

        return search_property(lsm_pools, search_key, search_value)
Exemplo n.º 18
0
    def batteries(self, search_key=None, search_value=None,
                  flags=Client.FLAG_RSVD):
        lsm_bs = []
        ctrl_all_show = self._sacli_exec(
            ["ctrl", "all", "show", "config", "detail"])

        for ctrl_name in ctrl_all_show.keys():
            ctrl_data = ctrl_all_show[ctrl_name]
            bat_count = int(ctrl_data.get('Battery/Capacitor Count', 0))
            if bat_count == 0:
                continue

            sys_id = _sys_id_of_ctrl_data(ctrl_data)

            battery_status = _hp_battery_status_to_lsm(ctrl_data)

            if ctrl_data["Cache Backup Power Source"] == "Capacitors":
                battery_type = Battery.TYPE_CAPACITOR
            elif ctrl_data["Cache Backup Power Source"] == "Batteries":
                battery_type = Battery.TYPE_CHEMICAL
            else:
                battery_type = Battery.TYPE_UNKNOWN

            for counter in range(0, bat_count):
                lsm_bs.append(
                    Battery(
                        "%s_BAT_%d" % (sys_id, counter),
                        "Battery %d of %s" % (counter, ctrl_name),
                        battery_type, battery_status, sys_id,
                        _plugin_data=None))

        return search_property(lsm_bs, search_key, search_value)
Exemplo n.º 19
0
    def batteries(self, search_key=None, search_value=None,
                  flags=Client.FLAG_RSVD):
        """
        Depending on these commands:
            storcli /c0/bbu show all J
            storcli /c0/cv show all J
        """
        lsm_bats = []
        for ctrl_num in range(self._ctrl_count()):
            ctrl_show_all_output = self._storcli_exec(
                ["/c%d" % ctrl_num, "show", "all"])
            sys_id = self._sys_id_of_ctrl_num(ctrl_num, ctrl_show_all_output)

            try:
                bbu_show_all_output = self._storcli_exec(
                    ["/c%d/bbu" % ctrl_num, "show", "all"])
            except ExecError as exec_error:
                bbu_show_all_output = None

            if bbu_show_all_output:
                lsm_bats.append(_mega_bbu_to_lsm(sys_id, bbu_show_all_output))

            # Capacitor
            try:
                cv_show_all_output = self._storcli_exec(
                    ["/c%d/cv" % ctrl_num, "show", "all"])
            except ExecError as exec_error:
                cv_show_all_output = None

            if cv_show_all_output:
                lsm_bats.append(_mega_cv_to_lsm(sys_id, cv_show_all_output))

        return search_property(lsm_bats, search_key, search_value)
Exemplo n.º 20
0
    def disks(self, search_key=None, search_value=None,
              flags=Client.FLAG_RSVD):
        """
        Depend on command:
            hpssacli ctrl all show config detail
        """
        # TODO(Gris Ge): Need real test on spare disk.
        rc_lsm_disks = []
        ctrl_all_conf = self._sacli_exec(
            ["ctrl", "all", "show", "config", "detail"])
        for ctrl_data in ctrl_all_conf.values():
            sys_id = _sys_id_of_ctrl_data(ctrl_data)
            ctrl_num = ctrl_data['Slot']
            for key_name in ctrl_data.keys():
                if key_name.startswith("Array:"):
                    for array_key_name in ctrl_data[key_name].keys():
                        if array_key_name.startswith("physicaldrive"):
                            rc_lsm_disks.append(
                                SmartArray._hp_disk_to_lsm_disk(
                                    ctrl_data[key_name][array_key_name],
                                    sys_id, ctrl_num, array_key_name,
                                    flag_free=False))

                if key_name == 'unassigned' or key_name == 'HBA Drives':
                    for array_key_name in ctrl_data[key_name].keys():
                        if array_key_name.startswith("physicaldrive"):
                            rc_lsm_disks.append(
                                SmartArray._hp_disk_to_lsm_disk(
                                    ctrl_data[key_name][array_key_name],
                                    sys_id, ctrl_num, array_key_name,
                                    flag_free=True))

        return search_property(rc_lsm_disks, search_key, search_value)
Exemplo n.º 21
0
    def volumes(self, search_key=None, search_value=None,
                flags=Client.FLAG_RSVD):
        """
        """
        lsm_vols = []
        getconfig_cntrls_info = self._get_detail_info_list()

        pool_id = ''
        sys_id = ''
        cntrl = 0

        for decoded_json in getconfig_cntrls_info:
            sys_id = str(cntrl+1)
            cnt = int(cntrl + 1)
            cntrl += 1

            if 'LogicalDrive' in decoded_json['Controller']:
                ld_infos = decoded_json['Controller']['LogicalDrive']
                num_lds = len(ld_infos)
                for ld in range(num_lds):
                    ld_info = ld_infos[ld]
                    ld_num = ld_info['logicalDriveID']
                    ld_name = ld_info['name']
                    pool_id = '%s:%s' % (sys_id, ld_num)
                    lsm_vol = \
                        Arcconf._arcconf_ld_to_lsm_vol(ld_info, pool_id,
                                                       sys_id, cnt,
                                                       str(ld_num),
                                                       ld_name)
                    lsm_vols.append(lsm_vol)

        return search_property(lsm_vols, search_key, search_value)
Exemplo n.º 22
0
    def volumes(self, search_key=None, search_value=None, flags=0):
        """
        Returns an array of volume objects

        """
        vol_list = []
        lu_list = self._request("get_names", "zvol", [""])

        #        lu_list = self._ns_request('rest/nms',
        #            {"method": "get_lu_list",
        #             "object": "scsidisk",
        #             "params": ['']})
        for lu in lu_list:
            try:
                lu_props = self._request("get_lu_props", "scsidisk", [lu])
            except:
                lu_props = {'guid': '', 'state': 'N/A'}

            zvol_props = self._request("get_child_props", "zvol", [lu, ""])

            block_size = NexentaStor._to_bytes(zvol_props['volblocksize'])
            size_bytes = int(zvol_props['size_bytes'])
            num_of_blocks = int_div(size_bytes, block_size)
            admin_state = Volume.ADMIN_STATE_ENABLED

            vol_list.append(
                Volume(lu, lu, lu_props['guid'].lower(),
                       block_size, num_of_blocks,
                       admin_state, self.system.id,
                       NexentaStor._get_pool_id(lu)))

        return search_property(vol_list, search_key, search_value)
Exemplo n.º 23
0
    def access_groups(self, search_key=None, search_value=None, flags=0):
        rc_lsm_ags = []

        # For backward compatibility
        if self._flag_ag_support is True:
            tgt_inits = self._jsonrequest(
                'initiator_list', {'standalone_only': True})
        else:
            tgt_inits = list(
                {'init_id': x}
                for x in set(
                    i['initiator_wwn']
                    for i in self._jsonrequest("export_list")))

        rc_lsm_ags.extend(
            list(
                TargetdStorage._tgt_init_to_lsm(i, self.system.id)
                for i in tgt_inits))

        if self._flag_ag_support is True:
            for tgt_ag in self._jsonrequest('access_group_list'):
                rc_lsm_ags.append(
                    TargetdStorage._tgt_ag_to_lsm(
                        tgt_ag, self.system.id))

        return search_property(rc_lsm_ags, search_key, search_value)
Exemplo n.º 24
0
 def batteries(self,
               search_key=None,
               search_value=None,
               flags=Client.FLAG_RSVD):
     sim_batteries = self.sim_array.batteries()
     return search_property(
         [SimPlugin._sim_data_2_lsm(b) for b in sim_batteries], search_key,
         search_value)
Exemplo n.º 25
0
    def disks(self, search_key=None, search_value=None,
              flags=Client.FLAG_RSVD):
        rc_lsm_disks = []
        mega_disk_path_regex = re.compile(
            r"^Drive (\/c[0-9]+\/e[0-9]+\/s[0-9]+) - Detailed Information$")

        for ctrl_num in range(self._ctrl_count()):
            sys_id = self._sys_id_of_ctrl_num(ctrl_num)

            disk_show_output = self._storcli_exec(
                ["/c%d/eall/sall" % ctrl_num, "show", "all"])
            for drive_name in disk_show_output.keys():
                re_match = mega_disk_path_regex.match(drive_name)
                if not re_match:
                    continue

                mega_disk_path = re_match.group(1)
                # Assuming only 1 disk attached to each slot.
                disk_show_basic_dict = disk_show_output["Drive %s" %
                                                        mega_disk_path][0]
                disk_show_attr_dict = disk_show_output[drive_name][
                    'Drive %s Device attributes' % mega_disk_path]
                disk_show_stat_dict = disk_show_output[drive_name][
                    'Drive %s State' % mega_disk_path]

                disk_id = disk_show_attr_dict['SN'].strip()
                disk_name = "Disk %s %s %s" % (
                    disk_show_basic_dict['DID'],
                    disk_show_attr_dict['Manufacturer Id'].strip(),
                    disk_show_attr_dict['Model Number'])
                disk_type = _disk_type_of(disk_show_basic_dict)
                blk_size = size_human_2_size_bytes(
                    disk_show_basic_dict['SeSz'])
                blk_count = _blk_count_of(disk_show_attr_dict['Coerced size'])
                status = _disk_status_of(disk_show_basic_dict,
                                         disk_show_stat_dict)

                plugin_data = "%s:%s" % (ctrl_num,
                                         disk_show_basic_dict['EID:Slt'])
                vpd83 = disk_show_attr_dict["WWN"]

                rc_lsm_disks.append(
                    Disk(
                        disk_id,
                        disk_name,
                        disk_type,
                        blk_size,
                        blk_count,
                        status,
                        sys_id,
                        plugin_data,
                        _vpd83=vpd83))

        return search_property(rc_lsm_disks, search_key, search_value)
Exemplo n.º 26
0
 def volumes(self, search_key=None, search_value=None, flags=0):
     volumes = []
     for p_name in (p['name'] for p in self._jsonrequest("pool_list")
                    if p['type'] == 'block'):
         for vol in self._jsonrequest("vol_list", dict(pool=p_name)):
             vpd83 = TargetdStorage._uuid_to_vpd83(vol['uuid'])
             volumes.append(
                 Volume(vol['uuid'], vol['name'], vpd83, 512,
                        long(vol['size'] / 512), Volume.ADMIN_STATE_ENABLED,
                        self.system.id, p_name))
     return search_property(volumes, search_key, search_value)
Exemplo n.º 27
0
    def pools(self, search_key=None, search_value=None, flags=0):
        pools = []
        for pool in self._jsonrequest("pool_list"):
            if pool['name'].startswith('/'):
                et = Pool.ELEMENT_TYPE_FS
            else:
                et = Pool.ELEMENT_TYPE_VOLUME

            pools.append(
                Pool(pool['name'], pool['name'], et, 0, pool['size'],
                     pool['free_size'], Pool.STATUS_UNKNOWN, '', 'targetd'))
        return search_property(pools, search_key, search_value)
Exemplo n.º 28
0
 def volumes(self, search_key=None, search_value=None, flags=0):
     volumes = []
     for p_name in (p['name'] for p in self._jsonrequest("pool_list") if
                    p['type'] == 'block'):
         for vol in self._jsonrequest("vol_list", dict(pool=p_name)):
             vpd83 = TargetdStorage._uuid_to_vpd83(vol['uuid'])
             volumes.append(
                 Volume(vol['uuid'], vol['name'], vpd83, 512,
                        long(vol['size'] / 512),
                        Volume.ADMIN_STATE_ENABLED,
                        self.system.id, p_name))
     return search_property(volumes, search_key, search_value)
Exemplo n.º 29
0
    def access_groups(self, search_key=None, search_value=None, flags=0):
        """
        Returns a list of access groups
        """
        hg_list = self._request("list_hostgroups", "stmf", [])

        ag_list = []
        for hg in hg_list:
            init_ids = self._request("list_hostgroup_members", "stmf", [hg])
            ag_list.append(
                AccessGroup(hg, hg, init_ids, AccessGroup.INIT_TYPE_ISCSI_IQN,
                            self.system.id))
        return search_property(ag_list, search_key, search_value)
Exemplo n.º 30
0
    def pools(self, search_key=None, search_value=None, flags=0):
        pools = []
        for pool in self._jsonrequest("pool_list"):
            if pool['name'].startswith('/'):
                et = Pool.ELEMENT_TYPE_FS
            else:
                et = Pool.ELEMENT_TYPE_VOLUME

            pools.append(Pool(pool['name'],
                              pool['name'], et, 0, pool['size'],
                              pool['free_size'], Pool.STATUS_UNKNOWN, '',
                              'targetd'))
        return search_property(pools, search_key, search_value)
Exemplo n.º 31
0
    def access_groups(self, search_key=None, search_value=None, flags=0):
        """
        Returns a list of access groups
        """
        hg_list = self._request("list_hostgroups", "stmf", [])

        ag_list = []
        for hg in hg_list:
            init_ids = self._request("list_hostgroup_members", "stmf", [hg])
            ag_list.append(
                AccessGroup(hg, hg, init_ids, AccessGroup.INIT_TYPE_ISCSI_IQN,
                            self.system.id))
        return search_property(ag_list, search_key, search_value)
Exemplo n.º 32
0
    def pools(self, search_key=None, search_value=None, flags=Client.FLAG_RSVD):
        """
        Depend on command:
            hpssacli ctrl all show config detail
        """
        lsm_pools = []
        ctrl_all_conf = self._sacli_exec(["ctrl", "all", "show", "config", "detail"])
        for ctrl_data in ctrl_all_conf.values():
            sys_id = _sys_id_of_ctrl_data(ctrl_data)
            ctrl_num = ctrl_data["Slot"]
            for key_name in ctrl_data.keys():
                if key_name.startswith("Array:"):
                    lsm_pools.append(SmartArray._hp_array_to_lsm_pool(ctrl_data[key_name], key_name, sys_id, ctrl_num))

        return search_property(lsm_pools, search_key, search_value)
Exemplo n.º 33
0
    def fs(self, search_key=None, search_value=None, flags=0):
        """List filesystems, required for other operations"""
        fss = []
        parts = list_mounts()
        for prt in parts:
            try:
                (total_size, avail_size) = NFSPlugin._get_fs_sizes(prt)
                fsid = get_fsid(prt)
                fss.append(
                    FileSystem(fsid, prt, total_size, avail_size, fsid,
                               self._SYSID))
            except OSError:
                pass

        return search_property(fss, search_key, search_value)
Exemplo n.º 34
0
    def exports(self, search_key=None, search_value=None, flags=0):
        """
        Get a list of all exported file systems on the controller.
        """
        exp_list = self._request("get_shared_folders", "netstorsvc",
                                 ['svc:/network/nfs/server:default', ''])

        exports = []
        for e in exp_list:
            opts = self._request("get_shareopts", "netstorsvc",
                                 ['svc:/network/nfs/server:default', e])
            exports.append(NfsExport(md5(opts['name']), e, opts['name'],
                                     opts['auth_type'], opts['root'],
                                     opts['read_write'], opts['read_only'],
                                     'N/A', 'N/A', opts['extra_options']))

        return search_property(exports, search_key, search_value)
Exemplo n.º 35
0
 def pools(self, search_key=None, search_value=None, flags=0):
     pools = []
     parts = list_mounts()
     for prt in parts:
         try:
             (total_size, avail_size) = NFSPlugin._get_fs_sizes(prt)
             fsid = get_fsid(prt)
             pooltype = Pool.ELEMENT_TYPE_FS
             unsup_actions = 0
             status = System.STATUS_OK
             status_info = ''
             pools.append(
                 Pool(fsid, prt, pooltype, unsup_actions, total_size,
                      avail_size, status, status_info, self._SYSID))
         except OSError:
             pass
     return search_property(pools, search_key, search_value)
Exemplo n.º 36
0
    def disks(self, search_key=None, search_value=None,
              flags=Client.FLAG_RSVD):
        rc_lsm_disks = []
        mega_disk_path_regex = re.compile(
            r"^Drive (\/c[0-9]+\/e[0-9]+\/s[0-9]+) - Detailed Information$")

        for ctrl_num in range(self._ctrl_count()):
            sys_id = self._sys_id_of_ctrl_num(ctrl_num)

            disk_show_output = self._storcli_exec(
                ["/c%d/eall/sall" % ctrl_num, "show", "all"])
            for drive_name in disk_show_output.keys():
                re_match = mega_disk_path_regex.match(drive_name)
                if not re_match:
                    continue

                mega_disk_path = re_match.group(1)
                # Assuming only 1 disk attached to each slot.
                disk_show_basic_dict = disk_show_output[
                    "Drive %s" % mega_disk_path][0]
                disk_show_attr_dict = disk_show_output[drive_name][
                    'Drive %s Device attributes' % mega_disk_path]
                disk_show_stat_dict = disk_show_output[drive_name][
                    'Drive %s State' % mega_disk_path]

                disk_id = disk_show_attr_dict['SN'].strip()
                disk_name = "Disk %s %s %s" % (
                    disk_show_basic_dict['DID'],
                    disk_show_attr_dict['Manufacturer Id'].strip(),
                    disk_show_attr_dict['Model Number'])
                disk_type = _disk_type_of(disk_show_basic_dict)
                blk_size = size_human_2_size_bytes(
                    disk_show_basic_dict['SeSz'])
                blk_count = _blk_count_of(disk_show_attr_dict['Coerced size'])
                status = _disk_status_of(
                    disk_show_basic_dict, disk_show_stat_dict)

                plugin_data = "%s:%s" % (
                    ctrl_num, disk_show_basic_dict['EID:Slt'])

                rc_lsm_disks.append(
                    Disk(
                        disk_id, disk_name, disk_type, blk_size, blk_count,
                        status, sys_id, plugin_data))

        return search_property(rc_lsm_disks, search_key, search_value)
Exemplo n.º 37
0
    def exports(self, search_key=None, search_value=None, flags=0):
        """
        Get a list of all exported file systems on the controller.
        """
        exp_list = self._request("get_shared_folders", "netstorsvc",
                                 ['svc:/network/nfs/server:default', ''])

        exports = []
        for e in exp_list:
            opts = self._request("get_shareopts", "netstorsvc",
                                 ['svc:/network/nfs/server:default', e])
            exports.append(NfsExport(md5(opts['name']), e, opts['name'],
                                     opts['auth_type'], opts['root'],
                                     opts['read_write'], opts['read_only'],
                                     'N/A', 'N/A', opts['extra_options']))

        return search_property(exports, search_key, search_value)
Exemplo n.º 38
0
    def pools(self, search_key=None, search_value=None,
              flags=Client.FLAG_RSVD):
        lsm_pools = []
        for ctrl_num in range(self._ctrl_count()):
            dg_show_output = self._storcli_exec(
                ["/c%d/dall" % ctrl_num, "show", "all"])
            free_space_list = dg_show_output.get('FREE SPACE DETAILS', [])
            for dg_top in dg_show_output['TOPOLOGY']:
                if dg_top['Arr'] != '-':
                    continue
                if dg_top['DG'] == '-':
                    continue
                lsm_pools.append(
                    self._dg_top_to_lsm_pool(
                        dg_top, free_space_list, ctrl_num))

        return search_property(lsm_pools, search_key, search_value)
Exemplo n.º 39
0
    def pools(
        self,
        search_key=None,
        search_value=None,
        flags=Client.FLAG_RSVD,
    ) -> List:
        lsm_pools = []
        for ctrl_num in range(self._ctrl_count()):
            cc_vd_ids = []
            cc_dg_ids = []
            dg_show_output = self._storcli_exec(
                f"/c{ctrl_num:d}/dall show all")
            consist_check_output = self._storcli_exec(
                f"/c{ctrl_num:d}/vall show cc")
            free_space_list = dg_show_output.get("FREE SPACE DETAILS", [])

            if "TOPOLOGY" not in dg_show_output:
                continue

            for vd_stat in consist_check_output["VD Operation Status"]:
                if vd_stat["Status"] == "In progress":
                    cc_vd_ids.append(int(vd_stat["VD"]))

            for vd in dg_show_output["VD LIST"]:
                (dg_id, vd_id) = vd["DG/VD"].split("/")
                if int(vd_id) in cc_vd_ids:
                    cc_dg_ids.append(int(dg_id))

            for dg_top in dg_show_output["TOPOLOGY"]:
                if dg_top["Arr"] != "-":
                    continue
                if dg_top["DG"] == "-":
                    continue
                if dg_top["DID"] != "-":
                    continue
                lsm_pools.append(
                    self._dg_top_to_lsm_pool(
                        dg_top,
                        free_space_list,
                        ctrl_num,
                        dg_show_output,
                        int(dg_top["DG"]) in cc_dg_ids,
                    ))

        return search_property(lsm_pools, search_key, search_value)
Exemplo n.º 40
0
    def pools(self, search_key=None, search_value=None,
              flags=Client.FLAG_RSVD):
        lsm_pools = []
        for ctrl_num in range(self._ctrl_count()):
            dg_show_output = self._storcli_exec(
                ["/c%d/dall" % ctrl_num, "show", "all"])
            free_space_list = dg_show_output.get('FREE SPACE DETAILS', [])
            if 'TOPOLOGY' not in dg_show_output:
                continue
            for dg_top in dg_show_output['TOPOLOGY']:
                if dg_top['Arr'] != '-':
                    continue
                if dg_top['DG'] == '-':
                    continue
                lsm_pools.append(
                    self._dg_top_to_lsm_pool(
                        dg_top, free_space_list, ctrl_num))

        return search_property(lsm_pools, search_key, search_value)
Exemplo n.º 41
0
    def pools(self, search_key=None, search_value=None, flags=0):
        pools_list = self._request("get_all_names", "volume", [""])

        pools = []
        for pool in pools_list:
            if pool == 'syspool':
                continue
            pool_info = self._request("get_child_props", "volume",
                                      [str(pool), ""])

            pools.append(Pool(pool_info['name'], pool_info['name'],
                              Pool.ELEMENT_TYPE_VOLUME |
                              Pool.ELEMENT_TYPE_VOLUME_THIN |
                              Pool.ELEMENT_TYPE_FS,
                              0,
                              NexentaStor._to_bytes(pool_info['size']),
                              NexentaStor._to_bytes(pool_info['free']),
                              Pool.STATUS_UNKNOWN, '', self.system.id))

        return search_property(pools, search_key, search_value)
Exemplo n.º 42
0
    def pools(self, search_key=None, search_value=None, flags=0):
        pools_list = self._request("get_all_names", "volume", [""])

        pools = []
        for pool in pools_list:
            if pool == 'syspool':
                continue
            pool_info = self._request("get_child_props", "volume",
                                      [str(pool), ""])

            pools.append(Pool(pool_info['name'], pool_info['name'],
                              Pool.ELEMENT_TYPE_VOLUME |
                              Pool.ELEMENT_TYPE_VOLUME_THIN |
                              Pool.ELEMENT_TYPE_FS,
                              0,
                              NexentaStor._to_bytes(pool_info['size']),
                              NexentaStor._to_bytes(pool_info['free']),
                              Pool.STATUS_UNKNOWN, '', self.system.id))

        return search_property(pools, search_key, search_value)
Exemplo n.º 43
0
    def volumes(self,
                search_key=None,
                search_value=None,
                flags=Client.FLAG_RSVD):
        """
        """
        lsm_vols = []
        total_cntrl = self._get_arcconf_controllers_count()
        getconfig_lds_info = []

        pool_id = ''
        sys_id = ''

        for cntrl in range(total_cntrl):
            getconfig_lds_info = self._arcconf_exec(
                ["getconfigJSON", str(cntrl + 1)])
            sys_id = str(cntrl + 1)
            cnt = int(cntrl + 1)

            getconfig_lds_info_json = getconfig_lds_info.split("\n")[1]
            decoded_json = json.loads(getconfig_lds_info_json)

            try:
                if 'LogicalDrive' in decoded_json['Controller']:
                    for ld in range(
                            len(decoded_json['Controller']['LogicalDrive'])):
                        ld_num = decoded_json['Controller']['LogicalDrive'][
                            ld]['logicalDriveID']
                        ld_name = decoded_json['Controller']['LogicalDrive'][
                            ld]['name']
                        pool_id = '%s:%s' % (sys_id, ld_num)
                        ld_info = decoded_json['Controller']['LogicalDrive'][
                            ld]
                        lsm_vol = Arcconf._arcconf_ld_to_lsm_vol(
                            ld_info, pool_id, sys_id, cnt, str(ld_num),
                            ld_name)
                        lsm_vols.append(lsm_vol)
            except DeviceNotFoundError:
                pass

        return search_property(lsm_vols, search_key, search_value)
Exemplo n.º 44
0
    def pools(self, search_key=None, search_value=None,
              flags=Client.FLAG_RSVD):
        lsm_pools = []
        getconfig_cntrls_info = self._get_detail_info_list()
        sys_id = ''
        cntrl = 0

        for decoded_json in getconfig_cntrls_info:
            cntrl_num = str(int(cntrl + 1))
            sys_id = cntrl_num
            cntrl += 1

            if 'LogicalDrive' in decoded_json['Controller']:
                ld_infos = decoded_json['Controller']['LogicalDrive']
                num_lds = len(ld_infos)
                for ld in range(num_lds):
                    ld_name = ld_infos[ld]['logicalDriveID']
                    lsm_pools.append(
                        Arcconf._arcconf_array_to_lsm_pool(ld_name, sys_id,
                                                           cntrl_num))
        return search_property(lsm_pools, search_key, search_value)
Exemplo n.º 45
0
    def pools(self,
              search_key=None,
              search_value=None,
              flags=Client.FLAG_RSVD):
        """
        Depend on command:
            hpssacli ctrl all show config detail
        """
        lsm_pools = []
        ctrl_all_conf = self._sacli_exec(
            ["ctrl", "all", "show", "config", "detail"])
        for ctrl_data in ctrl_all_conf.values():
            sys_id = ctrl_data['Serial Number']
            ctrl_num = ctrl_data['Slot']
            for key_name in ctrl_data.keys():
                if key_name.startswith("Array:"):
                    lsm_pools.append(
                        SmartArray._hp_array_to_lsm_pool(
                            ctrl_data[key_name], key_name, sys_id, ctrl_num))

        return search_property(lsm_pools, search_key, search_value)
Exemplo n.º 46
0
    def fs(self, search_key=None, search_value=None, flags=0):
        fs_list = self._request("get_all_names", "folder", [""])

        fss = []
        pools = {}
        for fs in fs_list:
            pool_name = NexentaStor._get_pool_id(fs)
            if pool_name == 'syspool':
                continue
            if pool_name not in pools:
                pool_info = self._request("get_child_props", "volume",
                                          [str(fs), ""])
                pools[pool_name] = pool_info
            else:
                pool_info = pools[pool_name]
            fss.append(
                FileSystem(fs, fs, NexentaStor._to_bytes(pool_info['size']),
                           self._to_bytes(pool_info['available']), pool_name,
                           self.system.id))

        return search_property(fss, search_key, search_value)
Exemplo n.º 47
0
    def _query(self,
               query_func_name,
               search_key=None,
               search_value=None,
               flags=Client.FLAG_RSVD):
        lsm_objs = []
        if search_key == "system_id":
            if search_value not in self.sys_con_map.keys():
                return []
            return getattr(self.sys_con_map[search_value],
                           query_func_name)(flags=flags)

        for conn in self.conns:
            try:
                lsm_objs.extend(getattr(conn, query_func_name)(flags=flags))
            except LsmError as lsm_err:
                if lsm_err.code == ErrorNumber.NO_SUPPORT:
                    pass
                else:
                    raise
        return search_property(lsm_objs, search_key, search_value)
Exemplo n.º 48
0
 def exports(self, search_key=None, search_value=None, flags=0):
     sim_exps = self.sim_array.exports(flags)
     return search_property(
         [SimPlugin._sim_data_2_lsm(e) for e in sim_exps],
         search_key, search_value)
Exemplo n.º 49
0
 def batteries(self, search_key=None, search_value=None,
               flags=Client.FLAG_RSVD):
     sim_batteries = self.sim_array.batteries()
     return search_property(
         [SimPlugin._sim_data_2_lsm(b) for b in sim_batteries],
         search_key, search_value)
Exemplo n.º 50
0
    def disks(self, search_key=None, search_value=None,
              flags=Client.FLAG_RSVD):
        rc_lsm_disks = []
        mega_disk_path_regex = re.compile(
            r"""
                ^Drive \ (
                \/c[0-9]+\/             # Controller ID
                (:?e[0-9]+\/){0,1}      # Enclosure ID(optional)
                s[0-9]+                 # Slot ID
                )\ -\ Detailed\ Information$""", re.X)

        for ctrl_num in range(self._ctrl_count()):
            sys_id = self._sys_id_of_ctrl_num(ctrl_num)

            try:
                disk_show_output = self._storcli_exec(
                    ["/c%d/eall/sall" % ctrl_num, "show", "all"])
            except ExecError:
                disk_show_output = {}

            try:
                disk_show_output.update(
                    self._storcli_exec(
                        ["/c%d/sall" % ctrl_num, "show", "all"]))
            except (ExecError, TypeError):
                pass

            for drive_name in list(disk_show_output.keys()):
                re_match = mega_disk_path_regex.match(drive_name)
                if not re_match:
                    continue

                mega_disk_path = re_match.group(1)
                # Assuming only 1 disk attached to each slot.
                disk_show_basic_dict = disk_show_output[
                    "Drive %s" % mega_disk_path][0]
                disk_show_attr_dict = disk_show_output[drive_name][
                    'Drive %s Device attributes' % mega_disk_path]
                disk_show_stat_dict = disk_show_output[drive_name][
                    'Drive %s State' % mega_disk_path]

                disk_id = disk_show_attr_dict['SN'].strip()
                disk_name = "Disk %s %s %s" % (
                    disk_show_basic_dict['DID'],
                    disk_show_attr_dict['Manufacturer Id'].strip(),
                    disk_show_attr_dict['Model Number'])
                disk_type = _disk_type_of(disk_show_basic_dict)
                blk_size = size_human_2_size_bytes(
                    disk_show_basic_dict['SeSz'])
                blk_count = _blk_count_of(disk_show_attr_dict['Coerced size'])
                status = _disk_status_of(
                    disk_show_basic_dict, disk_show_stat_dict)

                plugin_data = "%s:%s" % (
                    ctrl_num, disk_show_basic_dict['EID:Slt'])
                vpd83 = disk_show_attr_dict["WWN"].lower()
                rpm = _disk_rpm_of(disk_show_basic_dict)
                link_type = _disk_link_type_of(disk_show_basic_dict)

                rc_lsm_disks.append(
                    Disk(
                        disk_id, disk_name, disk_type, blk_size, blk_count,
                        status, sys_id, plugin_data, _vpd83=vpd83, _rpm=rpm,
                        _link_type=link_type))

        return search_property(rc_lsm_disks, search_key, search_value)
Exemplo n.º 51
0
 def fs(self, search_key=None, search_value=None, flags=0):
     sim_fss = self.sim_array.fs()
     return search_property(
         [SimPlugin._sim_data_2_lsm(f) for f in sim_fss],
         search_key, search_value)
Exemplo n.º 52
0
    def exports(self, search_key=None, search_value=None, flags=0):
        tmp_exports = {}
        exports = []
        fs_full_paths = {}
        all_nfs_exports = self._jsonrequest("nfs_export_list")
        nfs_exports = []

        # Remove those that are not of FS origin
        fs_list = self._jsonrequest("fs_list")
        for f in fs_list:
            fs_full_paths[f['full_path']] = f

        for export in all_nfs_exports:
            if export['path'] in fs_full_paths:
                nfs_exports.append(export)

        # Collect like exports to minimize results
        for export in nfs_exports:
            key = export['path'] + \
                TargetdStorage._option_string(export['options'])
            if key in tmp_exports:
                tmp_exports[key].append(export)
            else:
                tmp_exports[key] = [export]

        # Walk through the options
        for le in tmp_exports.values():
            export_id = ""
            root = []
            rw = []
            ro = []
            sec = None
            anonuid = NfsExport.ANON_UID_GID_NA
            anongid = NfsExport.ANON_UID_GID_NA

            options = None

            for export in le:

                host = export['host']
                export_id += host
                export_id += export['path']
                export_id += fs_full_paths[export['path']]['uuid']

                options = export['options']

                if 'rw' in options:
                    rw.append(host)

                if 'ro' in options:
                    ro.append(host)

                sec = TargetdStorage._get_value(options, 'sec')
                if sec is None:
                    sec = 'sys'

                if 'no_root_squash' in options:
                    root.append(host)

                uid = TargetdStorage._get_value(options, 'anonuid')
                if uid is not None:
                    anonuid = uid
                gid = TargetdStorage._get_value(options, 'anongid')
                if gid is not None:
                    anongid = gid

            exports.append(
                NfsExport(TargetdStorage._calculate_export_md5(export['path'],
                                                               options),
                          fs_full_paths[export['path']]['uuid'],
                          export['path'], sec, root, rw, ro, anonuid, anongid,
                          TargetdStorage._option_string(options)))

        return search_property(exports, search_key, search_value)
Exemplo n.º 53
0
 def access_groups(self, search_key=None, search_value=None, flags=0):
     sim_ags = self.sim_array.ags()
     return search_property(
         [SimPlugin._sim_data_2_lsm(a) for a in sim_ags],
         search_key, search_value)
Exemplo n.º 54
0
 def target_ports(self, search_key=None, search_value=None, flags=0):
     sim_tgts = self.sim_array.target_ports()
     return search_property(
         [SimPlugin._sim_data_2_lsm(t) for t in sim_tgts],
         search_key, search_value)
Exemplo n.º 55
0
 def pools(self, search_key=None, search_value=None, flags=0):
     sim_pools = self.sim_array.pools(flags)
     return search_property(
         [SimPlugin._sim_data_2_lsm(p) for p in sim_pools],
         search_key, search_value)
Exemplo n.º 56
0
 def volumes(self, search_key=None, search_value=None, flags=0):
     sim_vols = self.sim_array.volumes()
     return search_property(
         [SimPlugin._sim_data_2_lsm(v) for v in sim_vols],
         search_key, search_value)
Exemplo n.º 57
0
 def disks(self, search_key=None, search_value=None, flags=0):
     sim_disks = self.sim_array.disks()
     return search_property(
         [SimPlugin._sim_data_2_lsm(d) for d in sim_disks],
         search_key, search_value)