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


Python EtcdConfiguration.delete方法代码示例

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


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

示例1: teardown

# 需要导入模块: from ovs.extensions.db.etcd.configuration import EtcdConfiguration [as 别名]
# 或者: from ovs.extensions.db.etcd.configuration.EtcdConfiguration import delete [as 别名]
def teardown():
    """
    Teardown for Arakoon package, will be executed when all started tests in this package have ended
    Removal actions of possible things left over after the test-run
    :return: None
    """
    autotest_config = General.get_config()
    backend_name = autotest_config.get('backend', 'name')
    backend = GeneralBackend.get_by_name(backend_name)
    if backend is not None:
        GeneralAlba.remove_alba_backend(backend.alba_backend)

    for storagerouter in GeneralStorageRouter.get_masters():
        root_client = SSHClient(storagerouter, username='root')
        if GeneralService.get_service_status(name='ovs-scheduled-tasks',
                                             client=root_client) is False:
            GeneralService.start_service(name='ovs-scheduled-tasks',
                                         client=root_client)

        for location in TEST_CLEANUP:
            root_client.run('rm -rf {0}'.format(location))

    for key in KEY_CLEANUP:
        if EtcdConfiguration.exists('{0}/{1}'.format(GeneralArakoon.ETCD_CONFIG_ROOT, key), raw = True):
            EtcdConfiguration.delete('{0}/{1}'.format(GeneralArakoon.ETCD_CONFIG_ROOT, key))
开发者ID:DarumasLegs,项目名称:integrationtests,代码行数:27,代码来源:__init__.py

示例2: delete_config

# 需要导入模块: from ovs.extensions.db.etcd.configuration import EtcdConfiguration [as 别名]
# 或者: from ovs.extensions.db.etcd.configuration.EtcdConfiguration import delete [as 别名]
 def delete_config(self):
     """
     Deletes a configuration file
     """
     key = ArakoonClusterConfig.ETCD_CONFIG_KEY.format(self.cluster_id)
     if EtcdConfiguration.exists(key, raw=True):
         EtcdConfiguration.delete(key, raw=True)
开发者ID:DarumasLegs,项目名称:framework,代码行数:9,代码来源:ArakoonInstaller.py

示例3: delete_etcd_config

# 需要导入模块: from ovs.extensions.db.etcd.configuration import EtcdConfiguration [as 别名]
# 或者: from ovs.extensions.db.etcd.configuration.EtcdConfiguration import delete [as 别名]
 def delete_etcd_config(cluster_name):
     """
     Remove the etcd entry for arakoon cluster_name
     :param cluster_name: Name of the arakoon cluster
     :return: None
     """
     etcd_key = GeneralArakoon.ETCD_CONFIG_KEY.format(cluster_name)
     if EtcdConfiguration.exists(etcd_key, raw=True):
         EtcdConfiguration.delete(os.path.dirname(etcd_key))
开发者ID:DarumasLegs,项目名称:integrationtests,代码行数:11,代码来源:general_arakoon.py

示例4: delete_cluster

# 需要导入模块: from ovs.extensions.db.etcd.configuration import EtcdConfiguration [as 别名]
# 或者: from ovs.extensions.db.etcd.configuration.EtcdConfiguration import delete [as 别名]
    def delete_cluster(cluster_name, ip):
        """
        Deletes a complete cluster
        :param ip: IP address of the last node of a cluster
        :param cluster_name: Name of the cluster to remove
        """
        logger.debug('Deleting cluster {0} on {1}'.format(cluster_name, ip))
        config = ArakoonClusterConfig(cluster_name)
        config.load_config()

        # Cleans up a complete cluster (remove services, directories and configuration files)
        for node in config.nodes:
            ArakoonInstaller._destroy_node(config, node)
        EtcdConfiguration.delete('{0}/{1}'.format(ArakoonInstaller.ETCD_CONFIG_ROOT, cluster_name), raw=True)
        logger.debug('Deleting cluster {0} on {1} completed'.format(cluster_name, ip))
开发者ID:dawnpower,项目名称:framework,代码行数:17,代码来源:ArakoonInstaller.py

示例5: _create_unit

