How to terminate / suspend tasks in oVirt / RHEV

Do you want to kill long-running tasks in the RHEV / oVirt virtualized environment? In oVirt / RHEV, tasks are stateful operations. If an operation can begin, process and complete a task.

VDSM task flow

There are two main types of operations in oVirt:

  1. Synchronous operation – This is not the task of the engine. Vdsm will return immediately after making a request. If a failure occurs before the response is retrieved, the operation will fail.
  2. Asynchronous operation – Vdsm and engine contain the status of these operations. The status indicates that the operation needs to pass some operations before returning. Most of these operations are related to storage. The engine should be associated with the ID and status of the Vdsm task to distinguish the results by polling for information.

You can check the list of currently running tasks with the vdsm-client command.

$ sudo vdsm-client Host getAllTasksInfo
{
    "9022a6e0-06cf-4066-b9f7-cbe23ffe851e": {
        "verb": "copyImage",
        "id": "9022a6e0-06cf-4066-b9f7-cbe23ffe851e"
    },
    "954d8ea4-6ab6-4ec5-9d1a-3374ec106a8c": {
        "verb": "prepareMerge",
        "id": "954d8ea4-6ab6-4ec5-9d1a-3374ec106a8c"
    },
    "c3fb509c-0554-4f10-9f73-32d346ccf012": {
        "verb": "copyImage",
        "id": "c3fb509c-0554-4f10-9f73-32d346ccf012"
    }
}

After getting the ID of the task, you can use the following command to get the status of the task:

$ sudo vdsm-client Task getStatus taskID=

See the example below.

$ sudo vdsm-client Task getStatus taskID=c3fb509c-0554-4f10-9f73-32d346ccf012
{
    "message": "running job 1 of 1",
    "code": 0,
    "taskID": "c3fb509c-0554-4f10-9f73-32d346ccf012",
    "taskResult": "",
    "taskState": "running"
}

To kill tasks in oVirt / RHEV, use:

sudo vdsm-client Task stop taskID=
sudo vdsm-client Task clear taskID=

Confirm if the task is still running or has been killed / terminated.

sudo vdsm-client Host getAllTasksInfo

Check out other oVirt related guides:

How to add NFS data, ISO and export storage domains to oVirt / RHEV

How to install oVirt Guest Agent on CentOS 8 / RHEL 8

How to configure a VM on oVirt / RHEV using Terraform

Install server or virtual machine from ISO on oVirt / RHEV

Create and manage user accounts on oVirt and RHEV

Sidebar