feat(xo-web/vm/tab-advanced): ability to set the NIC type (#3440)

Fixes #3423
This commit is contained in:
badrAZ 2018-09-21 15:30:23 +02:00 committed by Pierre Donias
parent e0ecbab841
commit 6ca09dc9fe
3 changed files with 35 additions and 5 deletions

View File

@ -12,6 +12,7 @@
- [VM] Display the PVHVM status [#3014](https://github.com/vatesfr/xen-orchestra/issues/3014) (PR [#3418](https://github.com/vatesfr/xen-orchestra/pull/3418))
- [Backup reports] Ability to test the plugin (PR [#3421](https://github.com/vatesfr/xen-orchestra/pull/3421))
- [Backup NG] Ability to restart failed VMs' backup [#3339](https://github.com/vatesfr/xen-orchestra/issues/3339) (PR [#3420](https://github.com/vatesfr/xen-orchestra/pull/3420))
- [VM] Ability to change the NIC type [#3423](https://github.com/vatesfr/xen-orchestra/issues/3423) (PR [#3440](https://github.com/vatesfr/xen-orchestra/pull/3440))
### Bug fixes

View File

@ -1018,6 +1018,7 @@ const messages = {
vmAffinityHost: 'Affinity host',
vmVga: 'VGA',
vmVideoram: 'Video RAM',
vmNicType: 'NIC type',
noAffinityHost: 'None',
originalTemplate: 'Original template',
unknownOsName: 'Unknown',

View File

@ -8,12 +8,12 @@ import React from 'react'
import renderXoItem from 'render-xo-item'
import TabButton from 'tab-button'
import Tooltip from 'tooltip'
import { Toggle } from 'form'
import { Number, Size, Text, XoSelect } from 'editable'
import { Container, Row, Col } from 'grid'
import { SelectResourceSet, SelectVgpuType } from 'select-objects'
import { confirm } from 'modal'
import { assign, every, find, includes, isEmpty, map, uniq } from 'lodash'
import { confirm } from 'modal'
import { Container, Row, Col } from 'grid'
import { Number, Size, Text, XoSelect } from 'editable'
import { Select, Toggle } from 'form'
import { SelectResourceSet, SelectVgpuType } from 'select-objects'
import {
addSubscriptions,
connectStore,
@ -280,6 +280,17 @@ class CoresPerSocket extends Component {
}
}
const NIC_TYPE_OPTIONS = [
{
label: 'Realtek RTL819',
value: '',
},
{
label: 'Intel e1000',
value: 'e1000',
},
]
@connectStore(() => {
const getVgpus = createGetObjectsOfType('vgpu').pick((_, { vm }) => vm.$VGPUs)
const getGpuGroup = createGetObjectsOfType('gpuGroup').pick(
@ -297,6 +308,9 @@ export default class TabAdvanced extends Component {
getVmsHaValues().then(vmsHaValues => this.setState({ vmsHaValues }))
}
_onNicTypeChange = value =>
editVm(this.props.vm, { nicType: value === '' ? null : value })
render () {
const { container, isAdmin, vgpus, vm } = this.props
return (
@ -488,6 +502,20 @@ export default class TabAdvanced extends Component {
</td>
</tr>
)}
<tr>
<th>{_('vmNicType')}</th>
<td>
<Select
labelKey='label'
onChange={this._onNicTypeChange}
options={NIC_TYPE_OPTIONS}
required
simpleValue
value={vm.nicType || ''}
valueKey='value'
/>
</td>
</tr>
{vm.virtualizationMode === 'hvm' && (
<tr>
<th>{_('vmVga')}</th>