コード例 #1
0
ファイル: network.py プロジェクト: binblee/eru-core
    def acquire_gateway_ip(self, host):
        ipnum = rds.spop(self.gatekey)
        if not ipnum:
            return

        vg = VLanGateway.create(ipnum, self.id, host.id)
        if not vg:
            rds.sadd(self.gatekey, ipnum)
            return

        return vg
コード例 #2
0
ファイル: network.py プロジェクト: linzhonghong/eru-core
 def acquire_ip(self):
     """take an IP from network, return an IP object"""
     ipnum = rds.spop(self.storekey)
     return ipnum and IP.create(ipnum, self) or None