Merge "Support setting vlan in config drive"
This commit is contained in:
commit
fea24620d9
@ -31,6 +31,7 @@ def main():
|
||||
ipv4_interface_mac=dict(required=False),
|
||||
ipv4_nameserver=dict(required=False),
|
||||
ipv4_subnet_mask=dict(required=False),
|
||||
vlan_id=dict(required=False),
|
||||
network_mtu=dict(required=False),
|
||||
nics=dict(required=False),
|
||||
node_network_info=dict(required=False)
|
||||
@ -70,6 +71,18 @@ def main():
|
||||
})
|
||||
else:
|
||||
for i, nic in enumerate(module.params['nics']):
|
||||
nic_id = nic['mac']
|
||||
if module.params['vlan_id']:
|
||||
nic_id = 'vlan-%s' % nic['mac']
|
||||
|
||||
links.append({
|
||||
'id': nic_id,
|
||||
'type': 'vlan',
|
||||
'vlan_id': module.params['vlan_id'],
|
||||
'vlan_link': nic['mac'],
|
||||
'vlan_mac_address': nic['mac']
|
||||
})
|
||||
|
||||
links.append({
|
||||
'id': nic['mac'],
|
||||
'type': 'phy',
|
||||
@ -79,8 +92,8 @@ def main():
|
||||
|
||||
if i == 0:
|
||||
networks.append({
|
||||
'id': 'ipv4-%s' % nic['mac'],
|
||||
'link': nic['mac'],
|
||||
'id': 'ipv4-%s' % nic_id,
|
||||
'link': nic_id,
|
||||
'type': 'ipv4',
|
||||
'ip_address': module.params['ipv4_address'],
|
||||
'netmask': module.params['ipv4_subnet_mask'],
|
||||
@ -95,8 +108,8 @@ def main():
|
||||
})
|
||||
else:
|
||||
networks.append({
|
||||
'id': 'ipv4-dhcp-%s' % nic['mac'],
|
||||
'link': nic['mac'],
|
||||
'id': 'ipv4-dhcp-%s' % nic_id,
|
||||
'link': nic_id,
|
||||
'type': 'ipv4_dhcp',
|
||||
})
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
ipv4_interface_mac: "{{ ipv4_interface_mac | default('') }}"
|
||||
ipv4_nameserver: "{{ ipv4_nameserver }}"
|
||||
ipv4_subnet_mask: "{{ ipv4_subnet_mask }}"
|
||||
vlan_id: "{{ vlan_id | default('') }}"
|
||||
network_mtu: "{{ network_mtu }}"
|
||||
nics: "{{ nics }}"
|
||||
node_network_info: "{{ node_network_info | default('') }}"
|
||||
|
Loading…
Reference in New Issue
Block a user