Revision cbe4a0a5 lib/hypervisor/hv_kvm.py

b/lib/hypervisor/hv_kvm.py
775 775
    if nic.nicparams[constants.NIC_LINK]:
776 776
      env["LINK"] = nic.nicparams[constants.NIC_LINK]
777 777

  
778
    def _BuildNetworkEnv(name, network, gateway, network6, gateway6,
779
                         network_type, mac_prefix, tags, env):
780
      if name:
781
        env["NETWORK_NAME"] = name
782
      if network:
783
        env["NETWORK_SUBNET"] = network
784
      if gateway:
785
        env["NETWORK_GATEWAY"] = gateway
786
      if network6:
787
        env["NETWORK_SUBNET6"] = network6
788
      if gateway6:
789
        env["NETWORK_GATEWAY6"] = gateway6
790
      if mac_prefix:
791
        env["NETWORK_MAC_PREFIX"] = mac_prefix
792
      if network_type:
793
        env["NETWORK_TYPE"] = network_type
794
      if tags:
795
        env["NETWORK_TAGS"] = " ".join(tags)
796

  
797
      return env
798

  
799

  
778 800
    if nic.network:
779
      env["NETWORK"] = nic.network
801
      n = objects.Network.FromDict(nic.netinfo)
802
      _BuildNetworkEnv(nic.network, n.network, n.gateway,
803
                       n.network6, n.gateway6, n.network_type,
804
                       n.mac_prefix, n.tags, env)
780 805

  
781 806
    if nic.nicparams[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED:
782 807
      env["BRIDGE"] = nic.nicparams[constants.NIC_LINK]

Also available in: Unified diff