Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
Backport: Fix V2V inital state (#456)
Browse files Browse the repository at this point in the history
* Fix V2V inital state

Prior this fix, the VM was initially in an error state
instead of Pending while waiting for i.e. PVCs to get bound.

* Use "Always" pull pollicy for conversion pod

Hot fix to avoid issues with upgrades. Will need to be fixed properly.

* Rephrase v2v-related statuses

* Fix VMware naming
  • Loading branch information
mareklibra authored and suomiy committed May 16, 2019
1 parent eb79496 commit 13c0a56
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 11 deletions.
17 changes: 13 additions & 4 deletions src/components/VmStatus/VmStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';

import { CDI_KUBEVIRT_IO, STORAGE_IMPORT_PVC_NAME } from '../../constants';

import { getSubPagePath } from '../../utils';
import { getSubPagePath, VM_STATUS_V2V_CONVERSION_PENDING } from '../../utils';
import { PodModel, VirtualMachineModel } from '../../models';
import {
VM_STATUS_V2V_CONVERSION_ERROR,
Expand Down Expand Up @@ -51,20 +51,25 @@ const StateImporting = ({ additionalText, ...props }) => (

const StateV2VConversionInProgress = ({ progress, ...props }) => (
<LinkStatus icon="import" {...props}>
Importing (VMWare)
Importing (VMware)
</LinkStatus>
);

StateV2VConversionInProgress.defaultProps = {
progress: null,
};
StateV2VConversionInProgress.propTypes = {
progress: PropTypes.number,
};

const StateV2VConversionPending = ({ ...props }) => (
<LinkStatus icon="pending" {...props}>
Importing Pending (VMware)
</LinkStatus>
);

const StateV2VConversionError = ({ ...props }) => (
<LinkStatus icon="error-circle-o" {...props}>
Importing (VMWare) Error
Importing Error (VMware)
</LinkStatus>
);
StateImporting.defaultProps = {
Expand Down Expand Up @@ -126,6 +131,10 @@ export const VmStatus = ({ vm, pods, migrations, verbose }) => {
return (
<StateV2VConversionInProgress {...statusDetail} linkTo={getSubPagePath(statusDetail.pod, PodModel, 'events')} />
);
case VM_STATUS_V2V_CONVERSION_PENDING:
return (
<StateV2VConversionPending {...statusDetail} linkTo={getSubPagePath(statusDetail.pod, PodModel, 'events')} />
);
case VM_STATUS_V2V_CONVERSION_ERROR:
return (
<StateV2VConversionError {...statusDetail} linkTo={getSubPagePath(statusDetail.pod, PodModel, 'events')} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ Array [
<a
href="/k8s/ns/my-namespace/pods/kubevirt-v2v-conversion-15ac9/events"
>
Importing (VMWare)
Importing (VMware)
</a>,
]
`;
Expand All @@ -237,7 +237,7 @@ Array [
<a
href="/k8s/ns/my-namespace/pods/kubevirt-v2v-conversion-15ac5/events"
>
Importing (VMWare) Error
Importing Error (VMware)
</a>,
]
`;
Expand Down Expand Up @@ -468,7 +468,7 @@ exports[`<VmStatuses vm pod /> renders correctly 16 (VM_STATUS_CONVERSION_IN_PRO
<a
href="/k8s/ns/my-namespace/pods/kubevirt-v2v-conversion-15ac9/events"
>
Importing (VMWare)
Importing (VMware)
</a>
</div>
`;
Expand All @@ -482,7 +482,7 @@ exports[`<VmStatuses vm pod /> renders correctly 17 (VM_STATUS_CONVERSION_FAILED
<a
href="/k8s/ns/my-namespace/pods/kubevirt-v2v-conversion-15ac5/events"
>
Importing (VMWare) Error
Importing Error (VMware)
</a>
</div>
`;
1 change: 1 addition & 0 deletions src/k8s/objects/v2v/vmware/conversionPod.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const buildConversionPod = ({ volumes, volumeMounts, namespace, serviceAc
containers: [
{
name: CONVERSION_BASE_NAME,
imagePullPolicy: 'Always', // or "IfNotPresent". Slow but safer option for upgrades. TODO: fix
image: getKubevirtV2vConversionContainerImage(),
securityContext: {
privileged: true,
Expand Down
2 changes: 1 addition & 1 deletion src/k8s/objects/v2v/vmware/vmWareDeployment.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const buildVmWareDeployment = ({ name, namespace }) => ({
{
name,
image: getKubevirtV2vVmwareContainerImage(),
imagePullPolicy: 'Always',
imagePullPolicy: 'Always', // or "IfNotPresent". Slow but safer option for upgrades. TODO: fix
command: ['kubevirt-vmware'],
env: [
{
Expand Down
1 change: 1 addition & 0 deletions src/utils/status/pod/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ export const POD_STATUS_ALL_PROGRESS = [POD_STATUS_PENDING];
export const POD_STATUS_ALL_READY = [POD_STATUS_RUNNING, POD_STATUS_COMPLETED, POD_STATUS_SUCCEEDED];

export const POD_PHASE_SUCEEDED = 'Succeeded';
export const POD_PHASE_PENDING = 'Pending';
2 changes: 2 additions & 0 deletions src/utils/status/vm/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const VM_STATUS_VMI_WAITING = 'VM_STATUS_VMI_WAITING';
export const VM_STATUS_IMPORTING = 'VM_STATUS_IMPORTING';

export const VM_STATUS_V2V_CONVERSION_IN_PROGRESS = 'VM_STATUS_CONVERSION_IN_PROGRESS';
export const VM_STATUS_V2V_CONVERSION_PENDING = 'VM_STATUS_CONVERSION_PENDING';

export const VM_STATUS_V2V_CONVERSION_ERROR = 'VM_STATUS_CONVERSION_FAILED';
export const VM_STATUS_POD_ERROR = 'VM_STATUS_POD_ERROR';
Expand All @@ -24,6 +25,7 @@ export const VM_STATUS_ALL_ERROR = [
];

export const VM_STATUS_ALL_PROGRESS = [
VM_STATUS_V2V_CONVERSION_PENDING,
VM_STATUS_V2V_CONVERSION_IN_PROGRESS,
VM_STATUS_STARTING,
VM_STATUS_VMI_WAITING,
Expand Down
14 changes: 12 additions & 2 deletions src/utils/status/vm/vmStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
VM_STATUS_VMI_WAITING,
VM_STATUS_UNKNOWN,
VM_SIMPLE_STATUS_OTHER,
VM_STATUS_V2V_CONVERSION_PENDING,
} from './constants';

import { VIRT_LAUNCHER_POD_PREFIX } from '../../../constants';
Expand All @@ -35,6 +36,7 @@ import {
POD_STATUS_ALL_READY,
POD_STATUS_NOT_SCHEDULABLE,
POD_PHASE_SUCEEDED,
POD_PHASE_PENDING,
} from '../pod';

import { NOT_HANDLED } from '..';
Expand Down Expand Up @@ -136,9 +138,17 @@ const isBeingImported = (vm, pods) => {

const isV2VConversion = (vm, pods) => {
const conversionPod = findConversionPod(pods, vm);
if (conversionPod && getStatusPhase(conversionPod) !== POD_PHASE_SUCEEDED) {
const podPhase = getStatusPhase(conversionPod);
if (conversionPod && podPhase !== POD_PHASE_SUCEEDED) {
const conversionPodStatus = getPodStatus(conversionPod);

if (conversionPodStatus.status === POD_STATUS_NOT_SCHEDULABLE && podPhase === POD_PHASE_PENDING) {
return {
...conversionPodStatus,
status: VM_STATUS_V2V_CONVERSION_PENDING,
pod: conversionPod,
progress: null,
};
}
if (POD_STATUS_ALL_ERROR.includes(conversionPodStatus.status)) {
return {
...conversionPodStatus,
Expand Down

0 comments on commit 13c0a56

Please sign in to comment.