Skip to content

Commit

Permalink
Merge pull request #6479 from yaacov/kubevirt-support-only-e1000e-and…
Browse files Browse the repository at this point in the history
…-virtio

Bug 1869620: kubevirt support only e1000e and virtio
  • Loading branch information
openshift-merge-robot committed Sep 3, 2020
2 parents 967d5cf + 6691a12 commit 20c1c18
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,17 @@ export const NICModal = withHandlePromise((props: NICModalProps) => {
isDisabled={isDisabled('model') || interfaceType === NetworkInterfaceType.SRIOV}
>
<FormSelectPlaceholderOption isDisabled placeholder="--- Select Model ---" />
{NetworkInterfaceModel.getAll().map((ifaceModel) => {
return (
<FormSelectOption
key={ifaceModel.getValue()}
value={ifaceModel.getValue()}
label={ifaceModel.toString()}
/>
);
})}
{NetworkInterfaceModel.getAll()
.filter((ifaceModel) => ifaceModel.isSupported() || ifaceModel === model)
.map((ifaceModel) => {
return (
<FormSelectOption
key={ifaceModel.getValue()}
value={ifaceModel.getValue()}
label={ifaceModel.toString()}
/>
);
})}
</FormSelect>
</FormRow>
<Network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { ObjectEnum } from '../../object-enum';
import { NetworkInterfaceModel } from '../../vm/network';

export class OvirtNetworkInterfaceModel extends ObjectEnum<string> {
static readonly E1000 = new OvirtNetworkInterfaceModel('e1000', NetworkInterfaceModel.E1000);
static readonly E1000 = new OvirtNetworkInterfaceModel('e1000', NetworkInterfaceModel.E1000E);
static readonly PCI_PASSTHROUGH = new OvirtNetworkInterfaceModel(
'pci_passthrough',
NetworkInterfaceModel.E1000,
NetworkInterfaceModel.E1000E,
);
static readonly RTL8139 = new OvirtNetworkInterfaceModel(
'rtl8139',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ import { READABLE_VIRTIO } from '../constants';

export class NetworkInterfaceModel extends ObjectEnum<string> {
static readonly VIRTIO = new NetworkInterfaceModel('virtio');
static readonly E1000 = new NetworkInterfaceModel('e1000');
static readonly E1000 = new NetworkInterfaceModel('e1000', { isSupported: false });
static readonly E1000E = new NetworkInterfaceModel('e1000e');
static readonly NE2kPCI = new NetworkInterfaceModel('ne2kPCI');
static readonly PCNET = new NetworkInterfaceModel('pcnet');
static readonly RTL8139 = new NetworkInterfaceModel('rtl8139');
static readonly NE2kPCI = new NetworkInterfaceModel('ne2kPCI', { isSupported: false });
static readonly PCNET = new NetworkInterfaceModel('pcnet', { isSupported: false });
static readonly RTL8139 = new NetworkInterfaceModel('rtl8139', { isSupported: false });

private readonly supported: boolean;

protected constructor(
value: string,
{ isSupported = true }: NetworkInterfaceModelConstructorOpts = {},
) {
super(value);
this.supported = isSupported;
}

private static readonly ALL = Object.freeze(
ObjectEnum.getAllClassEnumProperties<NetworkInterfaceModel>(NetworkInterfaceModel),
Expand All @@ -27,10 +37,16 @@ export class NetworkInterfaceModel extends ObjectEnum<string> {
static fromString = (model: string): NetworkInterfaceModel =>
NetworkInterfaceModel.stringMapper[model];

isSupported = () => this.supported;

toString() {
if (this === NetworkInterfaceModel.VIRTIO) {
return READABLE_VIRTIO;
}
return this.value;
}
}

type NetworkInterfaceModelConstructorOpts = {
isSupported?: boolean;
};

0 comments on commit 20c1c18

Please sign in to comment.