当前位置: 首页>>代码示例>>Python>>正文


Python Host.list_host_uris方法代码示例

本文整理汇总了Python中host.Host.list_host_uris方法的典型用法代码示例。如果您正苦于以下问题:Python Host.list_host_uris方法的具体用法?Python Host.list_host_uris怎么用?Python Host.list_host_uris使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在host.Host的用法示例。


在下文中一共展示了Host.list_host_uris方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: HostInitiator

# 需要导入模块: from host import Host [as 别名]
# 或者: from host.Host import list_host_uris [as 别名]

#.........这里部分代码省略.........
            HostInitiator.URI_INITIATOR_DETAILS.format(initiatorUri),
            body)
        o = common.json_decode(s)
        return o

    """
    Initiator delete operation
    """

    def delete(self, initiator_uri):
        '''
        Makes a REST API call to delete a initiator by its UUID
        '''
        (s, h) = common.service_json_request(
            self.__ipAddr, self.__port, "POST",
            HostInitiator.URI_INITIATOR_DEACTIVATE.format(initiator_uri),
            None)
        return

    '''
    Lists all initiators present in the system
    returns list of initiator elements
    <initiator>
     <name>...</name>
     <id>...</id>
     <link rel="..." href="..." />
    </initiator>
    '''

    def list_all(self):

        initiatorsList = []
        # Get all hosts in the system
        hostUris = self.__hostObject.list_host_uris()

        # Get the list of initiators from each host
        if(hostUris.__len__() > 0):
            for host in hostUris:
                tempInitiatorList = self.__hostObject.list_initiators(host)
                if(tempInitiatorList.__len__() > 0):
                    for tempInitiator in tempInitiatorList:
                        initiatorsList.append(tempInitiator)
        else:
            raise SOSError(
                SOSError.NOT_FOUND_ERR,
                "No initiators found in the system")

        return initiatorsList

    '''
    Lists all initiator uris present in the system
    '''

    def list_all_by_uri(self):

        initiatorsList = []
        # Get all hosts in the system
        hostUris = self.__hostObject.list_host_uris()

        # Get the list of initiators from each host
        if(hostUris.__len__() > 0):
            for host in hostUris:
                tempInitiatorList = self.__hostObject.list_initiators(host)
                if(tempInitiatorList.__len__() > 0):
                    for tempInitiator in tempInitiatorList:
                        initiatorsList.append(tempInitiator['id'])
开发者ID:cloudscaling,项目名称:coprhd-controller,代码行数:70,代码来源:hostinitiators.py

示例2: HostIPInterface

# 需要导入模块: from host import Host [as 别名]
# 或者: from host.Host import list_host_uris [as 别名]

#.........这里部分代码省略.........
        return o

    """
    ipinterface delete operation
    """

    def delete(self, hostName, interfaceAddress, tenant):

        ipinterfaceUri = self.query_by_ipaddress(interfaceAddress, hostName, tenant)

        '''
        Makes a REST API call to delete a ipinterface by its UUID
        '''
        (s, h) = common.service_json_request(
            self.__ipAddr, self.__port, "POST",
            HostIPInterface.URI_IPINTERFACE_DEACTIVATE.format(ipinterfaceUri),
            None)
        return

    '''
    Lists all ipinterfaces present in the system
    returns list of ipinterface elements
    <ipinterface>
     <name>...</name>
     <id>...</id>
     <link rel="..." href="..." />
    </ipinterface>
    '''

    def list_all(self):

        ipinterfacesList = []
        # Get all hosts in the system
        hostUris = self.__hostObject.list_host_uris()

        # Get the list of ipinterfaces from each host
        if(hostUris.__len__() > 0):
            for host in hostUris:
                tempipinterfaceList = self.__hostObject.list_ipinterfaces(host)
                if(tempipinterfaceList.__len__() > 0):
                    for tempipinterface in tempipinterfaceList:
                        ipinterfacesList.append(tempipinterface)
        else:
            raise SOSError(
                SOSError.NOT_FOUND_ERR,
                "No ip-interfaces found in the system")

        return ipinterfacesList

    '''
    Lists all ipinterface uris present in the system
    '''

    def list_all_by_uri(self):

        ipinterfacesList = []
        # Get all hosts in the system
        hostUris = self.__hostObject.list_host_uris()

        # Get the list of ipinterfaces from each host
        if(hostUris.__len__() > 0):
            for host in hostUris:
                tempipinterfaceList = self.__hostObject.list_ipinterfaces(host)
                if(tempipinterfaceList.__len__() > 0):
                    for tempipinterface in tempipinterfaceList:
                        ipinterfacesList.append(tempipinterface['id'])
开发者ID:Lidaja,项目名称:coprhd-controller,代码行数:70,代码来源:hostipinterfaces.py


注:本文中的host.Host.list_host_uris方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。