-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supported features: 1. NUMA 2. GPUs/Host Devices 3. Persistent TPM/EFI 4. Dedicated CPU Signed-off-by: Radoslaw Szwajkowski <[email protected]>
- Loading branch information
Showing
14 changed files
with
350 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,5 @@ autoattach | |
virt | ||
multiqueue | ||
filesystems | ||
bootloader | ||
typeahead |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...in/src/modules/Providers/views/details/tabs/VirtualMachines/components/VmFeaturesCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { TableCell } from 'src/modules/Providers/utils'; | ||
import { useForkliftTranslation } from 'src/utils/i18n'; | ||
|
||
import { Label } from '@patternfly/react-core'; | ||
|
||
import { getOpenShiftFeatureMap } from '../utils'; | ||
import { toVmFeatureEnum } from '../utils/helpers/toVmFeatureEnum'; | ||
|
||
import { VMCellProps } from './VMCellProps'; | ||
|
||
export const VmFeaturesCell: React.FC<VMCellProps> = ({ data }) => { | ||
const { t } = useForkliftTranslation(); | ||
const featureToLabel = toVmFeatureEnum(t); | ||
return ( | ||
<TableCell> | ||
{Object.entries(getOpenShiftFeatureMap(data?.vm)) | ||
.filter(([, value]) => value) | ||
.map(([key]) => ( | ||
<Label key={key} isCompact> | ||
{featureToLabel[key]} | ||
</Label> | ||
))} | ||
</TableCell> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...ules/Providers/views/details/tabs/VirtualMachines/utils/helpers/getOpenShiftFeatureMap.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { VmFeatures } from 'src/utils/types'; | ||
|
||
import { ProviderVirtualMachine, V1DomainSpec } from '@kubev2v/types'; | ||
|
||
export const getOpenShiftFeatureMap = (vm: ProviderVirtualMachine): VmFeatures => { | ||
if (vm.providerType !== 'openshift') { | ||
return {}; | ||
} | ||
const domain: V1DomainSpec = vm.object?.spec?.template?.spec?.domain; | ||
if (!domain) { | ||
return {}; | ||
} | ||
|
||
return { | ||
numa: !!domain.cpu?.numa, | ||
gpusHostDevices: !!domain.devices?.gpus?.length || !!domain?.devices?.hostDevices?.length, | ||
persistentTpmEfi: | ||
!!domain?.devices?.tpm?.persistent || domain?.firmware?.bootloader?.efi?.persistent, | ||
dedicatedCpu: !!domain?.cpu?.dedicatedCpuPlacement, | ||
}; | ||
}; |
1 change: 1 addition & 0 deletions
1
...le-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/utils/helpers/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
// @index(['./*', /style/g], f => `export * from '${f.path}';`) | ||
export * from './getOpenShiftFeatureMap'; | ||
export * from './getVmPowerState'; | ||
export * from './vmProps'; | ||
// @endindex |
8 changes: 8 additions & 0 deletions
8
...src/modules/Providers/views/details/tabs/VirtualMachines/utils/helpers/toVmFeatureEnum.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { VmFeatures } from 'src/utils/types'; | ||
|
||
export const toVmFeatureEnum = (t: (string) => string): { [k in keyof VmFeatures]: string } => ({ | ||
numa: t('NUMA'), | ||
gpusHostDevices: t('GPUs/Host Devices'), | ||
persistentTpmEfi: t('Persistent TPM/EFI'), | ||
dedicatedCpu: t('Dedicated CPU'), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.