Revision d89168ff lib/cmdlib.py
b/lib/cmdlib.py | ||
---|---|---|
1453 | 1453 |
@type vcpus: string |
1454 | 1454 |
@param vcpus: the count of VCPUs the instance has |
1455 | 1455 |
@type nics: list |
1456 |
@param nics: list of tuples (ip, mac, mode, link, network) representing
|
|
1456 |
@param nics: list of tuples (ip, mac, mode, link, net, netinfo) representing
|
|
1457 | 1457 |
the NICs the instance has |
1458 | 1458 |
@type disk_template: string |
1459 | 1459 |
@param disk_template: the disk template of the instance |
... | ... | |
1495 | 1495 |
env["INSTANCE_NIC%d_MAC" % idx] = mac |
1496 | 1496 |
env["INSTANCE_NIC%d_MODE" % idx] = mode |
1497 | 1497 |
env["INSTANCE_NIC%d_LINK" % idx] = link |
1498 |
if network: |
|
1498 |
if netinfo: |
|
1499 |
nobj = objects.Network.FromDict(netinfo) |
|
1500 |
env.update(nobj.HooksDict("INSTANCE_NIC%d_" % idx)) |
|
1501 |
elif network: |
|
1502 |
# FIXME: broken network reference: the instance NIC specifies a |
|
1503 |
# network, but the relevant network entry was not in the config. This |
|
1504 |
# should be made impossible. |
|
1499 | 1505 |
env["INSTANCE_NIC%d_NETWORK" % idx] = net |
1500 |
if netinfo: |
|
1501 |
nobj = objects.Network.FromDict(netinfo) |
|
1502 |
if nobj.network: |
|
1503 |
env["INSTANCE_NIC%d_NETWORK_SUBNET" % idx] = nobj.network |
|
1504 |
if nobj.gateway: |
|
1505 |
env["INSTANCE_NIC%d_NETWORK_GATEWAY" % idx] = nobj.gateway |
|
1506 |
if nobj.network6: |
|
1507 |
env["INSTANCE_NIC%d_NETWORK_SUBNET6" % idx] = nobj.network6 |
|
1508 |
if nobj.gateway6: |
|
1509 |
env["INSTANCE_NIC%d_NETWORK_GATEWAY6" % idx] = nobj.gateway6 |
|
1510 |
if nobj.mac_prefix: |
|
1511 |
env["INSTANCE_NIC%d_NETWORK_MAC_PREFIX" % idx] = nobj.mac_prefix |
|
1512 |
if nobj.network_type: |
|
1513 |
env["INSTANCE_NIC%d_NETWORK_TYPE" % idx] = nobj.network_type |
|
1514 |
if nobj.tags: |
|
1515 |
env["INSTANCE_NIC%d_NETWORK_TAGS" % idx] = " ".join(nobj.tags) |
|
1516 | 1506 |
if mode == constants.NIC_MODE_BRIDGED: |
1517 | 1507 |
env["INSTANCE_NIC%d_BRIDGE" % idx] = link |
1518 | 1508 |
else: |
Also available in: Unified diff