feat(xo-server,xo-web/SR): expose thin/thick provisioning (#5081)

Fixes #2208
This commit is contained in:
Rajaa.BARHTAOUI 2020-06-24 16:21:23 +02:00 committed by GitHub
parent ec9476216f
commit ae9aeaf5fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 47 additions and 4 deletions

View File

@ -15,6 +15,7 @@
- [VM] Differentiate PV drivers detection from management agent detection [#4783](https://github.com/vatesfr/xen-orchestra/issues/4783) (PR [#5007](https://github.com/vatesfr/xen-orchestra/pull/5007))
- [Home/VM] Homogenize the list of backed up VMs with the normal list (PR [#5046](https://github.com/vatesfr/xen-orchestra/pull/5046)
- [SR/Disks] Add tooltip for disabled migration (PR [#4884](https://github.com/vatesfr/xen-orchestra/pull/4884))
- [SR/Advanced, SR selector] Show thin/thick provisioning [#2208](https://github.com/vatesfr/xen-orchestra/issues/2208) (PR [#5081](https://github.com/vatesfr/xen-orchestra/pull/5081))
### Bug fixes

View File

@ -19,6 +19,28 @@ import { useUpdateSystem } from './xapi/utils'
// ===================================================================
const ALLOCATION_BY_TYPE = {
ext: 'thin',
file: 'thin',
hba: 'thick',
lvhd: 'thick',
lvhdofcoe: 'thick',
lvhdohba: 'thick',
lvhdoiscsi: 'thick',
nfs: 'thin',
ocfs: 'thick',
ocfsohba: 'thick',
ocfsoiscsi: 'thick',
rawhba: 'thick',
rawiscsi: 'thick',
shm: 'thin',
smb: 'thin',
xosan: 'thin',
zfs: 'thin',
}
// ===================================================================
const { defineProperties, freeze } = Object
function link(obj, prop, idField = '$id') {
@ -487,6 +509,7 @@ const TRANSFORMS = {
// -----------------------------------------------------------------
sr(obj) {
const srType = obj.type
return {
type: 'SR',
@ -495,11 +518,12 @@ const TRANSFORMS = {
// TODO: Should it replace usage?
physical_usage: +obj.physical_utilisation,
allocationStrategy: ALLOCATION_BY_TYPE[srType],
name_description: obj.name_description,
name_label: obj.name_label,
size: +obj.physical_size,
shared: Boolean(obj.shared),
SR_type: obj.type,
SR_type: srType,
tags: obj.tags,
usage: +obj.virtual_allocation,
VDIs: link(obj, 'VDIs'),

View File

@ -748,6 +748,7 @@ const messages = {
// ----- SR advanced tab -----
provisioning: 'Provisioning',
srUnhealthyVdiDepth: 'Depth',
srUnhealthyVdiNameLabel: 'Name',
srUnhealthyVdiSize: 'Size',

View File

@ -235,9 +235,12 @@ export const Sr = decorate([
<LinkWrapper link={link} newTab={newTab} to={`/srs/${sr.id}`}>
<Icon icon='sr' /> {sr.name_label}
{!self && spaceLeft && isSrWritable(sr) && (
<span className={!link && 'text-muted'}>{` (${formatSize(
sr.size - sr.physical_usage
)} free)`}</span>
<span className={!link && 'text-muted'}>
{` (${formatSize(sr.size - sr.physical_usage)} free`}
{sr.allocationStrategy !== undefined &&
` - ${sr.allocationStrategy}`}
)
</span>
)}
{!self && container !== undefined && (
<span className={!link && 'text-muted'}>

View File

@ -1,5 +1,6 @@
import _ from 'intl'
import Copiable from 'copiable'
import defined from '@xen-orchestra/defined'
import React from 'react'
import SortedTable from 'sorted-table'
import TabButton from 'tab-button'
@ -47,6 +48,7 @@ const UnhealthyVdiChains = flowRight(
)(({ chains, vdis }) =>
isEmpty(vdis) ? null : (
<div>
<hr />
<h3>{_('srUnhealthyVdiTitle', { total: sum(values(chains)) })}</h3>
<SortedTable
collection={vdis}
@ -71,6 +73,18 @@ export default ({ sr }) => (
/>
</Col>
</Row>
<Row>
<Col>
<table className='table'>
<tbody>
<tr>
<th>{_('provisioning')}</th>
<td>{defined(sr.allocationStrategy, _('noValue'))}</td>
</tr>
</tbody>
</table>
</Col>
</Row>
<Row>
<Col>
<UnhealthyVdiChains sr={sr} />