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 <dimara@grnet.gr>
Reviewed-by: Helga Velroyen <helgav@google.com>
l = lambda value: ", ".join(str(idx) + ":" + str(ip)
for idx, (ip, net) in enumerate(value)
l = lambda value: ", ".join(str(idx) + ":" + str(ip)
for idx, (ip, net) in enumerate(value)
ToStdout(" %s : %s", inst, l(zip(ips, networks)))
else:
ToStdout(" %s : %s", inst, l(zip(ips, networks)))
else:
instance = self._UnlockedGetInstanceInfo(instance_name)
for nic in instance.nics:
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
# 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
del self._config_data.instances[instance_name]
self._config_data.cluster.serial_no += 1
@raises errors.OpPrereqError: when the target network cannot be found
"""
@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():
if target in self._config_data.networks:
return target
for net in self._config_data.networks.values():