Create radvd configuration and start it <--> VM's which is being started has IPv6 network which is global
This commit is contained in:
parent
f79097cae9
commit
ec3cf49799
1 changed files with 5 additions and 2 deletions
|
@ -8,6 +8,7 @@ import os
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
|
import ipaddress
|
||||||
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from string import Template
|
from string import Template
|
||||||
|
@ -90,6 +91,8 @@ class VMM:
|
||||||
tap_id=tap,
|
tap_id=tap,
|
||||||
ip=network_ipv6)
|
ip=network_ipv6)
|
||||||
all_networks = self.etcd_client.get_prefix('/v1/network/', value_in_json=True)
|
all_networks = self.etcd_client.get_prefix('/v1/network/', value_in_json=True)
|
||||||
|
|
||||||
|
if ipaddress.ip_network(network_ipv6).is_global:
|
||||||
update_radvd_conf(all_networks)
|
update_radvd_conf(all_networks)
|
||||||
|
|
||||||
command += " -netdev tap,id=vmnet{net_id},ifname={tap},script=no,downscript=no" \
|
command += " -netdev tap,id=vmnet{net_id},ifname={tap},script=no,downscript=no" \
|
||||||
|
@ -361,7 +364,7 @@ def update_radvd_conf(all_networks):
|
||||||
networks = {
|
networks = {
|
||||||
net.value['ipv6']: net.value['id']
|
net.value['ipv6']: net.value['id']
|
||||||
for net in all_networks
|
for net in all_networks
|
||||||
if net.value.get('ipv6')
|
if net.value.get('ipv6') and ipaddress.ip_network(net.value.get('ipv6')).is_global
|
||||||
}
|
}
|
||||||
radvd_template = open(os.path.join(network_script_base,
|
radvd_template = open(os.path.join(network_script_base,
|
||||||
'radvd-template.conf'), 'r').read()
|
'radvd-template.conf'), 'r').read()
|
||||||
|
|
Loading…
Reference in a new issue