示例#1
0
文件: port.py 项目: optionalg/storops
 def __init__(self, sp, port_id, vport_id=0):
     super(VNXHbaPort, self).__init__()
     self._sp = VNXSPEnum.from_str(sp)
     self._port_id = check_int(port_id)
     self._vport_id = check_int(vport_id)
     self._type = VNXPortType.FC
     self._host_initiator_list = []
示例#2
0
文件: port.py 项目: crook/storops
 def __init__(self, sp, port_id, vport_id=None):
     super(VNXHbaPort, self).__init__()
     self._sp = VNXSPEnum.parse(sp)
     self._port_id = check_int(port_id)
     self._vport_id = check_int(vport_id, allow_none=True)
     self._type = VNXPortType.FC
     self._host_initiator_list = []
示例#3
0
文件: port.py 项目: optionalg/storops
 def __init__(self, sp, port_id, vport_id=0):
     super(VNXHbaPort, self).__init__()
     self._sp = VNXSPEnum.from_str(sp)
     self._port_id = check_int(port_id)
     self._vport_id = check_int(vport_id)
     self._type = VNXPortType.FC
     self._host_initiator_list = []
示例#4
0
文件: port.py 项目: rtjust/storops
 def __init__(self, sp, port_id, vport_id=None):
     super(VNXHbaPort, self).__init__()
     self._sp = VNXSPEnum.parse(sp)
     self._port_id = check_int(port_id)
     self._vport_id = check_int(vport_id, allow_none=True)
     self._type = VNXPortType.FC
     self._host_initiator_list = []
示例#5
0
    def test_from_str(self):
        data = {
            'spa': VNXSPEnum.SP_A,
            'sp': None,
            'sp_a': VNXSPEnum.SP_A,
            'SP b': VNXSPEnum.SP_B,
            'a': VNXSPEnum.SP_A,
            'b': VNXSPEnum.SP_B,
            'cs': VNXSPEnum.CONTROL_STATION,
            'Celerra_CS0_21111': VNXSPEnum.CONTROL_STATION,
            'VPI-24092B': VNXSPEnum.SP_B
        }

        for k, v in six.iteritems(data):
            assert_that(VNXSPEnum.parse(k), equal_to(v), 'input: {}'.format(k))
            assert_that(
                pickle.loads(pickle.dumps(VNXSPEnum.parse(k))) is v,
                equal_to(True), 'input: {}'.format(k))
示例#6
0
文件: cli.py 项目: optionalg/storops
    def get_connection_port(self, sp=None, port_id=None, vport_id=None):
        cmd = 'connection -getport -all'.split()
        if sp is not None:
            cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]

        cmd += int_var('-portid', port_id)
        if port_id is not None:
            cmd += int_var('-vportid', vport_id)

        return cmd
示例#7
0
    def get_connection_port(self, sp=None, port_id=None, vport_id=None):
        cmd = 'connection -getport -all'.split()
        if sp is not None:
            cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]

        cmd += int_var('-portid', port_id)
        if port_id is not None:
            cmd += int_var('-vportid', vport_id)

        return cmd
示例#8
0
    def delete_iscsi_ip(self, sp, port_id, vport_id=None):
        if vport_id is None:
            vport_id = 0

        cmd = ['connection', '-delport']
        cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]
        cmd += int_var('-portid', port_id)
        cmd += int_var('-vportid', vport_id)
        cmd.append('-o')
        return cmd
示例#9
0
    def delete_iscsi_ip(self, sp, port_id, vport_id=None):
        if vport_id is None:
            vport_id = 0

        cmd = ['connection', '-delport']
        cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]
        cmd += int_var('-portid', port_id)
        cmd += int_var('-vportid', vport_id)
        cmd.append('-o')
        return cmd
示例#10
0
 def _get_sp_by_category(self):
     available_sp = []
     unavailable_sp = []
     nodes = self._node_map.nodes()
     for node in nodes:
         if VNXSPEnum.is_sp(node.name):
             if node.available:
                 available_sp.append(node)
             else:
                 unavailable_sp.append(node)
     return available_sp, unavailable_sp
示例#11
0
 def _get_sp_by_category(self):
     available_sp = []
     unavailable_sp = []
     nodes = self._node_map.nodes()
     for node in nodes:
         if VNXSPEnum.is_sp(node.name):
             if node.available:
                 available_sp.append(node)
             else:
                 unavailable_sp.append(node)
     return available_sp, unavailable_sp
示例#12
0
    def set_path(self, sg_name, hba_uid, sp, port_id, ip, host, vport_id=None):

        cmd = ['storagegroup', '-setpath']
        cmd += text_var('-gname', sg_name)
        cmd += text_var('-hbauid', hba_uid)
        cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]
        cmd += int_var('-spport', port_id)
        cmd += int_var('-spvport', vport_id)
        cmd += text_var('-ip', ip)
        cmd += text_var('-host', host)
        cmd.append('-o')
        return cmd
示例#13
0
文件: cli.py 项目: optionalg/storops
    def set_path(self, sg_name, hba_uid, sp, port_id,
                 ip, host, vport_id=None):

        cmd = ['storagegroup', '-setpath']
        cmd += text_var('-gname', sg_name)
        cmd += text_var('-hbauid', hba_uid)
        cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]
        cmd += int_var('-spport', port_id)
        cmd += int_var('-spvport', vport_id)
        cmd += ['-ip', ip]
        cmd += text_var('-host', host)
        cmd.append('-o')
        return cmd
示例#14
0
 def ping_node(self, address, sp, port_id, vport_id=None, packet_size=None,
               count=None, timeout=None, delay=None):
     if vport_id is None:
         vport_id = 0
     cmd = ['connection', '-pingnode']
     sp = VNXSPEnum.get_sp_index(sp)
     cmd += text_var('-sp', sp)
     cmd += int_var('-portid', port_id)
     cmd += int_var('-vportid', vport_id)
     cmd += text_var('-address', address)
     cmd += int_var('-packetSize', packet_size)
     cmd += int_var('-count', count)
     cmd += int_var('-timeout', timeout)
     cmd += int_var('-delay', delay)
     return cmd
示例#15
0
    def config_iscsi_ip(self, sp, port_id, ip, netmask, gateway,
                        vport_id=None, vlan_id=None):
        if vport_id is None:
            vport_id = 0

        cmd = ['connection', '-setport', '-iscsi']
        cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]
        cmd += int_var('-portid', port_id)
        cmd += int_var('-vportid', vport_id)
        cmd += int_var('-vlanid', vlan_id)
        cmd += text_var('-address', ip)
        cmd += text_var('-subnetmask', netmask)
        cmd += text_var('-gateway', gateway)
        cmd.append('-o')
        return cmd
示例#16
0
    def test_from_str(self):
        data = {
            'spa': VNXSPEnum.SP_A,
            'sp': None,
            'sp_a': VNXSPEnum.SP_A,
            'SP b': VNXSPEnum.SP_B,
            'a': VNXSPEnum.SP_A,
            'b': VNXSPEnum.SP_B,
            'cs': VNXSPEnum.CONTROL_STATION,
            'Celerra_CS0_21111': VNXSPEnum.CONTROL_STATION,
            'VPI-24092B': VNXSPEnum.SP_B
        }

        for k, v in six.iteritems(data):
            assert_that(VNXSPEnum.from_str(k), equal_to(v),
                        'input: {}'.format(k))
示例#17
0
    def __init__(self, name, ip, available=None, working=False):
        """ constructor for `NodeInfo`.

        :param name: name of the node, could be `spa`, or `spb`
        :param ip: ip address of the node
        :param available: indicate whether this node is alive.
        :param working: indicate whether this node is executing command.
        :return:
        """
        self.name = VNXSPEnum.parse(name)
        self.ip = ip.strip('\'" ')
        if available is None:
            available = True
        self._available = available
        self.timestamp = None
        self.working = working
        self._latency = WeightedAverage()
示例#18
0
    def __init__(self, name, ip, available=None, working=False):
        """ constructor for `NodeInfo`.

        :param name: name of the node, could be `spa`, or `spb`
        :param ip: ip address of the node
        :param available: indicate whether this node is alive.
        :param working: indicate whether this node is executing command.
        :return:
        """
        self.name = VNXSPEnum.from_str(name)
        self.ip = ip
        if available is None:
            available = True
        self._available = available
        self.timestamp = None
        self.working = working
        self._latency = WeightedAverage()
