Revision d676dbea

b/lib/client/gnt_instance.py
1065 1065

  
1066 1066
def _FormatInstanceNicInfo(idx, nic):
1067 1067
  """Helper function for L{_FormatInstanceInfo()}"""
1068
  (name, uuid, ip, mac, mode, link, _, netinfo) = nic
1068
  (name, uuid, ip, mac, mode, link, vlan, _, netinfo) = nic
1069 1069
  network_name = None
1070 1070
  if netinfo:
1071 1071
    network_name = netinfo["name"]
......
1075 1075
    ("IP", str(ip)),
1076 1076
    ("mode", str(mode)),
1077 1077
    ("link", str(link)),
1078
    ("vlan", str(vlan)),
1078 1079
    ("network", str(network_name)),
1079 1080
    ("UUID", str(uuid)),
1080 1081
    ("name", str(name)),
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):
b/src/Ganeti/OpParams.hs
417 417
  , optionalField $ simpleField C.inicMode [t| NonEmptyString |]
418 418
  , optionalField $ simpleField C.inicLink [t| NonEmptyString |]
419 419
  , optionalField $ simpleField C.inicName [t| NonEmptyString |]
420
  , optionalField $ simpleField C.inicVlan [t| NonEmptyString |]
420 421
  ])
421 422

  
422 423
-- | Disk modification definition. FIXME: disksize should be VTYPE_UNIT.
b/test/hs/Test/Ganeti/OpCodes.hs
75 75
instance Arbitrary INicParams where
76 76
  arbitrary = INicParams <$> genMaybe genNameNE <*> genMaybe genName <*>
77 77
              genMaybe genNameNE <*> genMaybe genNameNE <*> genMaybe genNameNE
78
              <*> genMaybe genNameNE
78 79

  
79 80
instance Arbitrary IDiskParams where
80 81
  arbitrary = IDiskParams <$> arbitrary <*> arbitrary <*>
b/tools/move-instance
503 503
      constants.INIC_MAC: mac,
504 504
      constants.INIC_MODE: mode,
505 505
      constants.INIC_LINK: link,
506
      constants.INIC_NAME: vlan,
506 507
      constants.INIC_NETWORK: network,
507 508
      constants.INIC_NAME: nic_name
508
      } for nic_name, _, ip, mac, mode, link, network, _ in instance["nics"]]
509
      } for nic_name, _, ip, mac, mode, link, vlan, network, _
510
        in instance["nics"]]
509 511

  
510 512
    if len(override_nics) > len(nics):
511 513
      raise Error("Can not create new NICs")

Also available in: Unified diff