LGTM

On Sat, Feb 16, 2013 at 2:19 PM, Dimitris Aragiorgis <[email protected]>wrote:

> This will be needed for Instance Queries. It walks through the
> instance's NICs and returns a list network uuids that the NICs
> are attached to.
>
> Signed-off-by: Dimitris Aragiorgis <[email protected]>
> ---
>  lib/config.py |   18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/lib/config.py b/lib/config.py
> index 532a762..ee26de6 100644
> --- a/lib/config.py
> +++ b/lib/config.py
> @@ -1572,6 +1572,24 @@ class ConfigWriter:
>                       for node_name in nodes)
>
>    @locking.ssynchronized(_config_lock, shared=1)
> +  def GetInstanceNetworks(self, instance_name):
> +    """Returns set of network UUIDs for instance's nics.
> +
> +    @rtype: frozenset
> +
> +    """
> +    instance = self._UnlockedGetInstanceInfo(instance_name)
> +    if not instance:
> +      raise errors.ConfigurationError("Unknown instance '%s'" %
> instance_name)
> +
> +    networks = set()
> +    for nic in instance.nics:
> +      if nic.network:
> +        networks.add(nic.network)
> +
> +    return frozenset(networks)
> +
> +  @locking.ssynchronized(_config_lock, shared=1)
>    def GetMultiInstanceInfo(self, instances):
>      """Get the configuration of multiple instances.
>
> --
> 1.7.10.4
>
>

Reply via email to