LGTM, thanks

On Tue, Feb 19, 2013 at 5:28 PM, Dimitris Aragiorgis <[email protected]>wrote:

> Make LookupNetwork() return None in case target is None. This fixes
> Issue 380. Rapi passes network=None and the lookup should not fail.
>
> Make network client aware of new nic.network.gnt-network info shows
> the IPs of each instance inside the network.  It parses nic.networks
> field of QueryInstances() output, which now is a list of uuids an
> not names.
>
> Signed-off-by: Dimitris Aragiorgis <[email protected]>
> ---
>  lib/client/gnt_network.py |    2 +-
>  lib/config.py             |    7 ++++---
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/lib/client/gnt_network.py b/lib/client/gnt_network.py
> index b2d6360..60d4dee 100644
> --- a/lib/client/gnt_network.py
> +++ b/lib/client/gnt_network.py
> @@ -250,7 +250,7 @@ def ShowNetworkConfig(_, args):
>
>          l = lambda value: ", ".join(str(idx) + ":" + str(ip)
>                                      for idx, (ip, net) in enumerate(value)
> -                                      if net == name)
> +                                      if net == uuid)
>
>          ToStdout("    %s : %s", inst, l(zip(ips, networks)))
>      else:
> diff --git a/lib/config.py b/lib/config.py
> index ee26de6..13f9823 100644
> --- a/lib/config.py
> +++ b/lib/config.py
> @@ -1450,10 +1450,9 @@ class ConfigWriter:
>      instance = self._UnlockedGetInstanceInfo(instance_name)
>
>      for nic in instance.nics:
> -      if nic.network is not None and nic.ip is not None:
> -        net_uuid = self._UnlockedLookupNetwork(nic.network)
> +      if nic.network and nic.ip:
>          # Return all IP addresses to the respective address pools
> -        self._UnlockedCommitIp(constants.RELEASE_ACTION, net_uuid, nic.ip)
> +        self._UnlockedCommitIp(constants.RELEASE_ACTION, nic.network,
> nic.ip)
>
>      del self._config_data.instances[instance_name]
>      self._config_data.cluster.serial_no += 1
> @@ -2503,6 +2502,8 @@ class ConfigWriter:
>      @raises errors.OpPrereqError: when the target network cannot be found
>
>      """
> +    if target is None:
> +      return None
>      if target in self._config_data.networks:
>        return target
>      for net in self._config_data.networks.values():
> --
> 1.7.10.4
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iQEcBAEBCAAGBQJRI6g5AAoJEMk10sCdtK5jeJcIAL6DEOnZ3teHxyzkUMcry53k
> 0s3qBrKCxDs6IhdHOd2B516LwetCKvdSIqCEwglXIpqdXOr7dQFA7HFr5x6Mu6jw
> kZOMa9K9wBA2RpO1PvBBixQIQCYF6WVhWPC1P0cStRTOXHOmZsGWApyN6hk6Do0c
> sd1EHKrPFg1Gcz7PeHuQMZBeKjqPmYIiwQ1xAyne4zyG9hddp72Xv5VgLhNJR4Ew
> mdOBL8ePhImTqyOWeWhb4Q0cc8TftqhX14u1KLnCOx1jMw+TvdjcWaVZN+Di8Kyr
> 6qwTKdYfyVXh6n6jpu1mHxmtq74w/X59zEYUa2h6MJXSA404sW3fEA4ZEbFfJ3A=
> =I33O
> -----END PGP SIGNATURE-----
>
>

Reply via email to