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


Python Device.interfaceSetAdd方法代码示例

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


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

示例1: interfacesAdd

# 需要导入模块: from tomato.devices import Device [as 别名]
# 或者: from tomato.devices.Device import interfaceSetAdd [as 别名]
	def interfacesAdd(self, name, properties):
		fault.check(self.state != State.STARTED, "Repy does not support adding interfaces to running VMs: %s" % self.name)
		import re
		fault.check(re.match("eth(\d+)", name), "Invalid interface name: %s" % name)
		try:
			fault.check(not self.interfaceSetGet(name), "Duplicate interface name: %s" % name)
		except Interface.DoesNotExist: #pylint: disable-msg=W0702
			pass
		iface = Interface()
		iface.name = name
		iface.device = self
		iface.init()
		iface.save()
		Device.interfaceSetAdd(self, iface)
开发者ID:david-hock,项目名称:ToMaTo,代码行数:16,代码来源:prog.py

示例2: interfacesAdd

# 需要导入模块: from tomato.devices import Device [as 别名]
# 或者: from tomato.devices.Device import interfaceSetAdd [as 别名]
	def interfacesAdd(self, name, properties): #@UnusedVariable, pylint: disable-msg=W0613
		fault.check(self.state != State.STARTED, "Changes of running KVMs are not supported")
		fault.check(re.match("eth(\d+)", name), "Invalid interface name: %s" % name)
		iface = Interface()
		try:
			if self.interfaceSetGet(name):
				raise fault.new("Duplicate interface name: %s" % name)
		except Interface.DoesNotExist: #pylint: disable-msg=W0702
			pass
		iface.name = name
		iface.device = self
		iface.init()
		if self.state == State.PREPARED:
			qm.addInterface(self.host, self.getVmid(), iface.name)
		iface.save()
		Device.interfaceSetAdd(self, iface)
开发者ID:joanmarkt,项目名称:ToMaTo,代码行数:18,代码来源:kvm.py

示例3: interfacesAdd

# 需要导入模块: from tomato.devices import Device [as 别名]
# 或者: from tomato.devices.Device import interfaceSetAdd [as 别名]
	def interfacesAdd(self, name, properties):
		fault.check(self.state != State.STARTED, "OpenVZ does not support adding interfaces to running VMs: %s" % self.name)
		import re
		fault.check(re.match("eth(\d+)", name), "Invalid interface name: %s" % name)
		try:
			fault.check(not self.interfaceSetGet(name), "Duplicate interface name: %s" % name)
		except Interface.DoesNotExist: #pylint: disable-msg=W0702
			pass
		iface = ConfiguredInterface()
		iface.name = name
		iface.device = self
		iface.init()
		if self.state == State.PREPARED or self.state == State.STARTED:
			vzctl.addInterface(self.host, self.getVmid(), iface.name)
		iface.configure(properties)
		iface.save()
		Device.interfaceSetAdd(self, iface)
开发者ID:david-hock,项目名称:ToMaTo,代码行数:19,代码来源:openvz.py


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