diff --git a/roles/copr/backend/templates/provision/libvirt-new b/roles/copr/backend/templates/provision/libvirt-new index 447635f5d3..682e6b5fb5 100755 --- a/roles/copr/backend/templates/provision/libvirt-new +++ b/roles/copr/backend/templates/provision/libvirt-new @@ -381,22 +381,25 @@ def get_fedora_ipv6_address(pool_id, id_in_pool, dev=False): Statically assign IPv6 + Gateway based on id_in_pool. """ gateway = "2620:52:3:1:ffff:ffff:ffff:fffe" - base = "2620:52:3:1:dead:beef:cafe:c1" + base = "2620:52:3:1:dead:beef:cafe:c" + + # The initial 256 addresses (:c0XX) is reserved for hypervisor machines + # itself. + start = 0x100 + + # each hypervisor has block of 64 IPs + block = 64 - offset = 0 - # 01 => 0, 02 => 1, ... hv_id, _, _ = get_hv_identification_from_pool_id(pool_id) - # we have block of 256 ipv6 addresses for builder, and 4 hypervisors - block = int(256 / 4) + # give 48 IPs to each hv (32 prod, some dev), currently 4*48=192 ips offset = hv_id * block if not dev: - # give the dev only 8 addresses + # give the first 8 addresses to Copr dev instance offset += 8 - addr_number = offset + int(id_in_pool) - addr_number = hex(addr_number).replace("0x", "") - + addr_number = start + offset + int(id_in_pool) + addr_number = "{0:#05x}".format(addr_number).replace("0x", "") return base + addr_number, gateway