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


Python VMachineList.get_vmachines方法代码示例

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


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

示例1: list

# 需要导入模块: from ovs.dal.lists.vmachinelist import VMachineList [as 别名]
# 或者: from ovs.dal.lists.vmachinelist.VMachineList import get_vmachines [as 别名]
 def list(self, vpoolguid=None, query=None):
     """
     Overview of all machines
     """
     if vpoolguid is not None:
         vpool = VPool(vpoolguid)
         vmachine_guids = []
         vmachines = []
         for vdisk in vpool.vdisks:
             if vdisk.vmachine_guid is not None and vdisk.vmachine_guid not in vmachine_guids:
                 vmachine_guids.append(vdisk.vmachine.guid)
                 if vdisk.vmachine.is_vtemplate is False:
                     vmachines.append(vdisk.vmachine)
     elif query is not None:
         query = json.loads(query)
         vmachines = DataList(VMachine, query)
     else:
         vmachines = VMachineList.get_vmachines()
     return vmachines
开发者ID:DarumasLegs,项目名称:framework,代码行数:21,代码来源:vmachines.py

示例2: list

# 需要导入模块: from ovs.dal.lists.vmachinelist import VMachineList [as 别名]
# 或者: from ovs.dal.lists.vmachinelist.VMachineList import get_vmachines [as 别名]
 def list(self, vpoolguid=None, query=None):
     """
     Overview of all machines
     """
     if vpoolguid is not None:
         vpool = VPool(vpoolguid)
         vmachine_guids = []
         vmachines = []
         for vdisk in vpool.vdisks:
             if vdisk.vmachine_guid is not None and vdisk.vmachine_guid not in vmachine_guids:
                 vmachine_guids.append(vdisk.vmachine.guid)
                 if vdisk.vmachine.is_vtemplate is False:
                     vmachines.append(vdisk.vmachine)
     elif query is not None:
         query = json.loads(query)
         query_result = DataList({'object': VMachine,
                                  'data': DataList.select.GUIDS,
                                  'query': query}).data
         vmachines = DataObjectList(query_result, VMachine)
     else:
         vmachines = VMachineList.get_vmachines()
     return vmachines
开发者ID:dawnpower,项目名称:framework,代码行数:24,代码来源:vmachines.py

示例3: _children

# 需要导入模块: from ovs.dal.lists.vmachinelist import VMachineList [as 别名]
# 或者: from ovs.dal.lists.vmachinelist.VMachineList import get_vmachines [as 别名]
 def _children(vmt):
     children = 0
     disks = [vd.guid for vd in vmt.vdisks]
     for vdisk in [vdisk.parent_vdisk_guid for item in [vm.vdisks for vm in VMachineList.get_vmachines() if not vm.is_vtemplate] for vdisk in item]:
         for disk in disks:
             if vdisk == disk:
                 children += 1
     return children
开发者ID:DarumasLegs,项目名称:framework,代码行数:10,代码来源:ovssnmpserver.py

示例4: _bootstrap_dal_models

