fix(xo-web,xo-server#probeIscsiLuns): handle undefined lun size (#5212)
See xoa-support#2815 See https://xcp-ng.org/forum/topic/3409/getting-error-when-trying-to-mount-iscsi-lun
This commit is contained in:
parent
846eff4984
commit
edaae02892
@ -13,6 +13,8 @@
|
||||
|
||||
> Users must be able to say: “I had this issue, happy to know it's fixed”
|
||||
|
||||
- [New SR] Fix `Cannot read property 'trim' of undefined` error (PR [#5212](https://github.com/vatesfr/xen-orchestra/pull/5212))
|
||||
|
||||
### Packages to release
|
||||
|
||||
> Packages will be released in the order they are here, therefore, they should
|
||||
@ -31,3 +33,4 @@
|
||||
> In case of conflict, the highest (lowest in previous list) `$version` wins.
|
||||
|
||||
- xo-web minor
|
||||
- xo-server patch
|
||||
|
@ -719,7 +719,7 @@ export async function probeIscsiLuns({
|
||||
id: lun.LUNid.trim(),
|
||||
vendor: lun.vendor.trim(),
|
||||
serial: lun.serial.trim(),
|
||||
size: lun.size.trim(),
|
||||
size: lun.size?.trim(),
|
||||
scsiId: lun.SCSIid.trim(),
|
||||
})
|
||||
})
|
||||
|
@ -82,6 +82,7 @@ const messages = {
|
||||
upgradesAvailable: 'Upgrades available',
|
||||
advancedSettings: 'Advanced settings',
|
||||
txChecksumming: 'TX checksumming',
|
||||
unknownSize: 'Unknown size',
|
||||
|
||||
// ----- Modals -----
|
||||
alertOk: 'OK',
|
||||
|
@ -144,6 +144,7 @@ class SelectIqn extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
@injectIntl
|
||||
class SelectLun extends Component {
|
||||
static propTypes = {
|
||||
onChange: PropTypes.func.isRequired,
|
||||
@ -152,11 +153,14 @@ class SelectLun extends Component {
|
||||
|
||||
_getOptions = createSelector(
|
||||
() => this.props.options,
|
||||
options =>
|
||||
() => this.props.intl.formatMessage,
|
||||
(options, formatMessage) =>
|
||||
map(options, (lun, index) => ({
|
||||
label: `LUN ${lun.id}: ${lun.serial} - ${formatSize(+lun.size)} - (${
|
||||
lun.vendor
|
||||
})`,
|
||||
label: `LUN ${lun.id}: ${lun.serial} - ${
|
||||
lun.size !== undefined
|
||||
? formatSize(+lun.size)
|
||||
: formatMessage(messages.unknownSize)
|
||||
} - (${lun.vendor})`,
|
||||
value: index,
|
||||
}))
|
||||
)
|
||||
@ -989,7 +993,11 @@ export default class New extends Component {
|
||||
{type === 'iscsi' && (
|
||||
<dl className='dl-horizontal'>
|
||||
<dt>{_('newSrSize')}</dt>
|
||||
<dd>{formatSize(+lun.size)}</dd>
|
||||
<dd>
|
||||
{lun.size !== undefined
|
||||
? formatSize(+lun.size)
|
||||
: _('unknownSize')}
|
||||
</dd>
|
||||
</dl>
|
||||
)}
|
||||
{includes(['nfs', 'hba'], type) && (
|
||||
|
Loading…
Reference in New Issue
Block a user