NTNX>日記

個人的な趣味による Nutanix Community Edition 日記。Japanese のみですみません。

Prism Central の終了できなくなったタスクを手動終了してみる。

Prism Central で、終了できなくなってしまったタスクを手動で終了してみます。

今回の環境

今回の Prism Central と Prism Element のバージョンです。ちなみに、Nutanix CE 2.1 のクラスタを管理しています。

  • Prism Central 2024.3.0.1

いろいろ検証中に、終了できないタスクが発生してしまいました。このタスクは仮想マシンを更新しようとしていますが、完了できなそうです。(11時間以上進捗がありません)

 

タスク一覧の確認

Prism Central の PCVM でも、Prism Element の CVM と同様に ecli でタスク情報を確認できます。

PCVM に nutanix ユーザーで SSH ログインして、ecli を実行すると、タスク情報の一覧が確認できます。

PCVM$ ecli task.list

ただし、デフォルトでは 40件のみ表示されます。そのため、開始から時間がたっているタスクは表示されません。下記の例でも、実行中(Status = kRunning)のタスクは表示されていません。

そこで、終了していないタスクのみを表示すると、kRunning のタスクが見つかるはずです。

PCVM$ ecli task.list include_completed=false

実際に実行すると、下記のようにタスク情報が取得できました。

nutanix@NTNX-192-168-20-11-A-PCVM:~$ ecli task.list include_completed=false
Task UUID                               Parent Task UUID                        Component       Sequence-id     Type                    Status          Creation Time(UTC)      Completion Time(UTC)
698b3100-4adb-4579-83db-f5dbf81b02a2    6c7172a8-7263-4898-9676-ddb97e0b658b    metropolis      44              ProcessVmChange         kRunning        2025-03-30 05:56:23
8f45b9ec-aaea-4b40-9ddd-7ff2f50842a2    0a69b608-3bf4-422c-9066-9236996985b8    metropolis      43              ProcessVmChange         kRunning        2025-03-30 05:56:20
5fe1ffa8-c86d-438d-9d6b-e16f3acec687    f8962094-2bf9-4387-a697-1b9b1ca494cc    metropolis      42              ProcessVmChange         kRunning        2025-03-30 05:56:19
6c7172a8-7263-4898-9676-ddb97e0b658b                                            aplos           45              update_vm_intentful     kRunning        2025-03-30 05:47:04
f8962094-2bf9-4387-a697-1b9b1ca494cc                                            aplos           44              update_vm_intentful     kRunning        2025-03-30 05:47:04
0a69b608-3bf4-422c-9066-9236996985b8                                            aplos           43              update_vm_intentful     kRunning        2025-03-30 05:47:04

また、タスクの表示件数を増やすことでも、過去のタスクを表示できます。タスク件数は、「limit=4000」のように指定できます。

nutanix@NTNX-192-168-20-11-A-PCVM:~$ ecli task.list limit=4000 | grep -e ^Task -e kRunning
Task UUID                               Parent Task UUID                        Component               Sequence-id     Type                                            Status          Creation Time(UTC)      Completion Time(UTC)
698b3100-4adb-4579-83db-f5dbf81b02a2    6c7172a8-7263-4898-9676-ddb97e0b658b    metropolis              44              ProcessVmChange                                 kRunning        2025-03-30 05:56:23
8f45b9ec-aaea-4b40-9ddd-7ff2f50842a2    0a69b608-3bf4-422c-9066-9236996985b8    metropolis              43              ProcessVmChange                                 kRunning        2025-03-30 05:56:20
5fe1ffa8-c86d-438d-9d6b-e16f3acec687    f8962094-2bf9-4387-a697-1b9b1ca494cc    metropolis              42              ProcessVmChange                                 kRunning        2025-03-30 05:56:19
6c7172a8-7263-4898-9676-ddb97e0b658b                                            aplos                   45              update_vm_intentful                             kRunning        2025-03-30 05:47:04
f8962094-2bf9-4387-a697-1b9b1ca494cc                                            aplos                   44              update_vm_intentful                             kRunning        2025-03-30 05:47:04
0a69b608-3bf4-422c-9066-9236996985b8                                            aplos                   43              update_vm_intentful                             kRunning        2025-03-30 05:47:04

ちなみに、include_completed と limit は同時にオプション指定できます。

PCVM$ ecli task.list include_completed=false limit=4000 

 

タスク内容の確認

タスクの情報は、nuclei コマンドで確認できます。

$ nuclei task.get <Task UUID>

実際に実行すると、下記のようにタスクの情報を確認できます。このタスクが更新しようとしている仮想マシンの UUID などが表示されています。

