本文整理匯總了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)
示例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)
示例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)