Properly handle cluster networks in provisioner

This commit is contained in:
Joshua Boniface 2021-06-02 15:57:46 -04:00
parent 34ef055954
commit 7de7e1bc71
1 changed files with 5 additions and 2 deletions

View File

@ -1211,7 +1211,7 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True, script_r
cluster_networks, _discard = pvc_network.getClusterNetworkList(zkhandler)
for network in vm_data['networks']:
vni = str(network['vni'])
if vni not in cluster_networks:
if vni not in cluster_networks and vni not in ['upstream', 'cluster', 'storage']:
raise ClusterError('The network VNI "{}" is not present on the cluster.'.format(vni))
print("All configured networks for VM are valid")
@ -1327,6 +1327,9 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True, script_r
network_id = 0
for network in vm_data['networks']:
vni = network['vni']
if vni in ['upstream', 'cluster', 'storage']:
eth_bridge = "br{}".format(vni)
else:
eth_bridge = "vmbr{}".format(vni)
vm_id_hex = '{:x}'.format(int(vm_id % 16))