feat(xo-web/xostor): expose ignoreFileSystems at creation (#7338)
This commit is contained in:
parent
755b206901
commit
05df055552
@ -9,6 +9,7 @@
|
||||
|
||||
- [SR] Possibility to create SMB shared SR [#991](https://github.com/vatesfr/xen-orchestra/issues/991) (PR [#7330](https://github.com/vatesfr/xen-orchestra/pull/7330))
|
||||
- [Import/VMWare] Speed up import and make all imports thin [#7323](https://github.com/vatesfr/xen-orchestra/issues/7323)
|
||||
- [XOSTOR] Allow user to ignore file systems at storage creation (PR[#7338](https://github.com/vatesfr/xen-orchestra/pull/7338))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
@ -2542,6 +2542,7 @@ const messages = {
|
||||
fieldRequired: '{field} is required',
|
||||
fieldsMissing: 'Some fields are missing',
|
||||
hostsNotSameNumberOfDisks: 'Hosts do not have the same number of disks',
|
||||
ignoreFileSystems: 'Ignore file systems',
|
||||
isTapdevsDisk: 'This is "tapdevs" disk',
|
||||
licenseBoundUnknownXostor: 'License attached to an unknown XOSTOR',
|
||||
licenseNotBoundXostor: 'No XOSTOR attached',
|
||||
|
@ -17,6 +17,7 @@ import { Input as DebounceInput } from 'debounce-input-decorator'
|
||||
import { Pool as PoolRenderItem, Network as NetworkRenderItem } from 'render-xo-item'
|
||||
import { SelectHost, SelectPool, SelectNetwork } from 'select-objects'
|
||||
import { toggleState, linkState } from 'reaclette-utils'
|
||||
import { Toggle } from 'form'
|
||||
|
||||
import styles from './index.css'
|
||||
|
||||
@ -36,6 +37,11 @@ const REPLICATION_OPTIONS = [
|
||||
{ value: 3, label: '3' },
|
||||
]
|
||||
|
||||
const SPACE_BETWEEN = {
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
}
|
||||
|
||||
const hasXostor = srs => some(srs, sr => sr.SR_type === 'linstor')
|
||||
const formatDiskName = name => '/dev/' + name
|
||||
const diskHasChildren = disk => Array.isArray(disk.children) && disk.children.length > 0
|
||||
@ -90,14 +96,32 @@ const StorageCard = decorate([
|
||||
|
||||
const SettingsCard = decorate([
|
||||
provideState({
|
||||
initialState: () => ({ displayAdvancedSettings: false }),
|
||||
computed: {
|
||||
showWarningReplication: state => state.replication?.value === 1,
|
||||
},
|
||||
effects: {
|
||||
toggleDisplayAdvancedSettings: () => state => ({
|
||||
displayAdvancedSettings: !state.displayAdvancedSettings,
|
||||
}),
|
||||
},
|
||||
}),
|
||||
injectState,
|
||||
({ effects, state }) => (
|
||||
<Card>
|
||||
<CardHeader>{_('settings')}</CardHeader>
|
||||
<CardHeader>
|
||||
{_('settings')}
|
||||
<ActionButton
|
||||
className='pull-right'
|
||||
data-mode='_displayAdvancedSettings'
|
||||
handler={effects.toggleDisplayAdvancedSettings}
|
||||
icon={state.displayAdvancedSettings ? 'toggle-on' : 'toggle-off'}
|
||||
iconColor={state.displayAdvancedSettings ? 'text-success' : undefined}
|
||||
size='small'
|
||||
>
|
||||
{_('advancedSettings')}
|
||||
</ActionButton>
|
||||
</CardHeader>
|
||||
<CardBlock>
|
||||
<Row>
|
||||
<Col>
|
||||
@ -116,6 +140,14 @@ const SettingsCard = decorate([
|
||||
<Select onChange={effects.onProvisioningChange} options={PROVISIONING_OPTIONS} value={state.provisioning} />
|
||||
</Col>
|
||||
</Row>
|
||||
{state.displayAdvancedSettings && (
|
||||
<Row>
|
||||
<Col style={SPACE_BETWEEN}>
|
||||
<label>{_('ignoreFileSystems')}</label>
|
||||
<Toggle value={state.ignoreFileSystems} onChange={effects.onIgnoreFileSystemsChange} size='small' />
|
||||
</Col>
|
||||
</Row>
|
||||
)}
|
||||
</CardBlock>
|
||||
</Card>
|
||||
),
|
||||
@ -472,6 +504,7 @@ const NewXostorForm = decorate([
|
||||
_networkId: undefined,
|
||||
_createdSrUuid: undefined, // used for redirection when the storage has been created
|
||||
disksByHost: {},
|
||||
ignoreFileSystems: false,
|
||||
provisioning: PROVISIONING_OPTIONS[0], // default value 'thin'
|
||||
poolId: undefined,
|
||||
hostId: undefined,
|
||||
@ -484,6 +517,9 @@ const NewXostorForm = decorate([
|
||||
onHostChange(_, host) {
|
||||
this.state.hostId = host?.id
|
||||
},
|
||||
onIgnoreFileSystemsChange(_, value) {
|
||||
this.state.ignoreFileSystems = value
|
||||
},
|
||||
onPoolChange(_, pool) {
|
||||
this.state.disksByHost = {}
|
||||
this.state.poolId = pool?.id
|
||||
@ -514,11 +550,12 @@ const NewXostorForm = decorate([
|
||||
}
|
||||
},
|
||||
async createXostorSr() {
|
||||
const { disksByHost, srDescription, srName, provisioning, replication } = this.state
|
||||
const { disksByHost, ignoreFileSystems, srDescription, srName, provisioning, replication } = this.state
|
||||
|
||||
this.state._createdSrUuid = await createXostorSr({
|
||||
description: srDescription.trim() === '' ? undefined : srDescription.trim(),
|
||||
disksByHost: mapValues(disksByHost, disks => disks.map(disk => formatDiskName(disk.name))),
|
||||
ignoreFileSystems,
|
||||
name: srName.trim() === '' ? undefined : srName.trim(),
|
||||
provisioning: provisioning.value,
|
||||
replication: replication.value,
|
||||
|
Loading…
Reference in New Issue
Block a user