LGTM, thanks
On Mon, Dec 16, 2013 at 9:16 PM, Klaus Aehlig <[email protected]> wrote: > In commit 3293332 this was only done for the Haskell side; do > so for python as well, to have both views consistent. > > Signed-off-by: Klaus Aehlig <[email protected]> > --- > lib/query.py | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/lib/query.py b/lib/query.py > index 784d9f3..b799a43 100644 > --- a/lib/query.py > +++ b/lib/query.py > @@ -1773,6 +1773,29 @@ def _GetInstAllNicNetworkNames(ctx, inst): > return result > > > +def _GetInstAllNicVlans(ctx, inst): > + """Get all network VLANs for an instance. > + > + @type ctx: L{InstanceQueryData} > + @type inst: L{objects.Instance} > + @param inst: Instance object > + > + """ > + assert len(ctx.inst_nicparams) == len(inst.nics) > + > + result = [] > + > + for nicp in ctx.inst_nicparams: > + if nicp[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED: > + result.append(nicp[constants.NIC_VLAN]) > + else: > + result.append(None) > + > + assert len(result) == len(inst.nics) > + > + return result > + > + > def _GetInstAllNicBridges(ctx, inst): > """Get all network bridges for an instance. > > @@ -1855,6 +1878,9 @@ def _GetInstanceNetworkFields(): > "List containing each network interface's link"), > IQ_CONFIG, 0, > lambda ctx, inst: [nicp[constants.NIC_LINK] > for nicp in ctx.inst_nicparams]), > + (_MakeField("nic.vlans", "NIC_VLANs", QFT_OTHER, > + "List containing each network interface's VLAN"), > + IQ_CONFIG, 0, _GetInstAllNicVlans), > (_MakeField("nic.bridges", "NIC_bridges", QFT_OTHER, > "List containing each network interface's bridge"), > IQ_CONFIG, 0, _GetInstAllNicBridges), > -- > 1.8.5.1 > >
