Pivotal Knowledge Base

Follow

How to Cancel All Queued BOSH Tasks Using director_ctl

Environment

Pivotal Cloud Foundry all versions

Purpose

This article shows how to use director_ctl to cancel all queued Bosh tasks.

Cause

If there are tasks timing out or failing and too many bosh tasks are queued for the director, it is very difficult to cancel individual tasks using the command bosh cancel task <#>.

Procedure

Warning- Make sure you are absolutely certain that the queued tasks are not affecting any ongoing deployments. These steps will cancel all queued tasks and may leave some deployments in an inconsistent state.

Follow these steps:

    1. Login to BOSH Director VM using vcap credentials (vcap credentials can be found on the Ops manager Director tile - Credentials tab):

ssh vcap@<Director_IP>

    2. Switch to superuser:

sudo su -

    3. Enter director_ctl console:

/var/vcap/jobs/director/bin/director_ctl console

    4. Count number of queued tasks:

irb(main):001:0> Bosh::Director::Models::Task.where(state: "queued").count

    5. Cancel all the queued Bosh tasks:

irb(main):002:0> Bosh::Director::Models::Task.where(state: "queued").update(state: "cancelling")

Additional Information

Please refer to the BOSH documentation for more details on Bosh tasks.

Comments

Powered by Zendesk