Revision 05440845 lib/hypervisor/hv_xen.py

b/lib/hypervisor/hv_xen.py
767 767
    constants.HV_CPU_CAP: hv_base.NO_CHECK,
768 768
    constants.HV_CPU_WEIGHT:
769 769
      (False, lambda x: 0 < x < 65535, "invalid weight", None, None),
770
    constants.HV_VIF_TYPE:
771
      hv_base.ParamInSet(False, constants.HT_HVM_VALID_VIF_TYPES),
770 772
    }
771 773

  
772 774
  @classmethod
......
840 842
      config.write("localtime = 1\n")
841 843

  
842 844
    vif_data = []
845
    # Note: what is called 'nic_type' here, is used as value for the xen nic
846
    # vif config parameter 'model'. For the xen nic vif parameter 'type', we use
847
    # the 'vif_type' to avoid a clash of notation.
843 848
    nic_type = hvp[constants.HV_NIC_TYPE]
849

  
844 850
    if nic_type is None:
851
      vif_type_str = ""
852
      if hvp[constants.HV_VIF_TYPE]:
853
        vif_type_str = ", type=%s" % hvp[constants.HV_VIF_TYPE]
845 854
      # ensure old instances don't change
846
      nic_type_str = ", type=ioemu"
855
      nic_type_str = vif_type_str
847 856
    elif nic_type == constants.HT_NIC_PARAVIRTUAL:
848 857
      nic_type_str = ", type=paravirtualized"
849 858
    else:
850
      nic_type_str = ", model=%s, type=ioemu" % nic_type
859
      # parameter 'model' is only valid with type 'ioemu'
860
      nic_type_str = ", model=%s, type=%s" % \
861
        (nic_type, constants.HT_HVM_VIF_IOEMU)
851 862
    for nic in instance.nics:
852 863
      nic_str = "mac=%s%s" % (nic.mac, nic_type_str)
853 864
      ip = getattr(nic, "ip", None)

Also available in: Unified diff