def _shutdown_instance(self, instance): ctx = context.ctx() if instance.node_group.floating_ip_pool: try: networks.delete_floating_ip(instance.instance_id) except nova_exceptions.NotFound: LOG.warn( _LW("Attempted to delete non-existent floating IP in " "pool %(pool)s from instance %(instance)s"), { 'pool': instance.node_group.floating_ip_pool, 'instance': instance.instance_id }) try: volumes.detach_from_instance(instance) except Exception: LOG.warn(_LW("Detaching volumes from instance %s failed"), instance.instance_id) try: nova.client().servers.delete(instance.instance_id) except nova_exceptions.NotFound: LOG.warn(_LW("Attempted to delete non-existent instance %s"), instance.instance_id) conductor.instance_remove(ctx, instance)
def _shutdown_instance(self, instance): ctx = context.ctx() if instance.node_group.floating_ip_pool: try: networks.delete_floating_ip(instance.instance_id) except nova_exceptions.NotFound: LOG.warning( _LW("Attempted to delete non-existent floating IP " "in pool {pool} from instance {instance}").format( pool=instance.node_group.floating_ip_pool, instance=instance.instance_id)) try: volumes.detach_from_instance(instance) except Exception: LOG.warning( _LW("Detaching volumes from instance {id} failed").format( id=instance.instance_id)) try: nova.client().servers.delete(instance.instance_id) except nova_exceptions.NotFound: LOG.warning( _LW("Attempted to delete non-existent instance {id}").format( id=instance.instance_id)) conductor.instance_remove(ctx, instance)
def _shutdown_instance(self, instance): ctx = context.ctx() if instance.node_group.floating_ip_pool: try: networks.delete_floating_ip(instance.instance_id) except nova_exceptions.NotFound: LOG.warn(_LW("Attempted to delete non-existent floating IP in " "pool %(pool)s from instance %(instance)s"), {'pool': instance.node_group.floating_ip_pool, 'instance': instance.instance_id}) try: volumes.detach_from_instance(instance) except Exception: LOG.warn(_LW("Detaching volumes from instance %s failed"), instance.instance_id) try: nova.client().servers.delete(instance.instance_id) except nova_exceptions.NotFound: LOG.warn(_LW("Attempted to delete non-existent instance %s"), instance.instance_id) conductor.instance_remove(ctx, instance)
def _shutdown_instance(self, instance): ctx = context.ctx() if instance.node_group.floating_ip_pool: try: networks.delete_floating_ip(instance.instance_id) except nova_exceptions.NotFound: LOG.warning(_LW("Attempted to delete non-existent floating IP " "in pool {pool} from instance {instance}") .format(pool=instance.node_group.floating_ip_pool, instance=instance.instance_id)) try: volumes.detach_from_instance(instance) except Exception: LOG.warning(_LW("Detaching volumes from instance {id} failed") .format(id=instance.instance_id)) try: nova.client().servers.delete(instance.instance_id) except nova_exceptions.NotFound: LOG.warning(_LW("Attempted to delete non-existent instance {id}") .format(id=instance.instance_id)) conductor.instance_remove(ctx, instance)