From bb645c00dbd0773c58f3cb9ca91362821fc31ef9 Mon Sep 17 00:00:00 2001 From: Andy Lee Date: Mon, 3 Mar 2025 11:24:54 +0800 Subject: [PATCH] introduce VM pending status Signed-off-by: Andy Lee (cherry picked from commit 05ff8e4f19f91387ecf88e1cc214fdfd2b58d921) --- .../models/kubevirt.io.virtualmachine.js | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/pkg/harvester/models/kubevirt.io.virtualmachine.js b/pkg/harvester/models/kubevirt.io.virtualmachine.js index cc23dcc0..875a37d6 100644 --- a/pkg/harvester/models/kubevirt.io.virtualmachine.js +++ b/pkg/harvester/models/kubevirt.io.virtualmachine.js @@ -700,8 +700,25 @@ export default class VirtVm extends HarvesterResource { return null; } - get isBeingStopped() { - if (this && !this.isVMExpectedRunning && this.isVMCreated && this.vmi?.status?.phase !== VMIPhase.Succeeded) { + get isPending() { + if (this && + !this.isVMExpectedRunning && + this.isVMCreated && + this.vmi?.status?.phase === VMIPhase.Pending + ) { + return { status: VMIPhase.Pending }; + } + + return null; + } + + get isStopping() { + if (this && + !this.isVMExpectedRunning && + this.isVMCreated && + this.vmi?.status?.phase !== VMIPhase.Succeeded && + this.vmi?.status?.phase !== VMIPhase.Pending + ) { return { status: STOPPING }; } @@ -736,7 +753,7 @@ export default class VirtVm extends HarvesterResource { } get isUnschedulable() { - if (this.isBeingStopped || this.isStarting) { + if (this.isStopping || this.isStarting) { const condition = this.status?.conditions?.find((c) => c.reason === UNSCHEDULABLE); if (!!condition) { @@ -852,7 +869,8 @@ export default class VirtVm extends HarvesterResource { this.isUnschedulable?.status || this.isPaused?.status || this.isVMError?.status || - this.isBeingStopped?.status || + this.isPending?.status || + this.isStopping?.status || this.isOff?.status || this.isError?.status || this.isRunning?.status ||