feat(xo-web/vm/advanced): set VCPUs-params:mask under Advanced (#3254)
Fixes #3241
This commit is contained in:
parent
94d36c3458
commit
1312df8c88
@ -20,6 +20,7 @@
|
|||||||
- [SR] Display iscsi paths and mark the SR with a yellow dot if one path is not available. [#3659](https://github.com/vatesfr/xen-orchestra/issues/3659) (PR [#3829](https://github.com/vatesfr/xen-orchestra/pull/3829))
|
- [SR] Display iscsi paths and mark the SR with a yellow dot if one path is not available. [#3659](https://github.com/vatesfr/xen-orchestra/issues/3659) (PR [#3829](https://github.com/vatesfr/xen-orchestra/pull/3829))
|
||||||
- [UI] Unifies the Signin buttons (PR [#3913](https://github.com/vatesfr/xen-orchestra/pull/3913))
|
- [UI] Unifies the Signin buttons (PR [#3913](https://github.com/vatesfr/xen-orchestra/pull/3913))
|
||||||
- [Settings/remotes] NFS: display default option on placeholder [#3631](https://github.com/vatesfr/xen-orchestra/issues/3631) (PR [#3921](https://github.com/vatesfr/xen-orchestra/pull/3921))
|
- [Settings/remotes] NFS: display default option on placeholder [#3631](https://github.com/vatesfr/xen-orchestra/issues/3631) (PR [#3921](https://github.com/vatesfr/xen-orchestra/pull/3921))
|
||||||
|
- [VM/advanced] Ability to pin vCPU to physical cores [#3241](https://github.com/vatesfr/xen-orchestra/issues/3241) (PR [#3254](https://github.com/vatesfr/xen-orchestra/pull/3254))
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
||||||
|
@ -587,6 +587,8 @@ set.params = {
|
|||||||
// Kernel arguments for PV VM.
|
// Kernel arguments for PV VM.
|
||||||
PV_args: { type: 'string', optional: true },
|
PV_args: { type: 'string', optional: true },
|
||||||
|
|
||||||
|
cpuMask: { type: 'array', optional: true },
|
||||||
|
|
||||||
cpuWeight: { type: ['integer', 'null'], optional: true },
|
cpuWeight: { type: ['integer', 'null'], optional: true },
|
||||||
|
|
||||||
cpuCap: { type: ['integer', 'null'], optional: true },
|
cpuCap: { type: ['integer', 'null'], optional: true },
|
||||||
|
@ -427,6 +427,7 @@ const TRANSFORMS = {
|
|||||||
let tmp
|
let tmp
|
||||||
if ((tmp = obj.VCPUs_params)) {
|
if ((tmp = obj.VCPUs_params)) {
|
||||||
tmp.cap && (vm.cpuCap = +tmp.cap)
|
tmp.cap && (vm.cpuCap = +tmp.cap)
|
||||||
|
tmp.mask && (vm.cpuMask = tmp.mask.split(',').map(_ => +_))
|
||||||
tmp.weight && (vm.cpuWeight = +tmp.weight)
|
tmp.weight && (vm.cpuWeight = +tmp.weight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,6 +332,15 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
cpuMask: {
|
||||||
|
get: vm => vm.VCPUs_params.mask && vm.VCPUs_params.mask.split(','),
|
||||||
|
set(cpuMask, vm) {
|
||||||
|
return this._updateObjectMapProperty(vm, 'VCPUs_params', {
|
||||||
|
mask: cpuMask == null ? cpuMask : cpuMask.join(','),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
cpusMax: 'cpusStaticMax',
|
cpusMax: 'cpusStaticMax',
|
||||||
cpusStaticMax: {
|
cpusStaticMax: {
|
||||||
constraints: {
|
constraints: {
|
||||||
|
@ -1071,6 +1071,8 @@ const messages = {
|
|||||||
guestOsLabel: 'Guest OS',
|
guestOsLabel: 'Guest OS',
|
||||||
miscLabel: 'Misc',
|
miscLabel: 'Misc',
|
||||||
virtualizationMode: 'Virtualization mode',
|
virtualizationMode: 'Virtualization mode',
|
||||||
|
cpuMaskLabel: 'CPU mask',
|
||||||
|
selectCpuMask: 'Select core(s)…',
|
||||||
cpuWeightLabel: 'CPU weight',
|
cpuWeightLabel: 'CPU weight',
|
||||||
defaultCpuWeight: 'Default ({value, number})',
|
defaultCpuWeight: 'Default ({value, number})',
|
||||||
cpuCapLabel: 'CPU cap',
|
cpuCapLabel: 'CPU cap',
|
||||||
|
@ -14,7 +14,13 @@ import { error } from 'notification'
|
|||||||
import { confirm } from 'modal'
|
import { confirm } from 'modal'
|
||||||
import { Container, Row, Col } from 'grid'
|
import { Container, Row, Col } from 'grid'
|
||||||
import { injectState, provideState } from 'reaclette'
|
import { injectState, provideState } from 'reaclette'
|
||||||
import { Number, Size, Text, XoSelect } from 'editable'
|
import {
|
||||||
|
Number,
|
||||||
|
Select as EditableSelect,
|
||||||
|
Size,
|
||||||
|
Text,
|
||||||
|
XoSelect,
|
||||||
|
} from 'editable'
|
||||||
import { Select, Toggle } from 'form'
|
import { Select, Toggle } from 'form'
|
||||||
import {
|
import {
|
||||||
SelectResourceSet,
|
SelectResourceSet,
|
||||||
@ -40,6 +46,7 @@ import {
|
|||||||
isEmpty,
|
isEmpty,
|
||||||
keyBy,
|
keyBy,
|
||||||
map,
|
map,
|
||||||
|
times,
|
||||||
some,
|
some,
|
||||||
uniq,
|
uniq,
|
||||||
} from 'lodash'
|
} from 'lodash'
|
||||||
@ -482,6 +489,27 @@ export default class TabAdvanced extends Component {
|
|||||||
getVmsHaValues().then(vmsHaValues => this.setState({ vmsHaValues }))
|
getVmsHaValues().then(vmsHaValues => this.setState({ vmsHaValues }))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_getCpuMaskOptions = createSelector(
|
||||||
|
() => this.props.vm,
|
||||||
|
vm =>
|
||||||
|
times(vm.CPUs.max, number => ({
|
||||||
|
value: number,
|
||||||
|
label: `Core ${number}`,
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
|
||||||
|
_getCpuMask = createSelector(
|
||||||
|
this._getCpuMaskOptions,
|
||||||
|
() => this.props.vm.cpuMask,
|
||||||
|
(options, cpuMask) =>
|
||||||
|
cpuMask !== undefined
|
||||||
|
? options.filter(({ value }) => cpuMask.includes(value))
|
||||||
|
: undefined
|
||||||
|
)
|
||||||
|
|
||||||
|
_onChangeCpuMask = cpuMask =>
|
||||||
|
editVm(this.props.vm, { cpuMask: map(cpuMask, 'value') })
|
||||||
|
|
||||||
_onNicTypeChange = value =>
|
_onNicTypeChange = value =>
|
||||||
editVm(this.props.vm, { nicType: value === '' ? null : value })
|
editVm(this.props.vm, { nicType: value === '' ? null : value })
|
||||||
|
|
||||||
@ -645,6 +673,18 @@ export default class TabAdvanced extends Component {
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)}
|
)}
|
||||||
|
<tr>
|
||||||
|
<th>{_('cpuMaskLabel')}</th>
|
||||||
|
<td>
|
||||||
|
<EditableSelect
|
||||||
|
multi
|
||||||
|
onChange={this._onChangeCpuMask}
|
||||||
|
options={this._getCpuMaskOptions()}
|
||||||
|
placeholder={_('selectCpuMask')}
|
||||||
|
value={this._getCpuMask()}
|
||||||
|
/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{_('cpuWeightLabel')}</th>
|
<th>{_('cpuWeightLabel')}</th>
|
||||||
<td>
|
<td>
|
||||||
|
Loading…
Reference in New Issue
Block a user