Commit 626f0309 authored by Julien Muchembled's avatar Julien Muchembled

format: fix some conflicts about tun interfaces when changing the number of partitions

parent 9a9d4b0a
...@@ -436,6 +436,7 @@ class Computer(object): ...@@ -436,6 +436,7 @@ class Computer(object):
config=config, config=config,
) )
partition_amount = int(config.partition_amount)
for partition_index, partition_dict in enumerate(dumped_dict['partition_list']): for partition_index, partition_dict in enumerate(dumped_dict['partition_list']):
if partition_dict['user']: if partition_dict['user']:
...@@ -454,10 +455,10 @@ class Computer(object): ...@@ -454,10 +455,10 @@ class Computer(object):
tap = Tap(partition_dict['reference']) tap = Tap(partition_dict['reference'])
if partition_dict.get('tun') is not None and partition_dict['tun'].get('ipv4_addr') is not None: if partition_dict.get('tun') is not None and partition_dict['tun'].get('ipv4_addr') is not None:
tun = Tun(partition_dict['tun']['name'], partition_index, len(dumped_dict['partition_list'])) tun = Tun(partition_dict['tun']['name'], partition_index, partition_amount)
tun.ipv4_addr = partition_dict['tun']['ipv4_addr'] tun.ipv4_addr = partition_dict['tun']['ipv4_addr']
else: else:
tun = Tun("slaptun" + str(partition_index), partition_index, len(dumped_dict['partition_list'])) tun = Tun("slaptun" + str(partition_index), partition_index, partition_amount)
address_list = partition_dict['address_list'] address_list = partition_dict['address_list']
external_storage_list = partition_dict.get('external_storage_list', []) external_storage_list = partition_dict.get('external_storage_list', [])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment