-
Notifications
You must be signed in to change notification settings - Fork 592
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
Bug 1869620: kubevirt support only e1000e and virtio #6479
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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', { isDeprecated: true }); | ||
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', { isDeprecated: true }); | ||
static readonly PCNET = new NetworkInterfaceModel('pcnet', { isDeprecated: true }); | ||
static readonly RTL8139 = new NetworkInterfaceModel('rtl8139', { isDeprecated: true }); | ||
|
||
private readonly deprecated: boolean; | ||
|
||
protected constructor( | ||
value: string, | ||
{ isDeprecated = false }: NetworkInterfaceModelConstructorOpts = {}, | ||
) { | ||
super(value); | ||
this.deprecated = isDeprecated; | ||
} | ||
|
||
private static readonly ALL = Object.freeze( | ||
ObjectEnum.getAllClassEnumProperties<NetworkInterfaceModel>(NetworkInterfaceModel), | ||
|
@@ -27,10 +37,16 @@ export class NetworkInterfaceModel extends ObjectEnum<string> { | |
static fromString = (model: string): NetworkInterfaceModel => | ||
NetworkInterfaceModel.stringMapper[model]; | ||
|
||
isDeprecated = () => this.deprecated; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we rather call it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok :-) |
||
|
||
toString() { | ||
if (this === NetworkInterfaceModel.VIRTIO) { | ||
return READABLE_VIRTIO; | ||
} | ||
return this.value; | ||
} | ||
} | ||
|
||
type NetworkInterfaceModelConstructorOpts = { | ||
isDeprecated?: boolean; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they are still valid values (you can still have a VM with these models). Can you please just mark them as not supported? Similar to what we do in DiskType enum? And filter them in places where we use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using the deprecation logic like in disks :-)