nutanix@NTNX-192-168-20-11-A-PCVM:~$ nuclei task.get 698b3100-4adb-4579-83db-f5dbf81b02a2
2025/03/30 17:48:41 ZK : Initiating connection to server 192.168.20.11:9876
2025/03/30 17:48:41 ZK : Connected to 192.168.20.11:9876
2025/03/30 17:48:41 ZK : Authenticating connection 0x0
2025/03/30 17:48:41 nuclei is attempting to connect to Zookeeper
2025/03/30 17:48:41 Parsed cluster id: 3676583234125597218 and cluster incarnation id: 5087196769281720850 from /home/nutanix/config/zookeeper/cluster_identifier.json
2025/03/30 17:48:41 ZK : Authenticated: id=0x195be5d92f10735, timeout=20000
api_version: '3.1'
uuid: 698b3100-4adb-4579-83db-f5dbf81b02a2
subtask_reference_list:
- kind: task
  uuid: 32eadf0f-24a4-4b3e-6469-3b7fd5833798
- kind: task
  uuid: 4ecbd386-b74f-47c0-7516-87e4466739c2
status: RUNNING
start_time_usecs: 1743314183400734
start_time: '2025-03-30T05:56:23Z'
progress_message: ''
percentage_complete: 50
parent_task_reference:
  kind: task
  uuid: 6c7172a8-7263-4898-9676-ddb97e0b658b
operation_type: ProcessVmChange
logical_timestamp: 7
last_update_time: '2025-03-30T05:56:29Z'
entity_reference_list:
- kind: vm
  uuid: 27b053ef-d230-4e6a-abb5-b8c0c3648bfd
- kind: node
  uuid: 9381d3c0-9472-458a-a19b-aa5da5f694c9
creation_time_usecs: 1743314183388716
creation_time: '2025-03-30T05:56:23Z'
cluster_reference:
  kind: cluster
  uuid: 46995a82-2f8d-4212-b305-d8f8d9368a22

親タスクの情報も取得してみます。

nutanix@NTNX-192-168-20-11-A-PCVM:~$ nuclei task.get 6c7172a8-7263-4898-9676-ddb97e0b658b
2025/03/30 17:49:09 ZK : Initiating connection to server 192.168.20.11:9876
2025/03/30 17:49:09 ZK : Connected to 192.168.20.11:9876
2025/03/30 17:49:09 ZK : Authenticating connection 0x0
2025/03/30 17:49:09 nuclei is attempting to connect to Zookeeper
2025/03/30 17:49:09 Parsed cluster id: 3676583234125597218 and cluster incarnation id: 5087196769281720850 from /home/nutanix/config/zookeeper/cluster_identifier.json
2025/03/30 17:49:09 ZK : Authenticated: id=0x195be5d92f10737, timeout=20000
api_version: '3.1'
uuid: 6c7172a8-7263-4898-9676-ddb97e0b658b
subtask_reference_list:
- kind: task
  uuid: 698b3100-4adb-4579-83db-f5dbf81b02a2
status: RUNNING
start_time_usecs: 1743313627374345
start_time: '2025-03-30T05:47:07Z'
progress_message: update_vm
percentage_complete: 50
operation_type: update_vm_intentful
logical_timestamp: 4
last_update_time: '2025-03-30T05:56:30Z'
entity_reference_list:
- kind: vm
  uuid: 27b053ef-d230-4e6a-abb5-b8c0c3648bfd
- kind: node
  uuid: 9381d3c0-9472-458a-a19b-aa5da5f694c9
creation_time_usecs: 1743313624666984
creation_time: '2025-03-30T05:47:04Z'
cluster_reference:
  kind: cluster
  uuid: 46995a82-2f8d-4212-b305-d8f8d9368a22

この仮想マシン(27b053ef-d230-4e6a-abb5-b8c0c3648bfd)は、この Prism Central の管理している Nutanix クラスタには、すでに存在していません。そのため、キャンセルしても問題なそうです。

nutanix@NTNX-192-168-20-11-A-PCVM:~$ nuclei vm.list
2025/03/30 17:52:26 ZK : Initiating connection to server 192.168.20.11:9876
2025/03/30 17:52:26 ZK : Connected to 192.168.20.11:9876
2025/03/30 17:52:26 ZK : Authenticating connection 0x0
2025/03/30 17:52:26 nuclei is attempting to connect to Zookeeper
2025/03/30 17:52:26 Parsed cluster id: 3676583234125597218 and cluster incarnation id: 5087196769281720850 from /home/nutanix/config/zookeeper/cluster_identifier.json
2025/03/30 17:52:26 ZK : Authenticated: id=0x195be5d92f10748, timeout=20000
"Total Entities : 1"
"Length : 1"
"Offset : 0"
"Entities :"
Name         UUID                                  State
lab-nxpc-01  9593fed5-dea4-45eb-9766-3427713457fe  COMPLETE

 