# 需要导入模块: from ovs.extensions.db.etcd.configuration import EtcdConfiguration [as 别名]
# 或者: from ovs.extensions.db.etcd.configuration.EtcdConfiguration import delete [as 别名]
 def _create_unit(fleet_name, template_file):
     from ovs.extensions.db.etcd.configuration import EtcdConfiguration
     start = time.time()
     while time.time() - start < 60:
         try:
             unit = FLEET_CLIENT.create_unit(fleet_name, fleet.Unit(from_string=template_file))
             return unit
         except fleet.APIError as ae:
             if ae.code == 500:
                 FleetCtl._logger.warning('API Error in fleet, most likely caused by etcd, retrying. {0}'.format(ae))
                 key = '/_coreos.com/fleet/job/{0}/object'.format(fleet_name)
                 if EtcdConfiguration.exists(key):
                     EtcdConfiguration.delete(key)
                 time.sleep(1)
             else:
                 raise
     raise RuntimeError('Failed to create ')
开发者ID:DarumasLegs,项目名称:framework,代码行数:19,代码来源:fleetctl.py

示例6: delete_config

# 需要导入模块: from ovs.extensions.db.etcd.configuration import EtcdConfiguration [as 别名]
# 或者: from ovs.extensions.db.etcd.configuration.EtcdConfiguration import delete [as 别名]
 def delete_config(self):
     """
     Deletes a configuration file
     """
     EtcdConfiguration.delete(ArakoonClusterConfig.ETCD_CONFIG_KEY.format(self.cluster_id), raw=True)
开发者ID:jeroenmaelbrancke,项目名称:openvstorage,代码行数:7,代码来源:ArakoonInstaller.py

示例7: remove_asd

# 需要导入模块: from ovs.extensions.db.etcd.configuration import EtcdConfiguration [as 别名]
# 或者: from ovs.extensions.db.etcd.configuration.EtcdConfiguration import delete [as 别名]
    def remove_asd(node_guid, asd_id, expected_safety):
        """
        Removes an ASD

        :param node_guid: Guid of the node to remove a disk from
        :type node_guid: str

        :param asd_id: ASD to remove
        :type asd_id: str

        :param expected_safety: Expected safety after having removed the disk
        :type expected_safety: dict

        :return: True
        :rtype: bool
        """
        node = AlbaNode(node_guid)
        AlbaNodeController._logger.debug('Removing ASD {0} at node {1}'.format(asd_id, node.ip))
        model_asd = None
        for disk in node.disks:
            for asd in disk.asds:
                if asd.asd_id == asd_id:
                    model_asd = asd
                    break
            if model_asd is not None:
                break
        if model_asd is None:
            raise RuntimeError('Could not locate asd {0} in the model'.format(asd_id))
        alba_backend = model_asd.alba_backend

        asds = {}
        try:
            asds = node.client.get_asds()
        except (requests.ConnectionError, requests.Timeout):
            AlbaNodeController._logger.warning('Could not connect to node {0} to validate asd'.format(node.guid))
        disk_id = None
        for _disk_id in asds:
            if asd_id in asds[_disk_id]:
                disk_id = _disk_id
                break

        AlbaController.remove_units(alba_backend.guid, [asd_id], absorb_exception=True)
        if disk_id is not None:
            final_safety = AlbaController.calculate_safety(alba_backend.guid, [asd_id])
            safety_lost = final_safety['lost']
            safety_crit = final_safety['critical']
            if (safety_crit != 0 or safety_lost != 0) and (safety_crit != expected_safety['critical'] or safety_lost != expected_safety['lost']):
                raise RuntimeError('Cannot remove ASD {0} as the current safety is not as expected ({1} vs {2})'.format(asd_id, final_safety, expected_safety))

            result = node.client.delete_asd(disk_id, asd_id)
            if result['_success'] is False:
                raise RuntimeError('Error removing ASD: {0}'.format(result['_error']))
        else:
            AlbaNodeController._logger.warning('Alba decommission osd {0} without safety validations (node down)'.format(asd_id))
        if EtcdConfiguration.exists(AlbaNodeController.ASD_CONFIG.format(asd_id), raw=True):
            EtcdConfiguration.delete(AlbaNodeController.ASD_CONFIG_DIR.format(asd_id), raw=True)

        model_asd.delete()
        alba_backend.invalidate_dynamics()
        alba_backend.backend.invalidate_dynamics()
        if node.storagerouter is not None:
            DiskController.sync_with_reality(node.storagerouter_guid)

        return disk_id
开发者ID:DarumasLegs,项目名称:framework-alba-plugin,代码行数:66,代码来源:albanodecontroller.py


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