diff --git a/lib/client/gnt_network.py b/lib/client/gnt_network.py index b2d6360e6182d5c47e8a0895638e86b6b3cc48e3..60d4deed600fb0dcff31a1c5b508bb9e6112c2f3 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 ee26de6089eab9c6cc71fb6cf283dc94a3512ae3..13f9823604416439c49f819a866ff298a2b65890 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():