Skip to content

Commit

Permalink
Merge pull request #1085 from yaacov/refine-glance-used-only-on-image…
Browse files Browse the repository at this point in the history
…-based-vms

🐞 Refine glance used only on image based vms
  • Loading branch information
yaacov authored Apr 9, 2024
2 parents fd838fe + f64acd0 commit 93ae60a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export const calculateStorages = (
draft: Draft<CreateVmMigrationPageState>,
): Partial<CreateVmMigrationPageState['calculatedPerNamespace']> => {
const {
receivedAsParams: { sourceProvider },
existingResources,
underConstruction: { plan },
calculatedOnce: { sourceStorageLabelToId, storageIdsUsedBySelectedVms },
Expand Down Expand Up @@ -119,12 +118,9 @@ export const calculateStorages = (
const generatedSourceStorages = Object.keys(sourceStorageLabelToId)
.sort((a, b) => universalComparator(a, b, 'en'))
.map((label) => {
let usedBySelectedVms = storageIdsUsedBySelectedVms.some(
const usedBySelectedVms = storageIdsUsedBySelectedVms.some(
(id) => id === sourceStorageLabelToId[label] || id === label,
);
if (label === 'glance' && sourceProvider?.spec?.type === 'openstack') {
usedBySelectedVms = true;
}
return {
label,
usedBySelectedVms,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export const getStoragesUsedBySelectedVms = (
(disks as OpenstackVolume[]).find((disk) => disk.id === av.ID),
) ?? [];
const volumeTypeIds = vmDisks.map((disk) => disk?.volumeType);

if (vm?.imageID) {
volumeTypeIds.push('glance');
}

return volumeTypeIds;
}
case 'ovirt': {
Expand Down

0 comments on commit 93ae60a

Please sign in to comment.