Merge "cloud: Consistently set 'ignore_missing' arguments"
This commit is contained in:
commit
f1cd4f1d06
@ -82,10 +82,7 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
:rtype: :class:`~openstack.baremetal.v1.node.Node`.
|
:rtype: :class:`~openstack.baremetal.v1.node.Node`.
|
||||||
:returns: The node found or None if no nodes are found.
|
:returns: The node found or None if no nodes are found.
|
||||||
"""
|
"""
|
||||||
try:
|
return self.baremetal.find_node(name_or_id, ignore_missing=True)
|
||||||
return self.baremetal.find_node(name_or_id, ignore_missing=False)
|
|
||||||
except exceptions.NotFoundException:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def get_machine_by_mac(self, mac):
|
def get_machine_by_mac(self, mac):
|
||||||
"""Get machine by port MAC address
|
"""Get machine by port MAC address
|
||||||
@ -417,7 +414,7 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
:return: Nothing.
|
:return: Nothing.
|
||||||
"""
|
"""
|
||||||
machine = self.get_machine(name_or_id)
|
machine = self.get_machine(name_or_id)
|
||||||
port = self.network.find_port(port_name_or_id)
|
port = self.network.find_port(port_name_or_id, ignore_missing=False)
|
||||||
self.baremetal.attach_vif_to_node(machine, port['id'])
|
self.baremetal.attach_vif_to_node(machine, port['id'])
|
||||||
|
|
||||||
def detach_port_from_machine(self, name_or_id, port_name_or_id):
|
def detach_port_from_machine(self, name_or_id, port_name_or_id):
|
||||||
@ -429,7 +426,7 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
:return: Nothing.
|
:return: Nothing.
|
||||||
"""
|
"""
|
||||||
machine = self.get_machine(name_or_id)
|
machine = self.get_machine(name_or_id)
|
||||||
port = self.network.find_port(port_name_or_id)
|
port = self.network.find_port(port_name_or_id, ignore_missing=False)
|
||||||
self.baremetal.detach_vif_from_node(machine, port['id'])
|
self.baremetal.detach_vif_from_node(machine, port['id'])
|
||||||
|
|
||||||
def list_ports_attached_to_machine(self, name_or_id):
|
def list_ports_attached_to_machine(self, name_or_id):
|
||||||
@ -441,7 +438,10 @@ class BaremetalCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
"""
|
"""
|
||||||
machine = self.get_machine(name_or_id)
|
machine = self.get_machine(name_or_id)
|
||||||
vif_ids = self.baremetal.list_node_vifs(machine)
|
vif_ids = self.baremetal.list_node_vifs(machine)
|
||||||
return [self.network.find_port(vif) for vif in vif_ids]
|
return [
|
||||||
|
self.network.find_port(vif, ignore_missing=False)
|
||||||
|
for vif in vif_ids
|
||||||
|
]
|
||||||
|
|
||||||
def validate_machine(self, name_or_id, for_deploy=True):
|
def validate_machine(self, name_or_id, for_deploy=True):
|
||||||
"""Validate parameters of the machine.
|
"""Validate parameters of the machine.
|
||||||
|
@ -142,7 +142,7 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
)
|
)
|
||||||
kwargs['imageRef'] = image['id']
|
kwargs['imageRef'] = image['id']
|
||||||
else: # object
|
else: # object
|
||||||
image_obj = self.image.find_image(image)
|
image_obj = self.image.find_image(image, ignore_missing=True)
|
||||||
if not image_obj:
|
if not image_obj:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
f"Image {image} was requested as the basis for a new "
|
f"Image {image} was requested as the basis for a new "
|
||||||
@ -227,8 +227,9 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
:raises: :class:`~openstack.exceptions.SDKException` on operation
|
:raises: :class:`~openstack.exceptions.SDKException` on operation
|
||||||
error.
|
error.
|
||||||
"""
|
"""
|
||||||
volume = self.block_storage.find_volume(name_or_id)
|
volume = self.block_storage.find_volume(
|
||||||
|
name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not volume:
|
if not volume:
|
||||||
self.log.debug(
|
self.log.debug(
|
||||||
"Volume %(name_or_id)s does not exist",
|
"Volume %(name_or_id)s does not exist",
|
||||||
@ -271,7 +272,9 @@ class BlockStorageCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
"""
|
"""
|
||||||
params = {}
|
params = {}
|
||||||
if name_or_id:
|
if name_or_id:
|
||||||
project = self.identity.find_project(name_or_id)
|
project = self.identity.find_project(
|
||||||
|
name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not project:
|
if not project:
|
||||||
raise exceptions.SDKException("project does not exist")
|
raise exceptions.SDKException("project does not exist")
|
||||||
params['project'] = project
|
params['project'] = project
|
||||||
|
@ -383,7 +383,9 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
"""
|
"""
|
||||||
params = {}
|
params = {}
|
||||||
if name_or_id:
|
if name_or_id:
|
||||||
project = self.identity.find_project(name_or_id)
|
project = self.identity.find_project(
|
||||||
|
name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not project:
|
if not project:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
f"Project {name_or_id} was requested but was not found "
|
f"Project {name_or_id} was requested but was not found "
|
||||||
@ -840,7 +842,9 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
)
|
)
|
||||||
group_id = group['id']
|
group_id = group['id']
|
||||||
else: # object
|
else: # object
|
||||||
group_obj = self.compute.find_server_group(group)
|
group_obj = self.compute.find_server_group(
|
||||||
|
group, ignore_missing=True
|
||||||
|
)
|
||||||
if not group_obj:
|
if not group_obj:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
"Server Group {group} was requested but was not found"
|
"Server Group {group} was requested but was not found"
|
||||||
@ -879,7 +883,9 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
)
|
)
|
||||||
network_id = net['id']
|
network_id = net['id']
|
||||||
else:
|
else:
|
||||||
network_obj = self.network.find_network(net)
|
network_obj = self.network.find_network(
|
||||||
|
net, ignore_missing=True
|
||||||
|
)
|
||||||
if not network_obj:
|
if not network_obj:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
'Network {network} is not a valid network in'
|
'Network {network} is not a valid network in'
|
||||||
@ -908,7 +914,9 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
nic.pop('net-name', None)
|
nic.pop('net-name', None)
|
||||||
elif 'net-name' in nic:
|
elif 'net-name' in nic:
|
||||||
net_name = nic.pop('net-name')
|
net_name = nic.pop('net-name')
|
||||||
nic_net = self.network.find_network(net_name)
|
nic_net = self.network.find_network(
|
||||||
|
net_name, ignore_missing=True
|
||||||
|
)
|
||||||
if not nic_net:
|
if not nic_net:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
"Requested network {net} could not be found.".format(
|
"Requested network {net} could not be found.".format(
|
||||||
@ -958,7 +966,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
)
|
)
|
||||||
kwargs['imageRef'] = image['id']
|
kwargs['imageRef'] = image['id']
|
||||||
else:
|
else:
|
||||||
image_obj = self.image.find_image(image)
|
image_obj = self.image.find_image(image, ignore_missing=True)
|
||||||
if not image_obj:
|
if not image_obj:
|
||||||
raise exc.OpenStackCloudException(
|
raise exc.OpenStackCloudException(
|
||||||
f"Image {image} was requested but was not found "
|
f"Image {image} was requested but was not found "
|
||||||
@ -1074,7 +1082,9 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
)
|
)
|
||||||
volume_id = boot_volume['id']
|
volume_id = boot_volume['id']
|
||||||
else:
|
else:
|
||||||
volume = self.block_storage.find_volume(boot_volume)
|
volume = self.block_storage.find_volume(
|
||||||
|
boot_volume, ignore_missing=True
|
||||||
|
)
|
||||||
if not volume:
|
if not volume:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
f"Volume {volume} was requested but was not found "
|
f"Volume {volume} was requested but was not found "
|
||||||
@ -1101,7 +1111,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
)
|
)
|
||||||
image_obj = image
|
image_obj = image
|
||||||
else:
|
else:
|
||||||
image_obj = self.image.find_image(image)
|
image_obj = self.image.find_image(image, ignore_missing=True)
|
||||||
if not image_obj:
|
if not image_obj:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
f"Image {image} was requested but was not found "
|
f"Image {image} was requested but was not found "
|
||||||
@ -1142,7 +1152,9 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
)
|
)
|
||||||
volume_id = volume['id']
|
volume_id = volume['id']
|
||||||
else:
|
else:
|
||||||
volume_obj = self.block_storage.find_volume(volume)
|
volume_obj = self.block_storage.find_volume(
|
||||||
|
volume, ignore_missing=True
|
||||||
|
)
|
||||||
if not volume_obj:
|
if not volume_obj:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
f"Volume {volume} was requested but was not found "
|
f"Volume {volume} was requested but was not found "
|
||||||
@ -1471,7 +1483,6 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
error.
|
error.
|
||||||
"""
|
"""
|
||||||
server = self.compute.find_server(name_or_id, ignore_missing=False)
|
server = self.compute.find_server(name_or_id, ignore_missing=False)
|
||||||
|
|
||||||
server = self.compute.update_server(server, **kwargs)
|
server = self.compute.update_server(server, **kwargs)
|
||||||
|
|
||||||
return self._expand_server(server, bare=bare, detailed=detailed)
|
return self._expand_server(server, bare=bare, detailed=detailed)
|
||||||
@ -1569,7 +1580,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
error.
|
error.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
flavor = self.compute.find_flavor(name_or_id)
|
flavor = self.compute.find_flavor(name_or_id, ignore_missing=True)
|
||||||
if not flavor:
|
if not flavor:
|
||||||
self.log.debug("Flavor %s not found for deleting", name_or_id)
|
self.log.debug("Flavor %s not found for deleting", name_or_id)
|
||||||
return False
|
return False
|
||||||
@ -1868,7 +1879,7 @@ class ComputeCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
if isinstance(end, str):
|
if isinstance(end, str):
|
||||||
end = parse_date(end)
|
end = parse_date(end)
|
||||||
|
|
||||||
proj = self.identity.find_project(name_or_id)
|
proj = self.identity.find_project(name_or_id, ignore_missing=True)
|
||||||
if not proj:
|
if not proj:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
f"Project {name_or_id} was requested but was not found "
|
f"Project {name_or_id} was requested but was not found "
|
||||||
|
@ -39,12 +39,9 @@ class DnsCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
"""
|
"""
|
||||||
if not filters:
|
if not filters:
|
||||||
filters = {}
|
filters = {}
|
||||||
zone = self.dns.find_zone(
|
return self.dns.find_zone(
|
||||||
name_or_id=name_or_id, ignore_missing=True, **filters
|
name_or_id=name_or_id, ignore_missing=True, **filters
|
||||||
)
|
)
|
||||||
if not zone:
|
|
||||||
return None
|
|
||||||
return zone
|
|
||||||
|
|
||||||
def search_zones(self, name_or_id=None, filters=None):
|
def search_zones(self, name_or_id=None, filters=None):
|
||||||
zones = self.list_zones(filters)
|
zones = self.list_zones(filters)
|
||||||
@ -136,7 +133,7 @@ class DnsCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
error.
|
error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
zone = self.dns.find_zone(name_or_id)
|
zone = self.dns.find_zone(name_or_id, ignore_missing=True)
|
||||||
if not zone:
|
if not zone:
|
||||||
self.log.debug("Zone %s not found for deleting", name_or_id)
|
self.log.debug("Zone %s not found for deleting", name_or_id)
|
||||||
return False
|
return False
|
||||||
@ -179,12 +176,9 @@ class DnsCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
zone_obj = self.get_zone(zone)
|
zone_obj = self.get_zone(zone)
|
||||||
if not zone_obj:
|
if not zone_obj:
|
||||||
raise exceptions.SDKException("Zone %s not found." % zone)
|
raise exceptions.SDKException("Zone %s not found." % zone)
|
||||||
try:
|
return self.dns.find_recordset(
|
||||||
return self.dns.find_recordset(
|
zone=zone_obj, name_or_id=name_or_id, ignore_missing=True
|
||||||
zone=zone_obj, name_or_id=name_or_id, ignore_missing=False
|
)
|
||||||
)
|
|
||||||
except Exception:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def search_recordsets(self, zone, name_or_id=None, filters=None):
|
def search_recordsets(self, zone, name_or_id=None, filters=None):
|
||||||
recordsets = self.list_recordsets(zone=zone)
|
recordsets = self.list_recordsets(zone=zone)
|
||||||
|
@ -165,6 +165,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
project = self.identity.find_project(
|
project = self.identity.find_project(
|
||||||
name_or_id=name_or_id,
|
name_or_id=name_or_id,
|
||||||
domain_id=domain_id,
|
domain_id=domain_id,
|
||||||
|
ignore_missing=True,
|
||||||
)
|
)
|
||||||
if not project:
|
if not project:
|
||||||
raise exceptions.SDKException("Project %s not found." % name_or_id)
|
raise exceptions.SDKException("Project %s not found." % name_or_id)
|
||||||
@ -211,7 +212,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
project = self.identity.find_project(
|
project = self.identity.find_project(
|
||||||
name_or_id=name_or_id, ignore_missing=True, domain_id=domain_id
|
name_or_id=name_or_id, domain_id=domain_id, ignore_missing=True
|
||||||
)
|
)
|
||||||
if not project:
|
if not project:
|
||||||
self.log.debug("Project %s not found for deleting", name_or_id)
|
self.log.debug("Project %s not found for deleting", name_or_id)
|
||||||
@ -848,7 +849,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
wrong during the OpenStack API call.
|
wrong during the OpenStack API call.
|
||||||
"""
|
"""
|
||||||
if domain_id is None:
|
if domain_id is None:
|
||||||
return self.identity.find_domain(name_or_id)
|
return self.identity.find_domain(name_or_id, ignore_missing=False)
|
||||||
else:
|
else:
|
||||||
return self.identity.get_domain(domain_id)
|
return self.identity.get_domain(domain_id)
|
||||||
|
|
||||||
@ -948,7 +949,9 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
:raises: :class:`~openstack.exceptions.SDKException` if something goes
|
:raises: :class:`~openstack.exceptions.SDKException` if something goes
|
||||||
wrong during the OpenStack API call.
|
wrong during the OpenStack API call.
|
||||||
"""
|
"""
|
||||||
group = self.identity.find_group(name_or_id, **kwargs)
|
group = self.identity.find_group(
|
||||||
|
name_or_id, ignore_missing=True, **kwargs
|
||||||
|
)
|
||||||
if group is None:
|
if group is None:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
f"Group {name_or_id} not found for updating"
|
f"Group {name_or_id} not found for updating"
|
||||||
@ -974,7 +977,7 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
wrong during the OpenStack API call.
|
wrong during the OpenStack API call.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
group = self.identity.find_group(name_or_id)
|
group = self.identity.find_group(name_or_id, ignore_missing=True)
|
||||||
if group is None:
|
if group is None:
|
||||||
self.log.debug("Group %s not found for deleting", name_or_id)
|
self.log.debug("Group %s not found for deleting", name_or_id)
|
||||||
return False
|
return False
|
||||||
@ -1215,7 +1218,9 @@ class IdentityCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
# group, role, project
|
# group, role, project
|
||||||
search_args['domain_id'] = data['domain'].id
|
search_args['domain_id'] = data['domain'].id
|
||||||
|
|
||||||
data['role'] = self.identity.find_role(name_or_id=role)
|
data['role'] = self.identity.find_role(
|
||||||
|
name_or_id=role, ignore_missing=True
|
||||||
|
)
|
||||||
if not data['role']:
|
if not data['role']:
|
||||||
raise exceptions.SDKException(f'Role {role} not found.')
|
raise exceptions.SDKException(f'Role {role} not found.')
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class ImageCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
' however only one can be used at once'
|
' however only one can be used at once'
|
||||||
)
|
)
|
||||||
|
|
||||||
image = self.image.find_image(name_or_id)
|
image = self.image.find_image(name_or_id, ignore_missing=True)
|
||||||
if not image:
|
if not image:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"No images with name or ID %s were found" % name_or_id, None
|
"No images with name or ID %s were found" % name_or_id, None
|
||||||
|
@ -617,7 +617,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
:raises: :class:`~openstack.exceptions.SDKException` if the resource to
|
:raises: :class:`~openstack.exceptions.SDKException` if the resource to
|
||||||
set the quota does not exist.
|
set the quota does not exist.
|
||||||
"""
|
"""
|
||||||
proj = self.identity.find_project(name_or_id)
|
proj = self.identity.find_project(name_or_id, ignore_missing=True)
|
||||||
if not proj:
|
if not proj:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
f"Project {name_or_id} was requested by was not found "
|
f"Project {name_or_id} was requested by was not found "
|
||||||
@ -636,7 +636,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
:raises: :class:`~openstack.exceptions.SDKException` if it's not a
|
:raises: :class:`~openstack.exceptions.SDKException` if it's not a
|
||||||
valid project
|
valid project
|
||||||
"""
|
"""
|
||||||
proj = self.identity.find_project(name_or_id)
|
proj = self.identity.find_project(name_or_id, ignore_missing=True)
|
||||||
if not proj:
|
if not proj:
|
||||||
raise exc.OpenStackCloudException(
|
raise exc.OpenStackCloudException(
|
||||||
f"Project {name_or_id} was requested by was not found "
|
f"Project {name_or_id} was requested by was not found "
|
||||||
@ -660,7 +660,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
:raises: :class:`~openstack.exceptions.SDKException` if it's not a
|
:raises: :class:`~openstack.exceptions.SDKException` if it's not a
|
||||||
valid project or the network client call failed
|
valid project or the network client call failed
|
||||||
"""
|
"""
|
||||||
proj = self.identity.find_project(name_or_id)
|
proj = self.identity.find_project(name_or_id, ignore_missing=True)
|
||||||
if not proj:
|
if not proj:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
f"Project {name_or_id} was requested by was not found "
|
f"Project {name_or_id} was requested by was not found "
|
||||||
@ -1351,7 +1351,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
self.log.debug("No QoS policy data to update")
|
self.log.debug("No QoS policy data to update")
|
||||||
return
|
return
|
||||||
|
|
||||||
curr_policy = self.network.find_qos_policy(name_or_id)
|
curr_policy = self.network.find_qos_policy(
|
||||||
|
name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not curr_policy:
|
if not curr_policy:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
"QoS policy %s not found." % name_or_id
|
"QoS policy %s not found." % name_or_id
|
||||||
@ -1372,7 +1374,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
raise exc.OpenStackCloudUnavailableExtension(
|
raise exc.OpenStackCloudUnavailableExtension(
|
||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
policy = self.network.find_qos_policy(name_or_id)
|
policy = self.network.find_qos_policy(name_or_id, ignore_missing=True)
|
||||||
if not policy:
|
if not policy:
|
||||||
self.log.debug("QoS policy %s not found for deleting", name_or_id)
|
self.log.debug("QoS policy %s not found for deleting", name_or_id)
|
||||||
return False
|
return False
|
||||||
@ -1419,7 +1421,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1451,7 +1455,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1487,7 +1493,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1581,7 +1589,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1671,7 +1681,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1701,7 +1713,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1733,7 +1747,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1771,7 +1787,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1836,7 +1854,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1866,7 +1886,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1900,7 +1922,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1934,7 +1958,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -1974,7 +2000,9 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
'QoS extension is not available on target cloud'
|
'QoS extension is not available on target cloud'
|
||||||
)
|
)
|
||||||
|
|
||||||
policy = self.network.find_qos_policy(policy_name_or_id)
|
policy = self.network.find_qos_policy(
|
||||||
|
policy_name_or_id, ignore_missing=True
|
||||||
|
)
|
||||||
if not policy:
|
if not policy:
|
||||||
raise exceptions.NotFoundException(
|
raise exceptions.NotFoundException(
|
||||||
"QoS policy {name_or_id} not Found.".format(
|
"QoS policy {name_or_id} not Found.".format(
|
||||||
@ -2669,8 +2697,7 @@ class NetworkCloudMixin(_network_common.NetworkCommonCloudMixin):
|
|||||||
:raises: :class:`~openstack.exceptions.SDKException` on operation
|
:raises: :class:`~openstack.exceptions.SDKException` on operation
|
||||||
error.
|
error.
|
||||||
"""
|
"""
|
||||||
port = self.network.find_port(name_or_id)
|
port = self.network.find_port(name_or_id, ignore_missing=True)
|
||||||
|
|
||||||
if port is None:
|
if port is None:
|
||||||
self.log.debug("Port %s not found for deleting", name_or_id)
|
self.log.debug("Port %s not found for deleting", name_or_id)
|
||||||
return False
|
return False
|
||||||
|
@ -1528,7 +1528,9 @@ class NetworkCommonCloudMixin(openstackcloud._OpenStackCloudMixin):
|
|||||||
if not fixed_address:
|
if not fixed_address:
|
||||||
if len(ports) > 1:
|
if len(ports) > 1:
|
||||||
if nat_destination:
|
if nat_destination:
|
||||||
nat_network = self.network.find_network(nat_destination)
|
nat_network = self.network.find_network(
|
||||||
|
nat_destination, ignore_missing=True
|
||||||
|
)
|
||||||
if not nat_network:
|
if not nat_network:
|
||||||
raise exceptions.SDKException(
|
raise exceptions.SDKException(
|
||||||
'NAT Destination {nat_destination} was configured'
|
'NAT Destination {nat_destination} was configured'
|
||||||
|
Loading…
Reference in New Issue
Block a user