Revision d676dbea lib/cmdlib/instance_utils.py

b/lib/cmdlib/instance_utils.py
59 59
  @type vcpus: string
60 60
  @param vcpus: the count of VCPUs the instance has
61 61
  @type nics: list
62
  @param nics: list of tuples (name, uuid, ip, mac, mode, link, net, netinfo)
63
      representing the NICs the instance has
62
  @param nics: list of tuples (name, uuid, ip, mac, mode, link, vlan, net,
63
      netinfo) representing the NICs the instance has
64 64
  @type disk_template: string
65 65
  @param disk_template: the disk template of the instance
66 66
  @type disks: list
......
94 94
    }
95 95
  if nics:
96 96
    nic_count = len(nics)
97
    for idx, (name, uuid, ip, mac, mode, link, net, netinfo) in enumerate(nics):
97
    for idx, (name, uuid, ip, mac, mode, link, vlan, net, netinfo) \
98
        in enumerate(nics):
98 99
      if ip is None:
99 100
        ip = ""
100 101
      if name:
......
104 105
      env["INSTANCE_NIC%d_MAC" % idx] = mac
105 106
      env["INSTANCE_NIC%d_MODE" % idx] = mode
106 107
      env["INSTANCE_NIC%d_LINK" % idx] = link
108
      env["INSTANCE_NIC%d_VLAN" % idx] = vlan
107 109
      if netinfo:
108 110
        nobj = objects.Network.FromDict(netinfo)
109 111
        env.update(nobj.HooksDict("INSTANCE_NIC%d_" % idx))
......
112 114
        # network, but the relevant network entry was not in the config. This
113 115
        # should be made impossible.
114 116
        env["INSTANCE_NIC%d_NETWORK_NAME" % idx] = net
115
      if mode == constants.NIC_MODE_BRIDGED:
117
      if mode == constants.NIC_MODE_BRIDGED or \
118
         mode == constants.NIC_MODE_OVS:
116 119
        env["INSTANCE_NIC%d_BRIDGE" % idx] = link
117 120
  else:
118 121
    nic_count = 0
......
317 320
  filled_params = cluster.SimpleFillNIC(nic.nicparams)
318 321
  mode = filled_params[constants.NIC_MODE]
319 322
  link = filled_params[constants.NIC_LINK]
323
  vlan = filled_params[constants.NIC_VLAN]
320 324
  netinfo = None
321 325
  if nic.network:
322 326
    nobj = lu.cfg.GetNetwork(nic.network)
323 327
    netinfo = objects.Network.ToDict(nobj)
324
  return (nic.name, nic.uuid, nic.ip, nic.mac, mode, link, nic.network, netinfo)
328
  return (nic.name, nic.uuid, nic.ip, nic.mac, mode, link, vlan,
329
          nic.network, netinfo)
325 330

  
326 331

  
327 332
def NICListToTuple(lu, nics):

Also available in: Unified diff