Revision 9a03cffb lib/query.py
b/lib/query.py | ||
---|---|---|
1722 | 1722 |
return _FS_UNAVAIL |
1723 | 1723 |
|
1724 | 1724 |
|
1725 |
def _GetInstNicVLan(ctx, index, _): |
|
1726 |
"""Get a NIC's VLAN. |
|
1727 |
|
|
1728 |
@type ctx: L{InstanceQueryData} |
|
1729 |
@type index: int |
|
1730 |
@param index: NIC index |
|
1731 |
|
|
1732 |
""" |
|
1733 |
assert len(ctx.inst_nicparams) >= index |
|
1734 |
|
|
1735 |
nicparams = ctx.inst_nicparams[index] |
|
1736 |
|
|
1737 |
if nicparams[constants.NIC_MODE] == constants.NIC_MODE_OVS: |
|
1738 |
return nicparams[constants.NIC_VLAN] |
|
1739 |
else: |
|
1740 |
return _FS_UNAVAIL |
|
1741 |
|
|
1742 |
|
|
1725 | 1743 |
def _GetInstAllNicNetworkNames(ctx, inst): |
1726 | 1744 |
"""Get all network names for an instance. |
1727 | 1745 |
|
... | ... | |
1861 | 1879 |
(_MakeField("nic.bridge/%s" % i, "NicBridge/%s" % i, QFT_TEXT, |
1862 | 1880 |
"Bridge of %s network interface" % numtext), |
1863 | 1881 |
IQ_CONFIG, 0, _GetInstNic(i, _GetInstNicBridge)), |
1882 |
(_MakeField("nic.vlan/%s" % i, "NicVLAN/%s" % i, QFT_TEXT, |
|
1883 |
"VLAN of %s network interface" % numtext), |
|
1884 |
IQ_CONFIG, 0, _GetInstNic(i, _GetInstNicVLan)), |
|
1864 | 1885 |
(_MakeField("nic.network/%s" % i, "NicNetwork/%s" % i, QFT_TEXT, |
1865 | 1886 |
"Network of %s network interface" % numtext), |
1866 | 1887 |
IQ_CONFIG, 0, _GetInstNic(i, _GetInstNicNetwork)), |
Also available in: Unified diff