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)
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)