當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。