Revision d4117a72
b/lib/cli.py | ||
---|---|---|
2467 | 2467 |
disks=disks, |
2468 | 2468 |
disk_template=opts.disk_template, |
2469 | 2469 |
nics=nics, |
2470 |
conflicts_check=opts.conflicts_check, |
|
2470 | 2471 |
pnode=pnode, snode=snode, |
2471 | 2472 |
ip_check=opts.ip_check, |
2472 | 2473 |
name_check=opts.name_check, |
b/lib/client/gnt_instance.py | ||
---|---|---|
220 | 220 |
|
221 | 221 |
fmtoverride = dict.fromkeys(["tags", "disk.sizes", "nic.macs", "nic.ips", |
222 | 222 |
"nic.modes", "nic.links", "nic.bridges", |
223 |
"nic.networks", |
|
223 | 224 |
"snodes", "snodes.group", "snodes.group.uuid"], |
224 | 225 |
(lambda value: ",".join(str(item) |
225 | 226 |
for item in value), |
... | ... | |
1177 | 1178 |
FormatParameterDict(buf, instance["be_instance"], be_actual, level=2) |
1178 | 1179 |
# TODO(ganeti 2.7) rework the NICs as well |
1179 | 1180 |
buf.write(" - NICs:\n") |
1180 |
for idx, (ip, mac, mode, link) in enumerate(instance["nics"]): |
|
1181 |
buf.write(" - nic/%d: MAC: %s, IP: %s, mode: %s, link: %s\n" % |
|
1182 |
(idx, mac, ip, mode, link)) |
|
1181 |
for idx, (ip, mac, mode, link, network) in enumerate(instance["nics"]): |
|
1182 |
buf.write(" - nic/%d: MAC: %s, IP: %s," |
|
1183 |
" mode: %s, link: %s, network: %s\n" % |
|
1184 |
(idx, mac, ip, mode, link, network)) |
|
1183 | 1185 |
buf.write(" Disk template: %s\n" % instance["disk_template"]) |
1184 | 1186 |
buf.write(" Disks:\n") |
1185 | 1187 |
|
b/lib/query.py | ||
---|---|---|
1550 | 1550 |
return fn |
1551 | 1551 |
|
1552 | 1552 |
|
1553 |
def _GetInstNicNetwork(ctx, _, nic): # pylint: disable=W0613 |
|
1554 |
"""Get a NIC's Network. |
|
1555 |
|
|
1556 |
@type ctx: L{InstanceQueryData} |
|
1557 |
@type nic: L{objects.NIC} |
|
1558 |
@param nic: NIC object |
|
1559 |
|
|
1560 |
""" |
|
1561 |
if nic.network is None: |
|
1562 |
return _FS_UNAVAIL |
|
1563 |
else: |
|
1564 |
return nic.network |
|
1565 |
|
|
1566 |
|
|
1553 | 1567 |
def _GetInstNicIp(ctx, _, nic): # pylint: disable=W0613 |
1554 | 1568 |
"""Get a NIC's IP address. |
1555 | 1569 |
|
... | ... | |
1661 | 1675 |
(_MakeField("nic.bridges", "NIC_bridges", QFT_OTHER, |
1662 | 1676 |
"List containing each network interface's bridge"), |
1663 | 1677 |
IQ_CONFIG, 0, _GetInstAllNicBridges), |
1678 |
(_MakeField("nic.networks", "NIC_networks", QFT_OTHER, |
|
1679 |
"List containing each interface's network"), IQ_CONFIG, 0, |
|
1680 |
lambda ctx, inst: [nic.network for nic in inst.nics]), |
|
1664 | 1681 |
] |
1665 | 1682 |
|
1666 | 1683 |
# NICs by number |
... | ... | |
1682 | 1699 |
(_MakeField("nic.bridge/%s" % i, "NicBridge/%s" % i, QFT_TEXT, |
1683 | 1700 |
"Bridge of %s network interface" % numtext), |
1684 | 1701 |
IQ_CONFIG, 0, _GetInstNic(i, _GetInstNicBridge)), |
1702 |
(_MakeField("nic.network/%s" % i, "NicNetwork/%s" % i, QFT_TEXT, |
|
1703 |
"Network of %s network interface" % numtext), |
|
1704 |
IQ_CONFIG, 0, _GetInstNic(i, _GetInstNicNetwork)), |
|
1685 | 1705 |
]) |
1686 | 1706 |
|
1687 | 1707 |
aliases = [ |
... | ... | |
1691 | 1711 |
("bridge", "nic.bridge/0"), |
1692 | 1712 |
("nic_mode", "nic.mode/0"), |
1693 | 1713 |
("nic_link", "nic.link/0"), |
1714 |
("nic_network", "nic.network/0"), |
|
1694 | 1715 |
] |
1695 | 1716 |
|
1696 | 1717 |
return (fields, aliases) |
Also available in: Unified diff