タスクのキャンセル

ecli ではタスクがキャンセルできなかったので、今回は ergon_update_task コマンドでタスクを強制終了(--task_status=aborted に更新)してみます。

$ ergon_update_task --task_status=aborted --task_uuid=<Task UUID>

実際に、Task UUID を指定して実行してみます。途中で実行確認があるので「y」を入力します。

nutanix@NTNX-192-168-20-11-A-PCVM:~$ ergon_update_task --task_status=aborted --task_uuid=698b3100-4adb-4579-83db-f5dbf81b02a2
WARNING: Using this command can cause database corruption and complete system failure, if used improperly.
Are you sure you want to continue? (y/n)
y
2025-03-30 18:01:55,128Z INFO client.py:271 Creating stub for Ergon on 127.0.0.1: 2090

これで、実行中のままになっていた1タスク(1セットの親子タスク)が解消されました。

nutanix@NTNX-192-168-20-11-A-PCVM:~$ ecli task.list include_completed=false
Task UUID                               Parent Task UUID                        Component       Sequence-id     Type                    Status          Creation Time(UTC)      Completion Time(UTC)
8f45b9ec-aaea-4b40-9ddd-7ff2f50842a2    0a69b608-3bf4-422c-9066-9236996985b8    metropolis      43              ProcessVmChange         kRunning        2025-03-30 05:56:20
5fe1ffa8-c86d-438d-9d6b-e16f3acec687    f8962094-2bf9-4387-a697-1b9b1ca494cc    metropolis      42              ProcessVmChange         kRunning        2025-03-30 05:56:19
f8962094-2bf9-4387-a697-1b9b1ca494cc                                            aplos           44              update_vm_intentful     kRunning        2025-03-30 05:47:04
0a69b608-3bf4-422c-9066-9236996985b8                                            aplos           43              update_vm_intentful     kRunning        2025-03-30 05:47:04

ちなみに、親タスク(Parent Task UUID)を指定すると下記のように ergon_update_task 自体がエラーになるので、子のタスクから停止します。

nutanix@NTNX-192-168-20-11-A-PCVM:~$ ergon_update_task --task_status=aborted --task_uuid=6c7172a8-7263-4898-9676-ddb97e0b658b
WARNING: Using this command can cause database corruption and complete system failure, if used improperly.
Are you sure you want to continue? (y/n)
y
2025-03-30 18:01:15,419Z INFO client.py:271 Creating stub for Ergon on 127.0.0.1: 2090
2025-03-30 18:01:15,451Z CRITICAL ergon_update_task:141 Ergon client error kTaskHasPendingSubtasks: Task('6c7172a8-7263-4898-9676-ddb97e0b658b') Cannot mark task as kAborted. Pending subtasks uuid 6c7172a8-7263-4898-9676-ddb97e0b658b with exception kTaskHasPendingSubtasks: Task('6c7172a8-7263-4898-9676-ddb97e0b658b') Cannot mark task as kAborted. Pending subtasks and trace back Traceback (most recent call last):
  File "/usr/local/nutanix/bin/ergon_update_task", line 139, in main
    update_ret = ergon_client.TaskUpdate(update_arg)
  File "build/bdist.linux-x86_64/egg/util/net/sync_rpc_client.py", line 137, in wrapper
  File "build/bdist.linux-x86_64/egg/ergon/client/client.py", line 148, in _invoke_rpc
  File "build/bdist.linux-x86_64/egg/ergon/client/client.py", line 181, in handle_request
  File "build/bdist.linux-x86_64/egg/util/net/sync_rpc_client.py", line 468, in _invoke_rpc
  File "build/bdist.linux-x86_64/egg/ergon/client/client.py", line 91, in _filter_rpc_result
ergon.client.exception.ErgonTaskHasPendingSubtasks: kTaskHasPendingSubtasks: Task('6c7172a8-7263-4898-9676-ddb97e0b658b') Cannot mark task as kAborted. Pending subtasks

同様にのこりの2件のタスクも終了すると、下記のように Prism Central でもタスクがエラー終了して、実行中のままの状態が解消できました。

以上。

©2024 gowatana
クリエイティブ・コモンズ・ライセンスこの 作品 は クリエイティブ・コモンズ 表示 4.0 国際 ライセンスの下に提供されています。