Merge "Check for correct Neutron exceptions harder"
This commit is contained in:
commit
f5c540d1e5
|
@ -876,14 +876,17 @@ class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
|
||||||
reality_nets = self._add_port_for_address(server,
|
reality_nets = self._add_port_for_address(server,
|
||||||
extend_networks=False)
|
extend_networks=False)
|
||||||
reality_net_ids = {}
|
reality_net_ids = {}
|
||||||
|
client_plugin = self.client_plugin('neutron')
|
||||||
for net_key in reality_nets:
|
for net_key in reality_nets:
|
||||||
try:
|
try:
|
||||||
net_id = self.client_plugin(
|
net_id = client_plugin.find_resourceid_by_name_or_id('network',
|
||||||
'neutron').find_resourceid_by_name_or_id('network',
|
net_key)
|
||||||
net_key)
|
except Exception as ex:
|
||||||
except (exception.EntityNotFound,
|
if (client_plugin.is_not_found(ex) or
|
||||||
exception.PhysicalResourceNameAmbiguity):
|
client_plugin.is_no_unique(ex)):
|
||||||
net_id = None
|
net_id = None
|
||||||
|
else:
|
||||||
|
raise
|
||||||
if net_id:
|
if net_id:
|
||||||
reality_net_ids[net_id] = reality_nets.get(net_key)
|
reality_net_ids[net_id] = reality_nets.get(net_key)
|
||||||
|
|
||||||
|
@ -1044,15 +1047,17 @@ class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
|
||||||
This method is used only for resolving attributes.
|
This method is used only for resolving attributes.
|
||||||
"""
|
"""
|
||||||
nets = copy.deepcopy(networks)
|
nets = copy.deepcopy(networks)
|
||||||
|
client_plugin = self.client_plugin('neutron')
|
||||||
for key in list(nets.keys()):
|
for key in list(nets.keys()):
|
||||||
try:
|
try:
|
||||||
net_id = self.client_plugin(
|
net_id = client_plugin.find_resourceid_by_name_or_id('network',
|
||||||
'neutron').find_resourceid_by_name_or_id('network', key)
|
key)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if (self.client_plugin('neutron').is_not_found(ex) or
|
if (client_plugin.is_not_found(ex) or
|
||||||
self.client_plugin('neutron').is_no_unique(ex)):
|
client_plugin.is_no_unique(ex)):
|
||||||
net_id = None
|
net_id = None
|
||||||
raise
|
else:
|
||||||
|
raise
|
||||||
if net_id:
|
if net_id:
|
||||||
nets[net_id] = nets[key]
|
nets[net_id] = nets[key]
|
||||||
return nets
|
return nets
|
||||||
|
|
|
@ -68,7 +68,7 @@ resources:
|
||||||
net:
|
net:
|
||||||
type: OS::Neutron::Net
|
type: OS::Neutron::Net
|
||||||
properties:
|
properties:
|
||||||
name: my_net
|
name: server_with_port_net
|
||||||
subnet:
|
subnet:
|
||||||
type: OS::Neutron::Subnet
|
type: OS::Neutron::Subnet
|
||||||
properties:
|
properties:
|
||||||
|
|
Loading…
Reference in New Issue