示例#19
0
    def config_iscsi_ip(self,
                        sp,
                        port_id,
                        ip,
                        netmask,
                        gateway,
                        vport_id=None,
                        vlan_id=None):
        if vport_id is None:
            vport_id = 0

        cmd = ['connection', '-setport', '-iscsi']
        cmd += ['-sp', VNXSPEnum.get_sp_index(sp)]
        cmd += int_var('-portid', port_id)
        cmd += int_var('-vportid', vport_id)
        cmd += int_var('-vlanid', vlan_id)
        cmd += text_var('-address', ip)
        cmd += text_var('-subnetmask', netmask)
        cmd += text_var('-gateway', gateway)
        cmd.append('-o')
        return cmd
示例#20
0
 def ping_node(self,
               address,
               sp,
               port_id,
               vport_id=None,
               packet_size=None,
               count=None,
               timeout=None,
               delay=None):
     if vport_id is None:
         vport_id = 0
     cmd = ['connection', '-pingnode']
     sp = VNXSPEnum.get_sp_index(sp)
     cmd += text_var('-sp', sp)
     cmd += int_var('-portid', port_id)
     cmd += int_var('-vportid', vport_id)
     cmd += text_var('-address', address)
     cmd += int_var('-packetSize', packet_size)
     cmd += int_var('-count', count)
     cmd += int_var('-timeout', timeout)
     cmd += int_var('-delay', delay)
     return cmd
示例#21
0
文件: port.py 项目: thotypous/storops
 def sp(self):
     return VNXSPEnum.parse(self._get_property('_sp'))
示例#22
0
文件: sg.py 项目: optionalg/storops
 def sp(self):
     return VNXSPEnum.from_str(self.hba[1])
示例#23
0
 def filter_by_sp_name(member):
     sp = VNXSPEnum.parse(member.name)
     return sp == index
示例#24
0
文件: port.py 项目: rtjust/storops
 def sp(self):
     return VNXSPEnum.parse(self.hba[1])
示例#25
0
    def _ping_node(self, node):
        def do():
            self._ping_sp(node.ip)

        if VNXSPEnum.is_sp(node.name) and not node.working:
            daemon(do)
示例#26
0
文件: port.py 项目: crook/storops
 def sp(self):
     return VNXSPEnum.parse(self._get_property('_sp'))
示例#27
0
 def filter_by_sp_name(member):
     sp = VNXSPEnum.parse(member.name)
     return sp == index
示例#28
0
 def is_available(self, name):
     ret = False
     name = VNXSPEnum.from_str(name)
     if name in self._map:
         ret = self._map[name].available
     return ret
示例#29
0
 def __init__(self, sp_index, cli):
     super(VNXNetworkAdmin, self).__init__()
     self._cli = cli
     self._sp = VNXSPEnum.from_str(sp_index)
示例#30
0
 def sp_network_status(self, sp):
     sp = VNXSPEnum.get_sp_index(sp)
     return 'networkadmin -get -sp {} -all'.format(sp).split()
示例#31
0
 def _get_sp_ip(sp, cli):
     sp = VNXNetworkAdmin(VNXSPEnum.from_str(sp), cli)
     sp.with_no_poll()
     return sp.ip
示例#32
0
 def filter_by_sp_name(member):
     sp = VNXSPEnum.from_str(member.name)
     return sp == index
示例#33
0
 def f():
     VNXSPEnum.get_sp_index('abc')
示例#34
0
文件: cli.py 项目: optionalg/storops
 def sp_network_status(self, sp):
     sp = VNXSPEnum.get_sp_index(sp)
     return 'networkadmin -get -sp {} -all'.format(sp).split()
示例#35
0
 def test_get_sp_index(self):
     assert_that(VNXSPEnum.get_sp_index('spa'), equal_to('a'))
示例#36
0
    def _ping_node(self, node):
        def do():
            self._ping_sp(node.ip)

        if VNXSPEnum.is_sp(node.name) and not node.working:
            daemon(do)
示例#37
0
文件: port.py 项目: crook/storops
 def get_sp_index(self):
     return VNXSPEnum.get_sp_index(self.sp)
示例#38
0
文件: port.py 项目: rtjust/storops
 def get_sp_index(self):
     return VNXSPEnum.get_sp_index(self.sp)
示例#39
0
文件: port.py 项目: crook/storops
 def sp(self):
     return VNXSPEnum.parse(self.hba[1])
示例#40
0
 def is_available(self, name):
     ret = False
     name = VNXSPEnum.parse(name)
     if name in self._map:
         ret = self._map[name].available
     return ret