本文整理汇总了Python中nailgun.network.manager.NetworkManager.clear_vlans方法的典型用法代码示例。如果您正苦于以下问题:Python NetworkManager.clear_vlans方法的具体用法?Python NetworkManager.clear_vlans怎么用?Python NetworkManager.clear_vlans使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.network.manager.NetworkManager
的用法示例。
在下文中一共展示了NetworkManager.clear_vlans方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_cluster_resp
# 需要导入模块: from nailgun.network.manager import NetworkManager [as 别名]
# 或者: from nailgun.network.manager.NetworkManager import clear_vlans [as 别名]
def remove_cluster_resp(cls, **kwargs):
network_manager = NetworkManager()
logger.info(
"RPC method remove_cluster_resp received: %s" %
json.dumps(kwargs)
)
task_uuid = kwargs.get('task_uuid')
cls.remove_nodes_resp(**kwargs)
task = db().query(Task).filter_by(uuid=task_uuid).first()
cluster = task.cluster
if task.status in ('ready',):
logger.debug("Removing environment itself")
cluster_name = cluster.name
nws = itertools.chain(
*[n.networks for n in cluster.network_groups]
)
ips = db().query(IPAddr).filter(
IPAddr.network.in_([n.id for n in nws])
)
map(db().delete, ips)
db().commit()
db().delete(cluster)
db().commit()
# Dmitry's hack for clearing VLANs without networks
network_manager.clear_vlans()
notifier.notify(
"done",
u"Environment '%s' and all its nodes are deleted" % (
cluster_name
)
)
elif task.status in ('error',):
cluster.status = 'error'
db().add(cluster)
db().commit()
if not task.message:
task.message = "Failed to delete nodes:\n{0}".format(
cls._generate_error_message(
task,
error_types=('deletion',)
)
)
notifier.notify(
"error",
task.message,
cluster.id
)