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