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( "Attempted to delete non-existent floating IP in " "pool %s from instancie %s", instance.node_group.floating_ip_pool, instance.instance_id) try: volumes.detach_from_instance(instance) except Exception: LOG.warn("Detaching volumes from instance %s failed", instance.instance_id) try: nova.client().servers.delete(instance.instance_id) except nova_exceptions.NotFound: LOG.warn("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.warn("Attempted to delete non-existent floating IP in " "pool %s from instancie %s", instance.node_group.floating_ip_pool, instance.instance_id) try: volumes.detach_from_instance(instance) except Exception: LOG.warn("Detaching volumes from instance %s failed", instance.instance_id) try: nova.client().servers.delete(instance.instance_id) except nova_exceptions.NotFound: LOG.warn("Attempted to delete non-existent instance %s", instance.instance_id) conductor.instance_remove(ctx, instance)
def _shutdown_instance(instance): ctx = context.ctx() try: if instance.node_group.floating_ip_pool: networks.delete_floating_ip(instance.instance_id) nova.client().servers.delete(instance.instance_id) except nova_exceptions.NotFound: #Just ignore non-existing instances pass conductor.instance_remove(ctx, instance)