# 需要导入模块: from ovs.dal.lists.vmachinelist import VMachineList [as 别名]
# 或者: from ovs.dal.lists.vmachinelist.VMachineList import get_vmachines [as 别名]
    def _bootstrap_dal_models(self):
        """
        Load/hook dal models as snmp oids
        """
        _guids = set()

        enabled_key = "{0}_config_dal_enabled".format(STORAGE_PREFIX)
        self.instance_oid = 0
        try:
            enabled = self.persistent.get(enabled_key)
        except KeyNotFoundException:
            enabled = True  # Enabled by default, can be disabled by setting the key
        if enabled:
            from ovs.dal.lists.vdisklist import VDiskList
            from ovs.dal.lists.storagerouterlist import StorageRouterList
            from ovs.dal.lists.pmachinelist import PMachineList
            from ovs.dal.lists.vmachinelist import VMachineList
            from ovs.dal.lists.vpoollist import VPoolList
            from ovs.dal.lists.storagedriverlist import StorageDriverList

            for storagerouter in StorageRouterList.get_storagerouters():
                _guids.add(storagerouter.guid)
                if not self._check_added(storagerouter):
                    self._register_dal_model(10, storagerouter, 'guid', "0")
                    self._register_dal_model(10, storagerouter, 'name', "1")
                    self._register_dal_model(10, storagerouter, 'pmachine', "3", key = 'host_status')
                    self._register_dal_model(10, storagerouter, 'description', "4")
                    self._register_dal_model(10, storagerouter, 'devicename', "5")
                    self._register_dal_model(10, storagerouter, 'dtl_mode', "6")
                    self._register_dal_model(10, storagerouter, 'ip', "8")
                    self._register_dal_model(10, storagerouter, 'machineid', "9")
                    self._register_dal_model(10, storagerouter, 'status', "10")
                    self._register_dal_model(10, storagerouter, '#vdisks', "11",
                                             func = lambda storagerouter: len([vdisk for vpool_vdisks in [storagedriver.vpool.vdisks for storagedriver in storagerouter.storagedrivers] for vdisk in vpool_vdisks if vdisk.storagedriver_id == storagedriver.storagedriver_id]),
                                             atype = int)
                    self._register_dal_model(10, storagerouter, '#vmachines', "12",
                                             func = lambda storagerouter: len(set([vdisk.vmachine.guid for vpool_vdisks in [storagedriver.vpool.vdisks for storagedriver in storagerouter.storagedrivers] for vdisk in vpool_vdisks if vdisk.storagedriver_id == storagedriver.storagedriver_id])),
                                             atype = int)
                    self._register_dal_model(10, storagerouter, '#stored_data', "13",
                                             func = lambda storagerouter: sum([vdisk.vmachine.stored_data for vpool_vdisks in [storagedriver.vpool.vdisks for storagedriver in storagerouter.storagedrivers] for vdisk in vpool_vdisks if vdisk.storagedriver_id == storagedriver.storagedriver_id]),
                                             atype = int)
                    self.instance_oid += 1

            for vm in VMachineList.get_vmachines():
                _guids.add(vm.guid)
                if not self._check_added(vm):
                    if vm.is_vtemplate:
                        self._register_dal_model(11, vm, 'guid', "0")
                        self._register_dal_model(11, vm, 'name', "1")

                        def _children(vmt):
                            children = 0
                            disks = [vd.guid for vd in vmt.vdisks]
                            for vdisk in [vdisk.parent_vdisk_guid for item in [vm.vdisks for vm in VMachineList.get_vmachines() if not vm.is_vtemplate] for vdisk in item]:
                                for disk in disks:
                                    if vdisk == disk:
                                        children += 1
                            return children
                        self._register_dal_model(11, vm, '#children', 2, func = _children, atype = int)
                        self.instance_oid += 1

            for vm in VMachineList.get_vmachines():
                _guids.add(vm.guid)
                if not self._check_added(vm):
                    if not vm.is_vtemplate:
                        self._register_dal_model(0, vm, 'guid', "0")
                        self._register_dal_model(0, vm, 'name', "1")
                        self._register_dal_model(0, vm, 'statistics', "2.0", key = "operations", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.1", key = "cluster_cache_misses_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.2", key = "data_read", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.3", key = "sco_cache_misses", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.4", key = "sco_cache_hits_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.5", key = "sco_cache_hits", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.6", key = "write_operations", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.7", key = "cluster_cache_misses", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.8", key = "read_operations_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.9", key = "sco_cache_misses_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.10", key = "backend_write_operations", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.11", key = "backend_data_read", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.12", key = "cache_hits", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.13", key = "backend_write_operations_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.14", key = "metadata_store_hits_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.15", key = "metadata_store_misses", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.16", key = "backend_data_written", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.17", key = "data_read_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.18", key = "read_operations", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.19", key = "cluster_cache_hits", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.20", key = "data_written_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.21", key = "cluster_cache_hits_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.22", key = "cache_hits_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.23", key = "timestamp", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.24", key = "metadata_store_misses_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.25", key = "backend_data_written_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.26", key = "backend_read_operations", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.27", key = "data_written", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.28", key = "metadata_store_hits", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.29", key = "backend_data_read_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.30", key = "operations_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.31", key = "backend_read_operations_ps", atype = int)
                        self._register_dal_model(0, vm, 'statistics', "2.32", key = "data_transferred_ps", atype = int)
#.........这里部分代码省略.........
开发者ID:DarumasLegs,项目名称:framework,代码行数:103,代码来源:ovssnmpserver.py

示例5: get_vmachines

# 需要导入模块: from ovs.dal.lists.vmachinelist import VMachineList [as 别名]
# 或者: from ovs.dal.lists.vmachinelist.VMachineList import get_vmachines [as 别名]
 def get_vmachines():
     """
     Retrieve all Virtual Machines
     :return: Virtual Machine data-object list
     """
     return VMachineList.get_vmachines()
开发者ID:DarumasLegs,项目名称:integrationtests,代码行数:8,代码来源:general_vmachine.py


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