feat(xo-web/pool/advanced): ability to set a crash dump SR (#6973)

Fixes #5060
This commit is contained in:
Mathieu
2023-08-18 15:34:05 +02:00
committed by GitHub
parent 785a5857ef
commit 999fba2030
5 changed files with 43 additions and 2 deletions
+2 -1
View File
@@ -9,6 +9,7 @@
- [Netbox] Synchronize VM tags [#5899](https://github.com/vatesfr/xen-orchestra/issues/5899) [Forum#6902](https://xcp-ng.org/forum/topic/6902) (PR [#6957](https://github.com/vatesfr/xen-orchestra/pull/6957))
- [REST API] Add support for `filter` and `limit` parameters to `backups/logs` and `restore/logs` collections [Forum#64789](https://xcp-ng.org/forum/post/64789)
- [Pool/Advanced] Ability to set a crash dump SR [#5060](https://github.com/vatesfr/xen-orchestra/issues/5060) (PR [#6973](https://github.com/vatesfr/xen-orchestra/pull/6973))
### Bug fixes
@@ -44,6 +45,6 @@
- xo-server minor
- xo-server-auth-ldap patch
- xo-server-netbox minor
- xo-web patch
- xo-web minor
<!--packages-end-->
+8
View File
@@ -20,6 +20,7 @@ export async function set({
backupNetwork,
migrationNetwork,
suspendSr,
crashDumpSr,
}) {
pool = this.getXapiObject(pool)
@@ -29,6 +30,8 @@ export async function set({
migrationNetwork !== undefined && pool.update_other_config('xo:migrationNetwork', migrationNetwork),
backupNetwork !== undefined && pool.update_other_config('xo:backupNetwork', backupNetwork),
suspendSr !== undefined && pool.$call('set_suspend_image_SR', suspendSr === null ? Ref.EMPTY : suspendSr._xapiRef),
crashDumpSr !== undefined &&
pool.$call('set_crash_dump_SR', crashDumpSr === null ? Ref.EMPTY : crashDumpSr._xapiRef),
])
}
@@ -57,11 +60,16 @@ set.params = {
type: ['string', 'null'],
optional: true,
},
crashDumpSr: {
type: ['string', 'null'],
optional: true,
},
}
set.resolve = {
pool: ['id', 'pool', 'administrate'],
suspendSr: ['suspendSr', 'SR', 'administrate'],
crashDumpSr: ['crashDumpSr', 'SR', 'administrate'],
}
// -------------------------------------------------------------------
@@ -98,6 +98,7 @@ const TRANSFORMS = {
pool(obj) {
const cpuInfo = obj.cpu_info
return {
crashDumpSr: link(obj, 'crash_dump_SR'),
current_operations: obj.current_operations,
default_SR: link(obj, 'default_SR'),
HA_enabled: Boolean(obj.ha_enabled),
@@ -873,6 +873,7 @@ const messages = {
srsTabName: 'SRs',
// ----- Pool advanced tab -----
backupNetwork: 'Backup network',
crashDumpSr: 'Crash dump SR',
poolEditAll: 'Edit all',
poolHaStatus: 'High Availability',
poolHaEnabled: 'Enabled',
@@ -5,7 +5,7 @@ import ActionButton from 'action-button'
import ActionRowButton from 'action-row-button'
import Component from 'base-component'
import Icon from 'icon'
import renderXoItem, { Network } from 'render-xo-item'
import renderXoItem, { Network, Sr } from 'render-xo-item'
import SelectFiles from 'select-files'
import TabButton from 'tab-button'
import Upgrade from 'xoa-upgrade'
@@ -25,6 +25,7 @@ import {
import {
editPool,
installSupplementalPackOnAllHosts,
isSrWritable,
setHostsMultipathing,
setPoolMaster,
setRemoteSyslogHost,
@@ -244,16 +245,27 @@ export default class TabAdvanced extends Component {
_removeMigrationNetwork = () => editPool(this.props.pool, { migrationNetwork: null })
_onChangeCrashDumpSr = sr => editPool(this.props.pool, { crashDumpSr: sr.id })
_onRemoveCrashDumpSr = () => editPool(this.props.pool, { crashDumpSr: null })
_setRemoteSyslogHosts = () =>
setRemoteSyslogHosts(this.props.hosts, this.state.syslogDestination).then(() =>
this.setState({ editRemoteSyslog: false, syslogDestination: '' })
)
_getCrashDumpSrPredicate = createSelector(
() => this.props.pool,
pool => sr => isSrWritable(sr) && sr.$pool === pool.id
)
render() {
const { backupNetwork, hosts, isAdmin, gpuGroups, pool, hostsByMultipathing, migrationNetwork } = this.props
const { state } = this
const { editRemoteSyslog } = state
const { enabled: hostsEnabledMultipathing, disabled: hostsDisabledMultipathing } = hostsByMultipathing
const { crashDumpSr } = pool
const crashDumpSrPredicate = this._getCrashDumpSrPredicate()
return (
<div>
<Container>
@@ -343,6 +355,24 @@ export default class TabAdvanced extends Component {
<SelectSuspendSr pool={pool} />
</td>
</tr>
<tr>
<th>{_('crashDumpSr')}</th>
<td>
<XoSelect
onChange={this._onChangeCrashDumpSr}
predicate={crashDumpSrPredicate}
value={crashDumpSr}
xoType='SR'
>
{crashDumpSr !== undefined ? <Sr id={crashDumpSr} /> : _('noValue')}
</XoSelect>{' '}
{crashDumpSr !== undefined && (
<a onClick={this._onRemoveCrashDumpSr} role='button'>
<Icon icon='remove' />
</a>
)}
</td>
</tr>
</tbody>
</table>
</Col>