Revision 1ef82b60
b/lib/query.py | ||
---|---|---|
1784 | 1784 |
return result |
1785 | 1785 |
|
1786 | 1786 |
|
1787 |
def _GetInstAllNicVlans(ctx, inst): |
|
1788 |
"""Get all network VLANs of an instance. |
|
1789 |
|
|
1790 |
@type ctx: L{InstanceQueryData} |
|
1791 |
@type inst: L{objects.Instance} |
|
1792 |
@param inst: Instance object |
|
1793 |
|
|
1794 |
""" |
|
1795 |
assert len(ctx.inst_nicparams) == len(inst.nics) |
|
1796 |
|
|
1797 |
result = [] |
|
1798 |
|
|
1799 |
for nicp in ctx.inst_nicparams: |
|
1800 |
if nicp[constants.NIC_MODE] == constants.NIC_MODE_OVS: |
|
1801 |
result.append(nicp[constants.NIC_VLAN]) |
|
1802 |
else: |
|
1803 |
result.append(None) |
|
1804 |
|
|
1805 |
assert len(result) == len(inst.nics) |
|
1806 |
|
|
1807 |
return result |
|
1808 |
|
|
1809 |
|
|
1787 | 1810 |
def _GetInstNicParam(name): |
1788 | 1811 |
"""Build function for retrieving a NIC parameter. |
1789 | 1812 |
|
... | ... | |
1843 | 1866 |
"List containing each network interface's link"), IQ_CONFIG, 0, |
1844 | 1867 |
lambda ctx, inst: [nicp[constants.NIC_LINK] |
1845 | 1868 |
for nicp in ctx.inst_nicparams]), |
1869 |
(_MakeField("nic.vlans", "NIC_VLANs", QFT_OTHER, |
|
1870 |
"List containing each network interface's VLAN"), |
|
1871 |
IQ_CONFIG, 0, _GetInstAllNicVlans), |
|
1846 | 1872 |
(_MakeField("nic.bridges", "NIC_bridges", QFT_OTHER, |
1847 | 1873 |
"List containing each network interface's bridge"), |
1848 | 1874 |
IQ_CONFIG, 0, _GetInstAllNicBridges), |
Also available in: Unified diff