network: drop needless validation
Networks that are neither primary nor secondary are blocked on
admission. There is no need to protect against them in the code body.
@@ -71,13 +71,6 @@ func getNetworksAndCniNetworks(vmi *v1.VirtualMachineInstance) (map[string]*v1.N
return networks, cniNetworks
}
-func networkIsImplementable(network *v1.Network) error {
- if network.Pod == nil && network.Multus == nil {
- return fmt.Errorf("Network not implemented")
- }
- return nil
-}
-
func getPodInterfaceName(networks map[string]*v1.Network, cniNetworks map[string]int, ifaceName string) string {
if networks[ifaceName].Multus != nil && !networks[ifaceName].Multus.Default {
// multus pod interfaces named netX
@@ -94,10 +87,6 @@ func SetupPodNetworkPhase1(vmi *v1.VirtualMachineInstance, pid int, cacheFactory
if !ok {
return fmt.Errorf("failed to find a network %s", iface.Name)
}
- err := networkIsImplementable(network)
- if err != nil {
- return err
- }
podnic := podNICFactory(cacheFactory)
podInterfaceName := getPodInterfaceName(networks, cniNetworks, iface.Name)
err = podNIC.PlugPhase1(podnic, vmi, &vmi.Spec.Domain.Devices.Interfaces[i], network, podInterfaceName, pid)
@@ -115,10 +104,6 @@ func SetupPodNetworkPhase2(vmi *v1.VirtualMachineInstance, domain *api.Domain, c
if !ok {
return fmt.Errorf("failed to find a network %s", iface.Name)
}
- err := networkIsImplementable(network)
- if err != nil {
- return err
- }
podnic := podNICFactory(cacheFactory)
podInterfaceName := getPodInterfaceName(networks, cniNetworks, iface.Name)
err = podNIC.PlugPhase2(podnic, vmi, &vmi.Spec.Domain.Devices.Interfaces[i], network, domain, podInterfaceName)
