Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 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