From 74ee3ec2aaea434fcacdf299daa32a77afd0e996 Mon Sep 17 00:00:00 2001 From: zhuyue Date: Thu, 30 Sep 2021 17:19:33 +0800 Subject: [PATCH] fix: Fix for status check of migrate & live migrate fix for status check of migrate & live migrate Change-Id: Id28a1659f8004b657fad863413f83c3baea36c1e --- .../containers/Instance/actions/LiveMigrate.jsx | 11 +++++++++-- .../compute/containers/Instance/actions/Migrate.jsx | 11 +++++++++-- src/resources/instance.jsx | 4 ++++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/pages/compute/containers/Instance/actions/LiveMigrate.jsx b/src/pages/compute/containers/Instance/actions/LiveMigrate.jsx index aa58b12e..95d6fcdf 100644 --- a/src/pages/compute/containers/Instance/actions/LiveMigrate.jsx +++ b/src/pages/compute/containers/Instance/actions/LiveMigrate.jsx @@ -15,7 +15,12 @@ import { inject, observer } from 'mobx-react'; import globalServerStore from 'stores/nova/instance'; import { ModalAction } from 'containers/Action'; -import { isActive, isNotDeleting, isIronicInstance } from 'resources/instance'; +import { + isActive, + isNotDeleting, + isIronicInstance, + isPaused, +} from 'resources/instance'; import globalHypervisorStore from 'stores/nova/hypervisor'; import globalComputeHostStore from 'stores/nova/compute-host'; import { hypervisorColumns, hypervisorFilters } from 'resources/hypervisor'; @@ -98,7 +103,9 @@ export default class LiveMigrate extends ModalAction { static allowed = (item) => Promise.resolve( - isActive(item) && isNotDeleting(item) && !isIronicInstance(item) + (isActive(item) || isPaused(item)) && + isNotDeleting(item) && + !isIronicInstance(item) ); get formItems() { diff --git a/src/pages/compute/containers/Instance/actions/Migrate.jsx b/src/pages/compute/containers/Instance/actions/Migrate.jsx index a2c008a6..ec2587e4 100644 --- a/src/pages/compute/containers/Instance/actions/Migrate.jsx +++ b/src/pages/compute/containers/Instance/actions/Migrate.jsx @@ -15,7 +15,12 @@ import { inject, observer } from 'mobx-react'; import globalServerStore from 'stores/nova/instance'; import { ModalAction } from 'containers/Action'; -import { isActive, isNotDeleting, isIronicInstance } from 'resources/instance'; +import { + isActive, + isNotDeleting, + isIronicInstance, + isStopped, +} from 'resources/instance'; import globalHypervisorStore from 'stores/nova/hypervisor'; import globalComputeHostStore from 'stores/nova/compute-host'; import { hypervisorColumns, hypervisorFilters } from 'resources/hypervisor'; @@ -95,7 +100,9 @@ export default class LiveMigrate extends ModalAction { static allowed = (item) => Promise.resolve( - isActive(item) && isNotDeleting(item) && !isIronicInstance(item) + (isActive(item) || isStopped(item)) && + isNotDeleting(item) && + !isIronicInstance(item) ); get formItems() { diff --git a/src/resources/instance.jsx b/src/resources/instance.jsx index 4479884b..6ab10526 100644 --- a/src/resources/instance.jsx +++ b/src/resources/instance.jsx @@ -166,6 +166,10 @@ export const isShutOff = (item) => checkStatus(['shutoff'], item); export const isActive = (item) => checkStatus(['active'], item); +export const isStopped = (item) => checkStatus(['stopped'], item); + +export const isPaused = (item) => checkStatus(['paused'], item); + export const isNotError = (item) => !checkStatus(['error'], item); export const isIsoInstance = (item) => {