fix: Fix for status check of migrate & live migrate

fix for status check of migrate & live migrate

Change-Id: Id28a1659f8004b657fad863413f83c3baea36c1e
This commit is contained in:
zhuyue 2021-09-30 17:19:33 +08:00
parent 205dc9c7ca
commit 74ee3ec2aa
3 changed files with 22 additions and 4 deletions

View File

@ -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() {

View File

@ -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() {

View File

@ -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) => {