示例#1
0
    def updateDataBridge(self, interface):
        with MutexStore.getObjectLock(self.getLockIdentifier()):
            if self.networkInterfaces.filter(id=interface.id).count() != 1:
                raise Exception(
                    "Can not update bridge interface because it does not exist or id is duplicated"
                )

            NetworkInterface.updateServerDataBridge(interface.id,
                                                    interface.getName(),
                                                    interface.getMacStr(),
                                                    interface.getSwitchID(),
                                                    interface.getPort())
示例#2
0
    def __createEnslavedDataVMNetworkInterface(self, serverInterface):
        #Obtain
        macObj = self.__allocateMacFromSubscribedRanges()

        interface = NetworkInterface.createVMDataInterface(
            serverInterface.getName() + "-slave", macObj)

        #Enslave it
        serverInterface.attachInterfaceToBridge(interface)
        return interface
示例#3
0
    def addDataBridge(self, name, macStr, switchId, port):
        with MutexStore.getObjectLock(self.getLockIdentifier()):
            if self.networkInterfaces.filter(name=name,
                                             isBridge=True).count() > 0:
                raise Exception(
                    "Another data bridge with the same name already exists in this Server"
                )

            netInt = NetworkInterface.createServerDataBridge(
                name, macStr, switchId, port)
            self.networkInterfaces.add(netInt)
            self.autoSave()
示例#4
0
    def setMgmtBridge(self, name, macStr):
        with MutexStore.getObjectLock(self.getLockIdentifier()):
            nInter = self.networkInterfaces.filter(isMgmt=True, isBridge=True)
            if nInter.count() == 1:
                mgmt = nInter.get()
                mgmt.setName(name)
                mgmt.setMacStr(macStr)

            elif nInter.count() == 0:
                mgmt = NetworkInterface.createServerMgmtBridge(name, macStr)
                self.networkInterfaces.add(mgmt)
            else:
                raise Exception(
                    "Unexpected length of managment NetworkInterface query")
            self.autoSave()