Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CNV-32874: Customize VM is prompting 'No boot source available' dialog #1536

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { SelectSourceUploadPVCProgress } from './SelectSourceUploadPVCProgress';
import {
appendDockerPrefix,
getContainerDiskSource,
getDefaultSourceStorage,
getGenericSourceCustomization,
getPVCSource,
} from './utils';
Expand Down Expand Up @@ -81,6 +82,7 @@ export const SelectSource: React.FC<SelectSourceProps> = ({
React.useEffect(() => {
switch (selectedSourceType) {
case DEFAULT_SOURCE:
return onSourceChange(getDefaultSourceStorage(volumeQuantity));
case BLANK_SOURCE_NAME:
case UPLOAD_SOURCE_NAME:
return onSourceChange(
Expand Down
10 changes: 10 additions & 0 deletions src/views/catalog/customize/components/CustomizeSource/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ export const getSourceTypeFromDiskSource = (
return DEFAULT_SOURCE;
};

export const getDefaultSourceStorage = (storage: string): V1beta1DataVolumeSpec => ({
storage: {
resources: {
requests: {
storage,
},
},
},
});

export const getGenericSourceCustomization = (
diskSourceId: SOURCE_OPTIONS_IDS,
url?: string,
Expand Down
12 changes: 10 additions & 2 deletions src/views/catalog/customize/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,16 @@ export const overrideVirtualMachineDataVolumeSpec = (
): V1VirtualMachine => {
return produceVMDisks(virtualMachine, (draftVM) => {
const dataVolumeTemplate = draftVM.spec.dataVolumeTemplates[0];
if (dataVolumeTemplate && Boolean(customSource)) {
draftVM.spec.dataVolumeTemplates[0].spec = customSource;
if (dataVolumeTemplate && !isEmpty(customSource)) {
const { storage, ...restSpec } = customSource;

if (!isEmpty(storage)) {
if (!isEmpty(restSpec)) {
draftVM.spec.dataVolumeTemplates[0].spec = customSource;
} else {
draftVM.spec.dataVolumeTemplates[0].spec.storage = storage;
}
}

const shouldAddImmediateBind = customSource?.source?.blank || customSource?.source?.upload;

Expand Down
Loading