feat(xo-web/vm/tab-disks): rescan ISO SRs (#5814)
See https://xcp-ng.org/forum/topic/4588/add-rescan-iso-sr-from-vm-menu
This commit is contained in:
parent
2238c98e95
commit
f3501acb64
@ -11,6 +11,7 @@
|
|||||||
- [Backup] Distinguish error messages between cancelation and interrupted HTTP connection
|
- [Backup] Distinguish error messages between cancelation and interrupted HTTP connection
|
||||||
- [Jobs] Add `host.emergencyShutdownHost` to the list of methods that jobs can call (PR [#5818](https://github.com/vatesfr/xen-orchestra/pull/5818))
|
- [Jobs] Add `host.emergencyShutdownHost` to the list of methods that jobs can call (PR [#5818](https://github.com/vatesfr/xen-orchestra/pull/5818))
|
||||||
- [Host/Load-balancer] Log vm and host names when a VM is migrated + category (density, performance, ...) (PR [#5808](https://github.com/vatesfr/xen-orchestra/pull/5808))
|
- [Host/Load-balancer] Log vm and host names when a VM is migrated + category (density, performance, ...) (PR [#5808](https://github.com/vatesfr/xen-orchestra/pull/5808))
|
||||||
|
- [VM/disks] Ability to rescan ISO SRs (PR [#5814](https://github.com/vatesfr/xen-orchestra/pull/5814))
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
||||||
|
@ -1073,6 +1073,7 @@ const messages = {
|
|||||||
containerRestart: 'Restart this container',
|
containerRestart: 'Restart this container',
|
||||||
|
|
||||||
// ----- VM disk tab -----
|
// ----- VM disk tab -----
|
||||||
|
rescanIsoSrs: 'Rescan all ISO SRs',
|
||||||
vbdCreateDeviceButton: 'New disk',
|
vbdCreateDeviceButton: 'New disk',
|
||||||
vdiAttachDevice: 'Attach disk',
|
vdiAttachDevice: 'Attach disk',
|
||||||
vdiAttachDeviceConfirm: 'The selected VDI is already attached to this VM. Are you sure you want to continue?',
|
vdiAttachDeviceConfirm: 'The selected VDI is already attached to this VM. Are you sure you want to continue?',
|
||||||
|
@ -11,6 +11,7 @@ import React from 'react'
|
|||||||
import StateButton from 'state-button'
|
import StateButton from 'state-button'
|
||||||
import SortedTable from 'sorted-table'
|
import SortedTable from 'sorted-table'
|
||||||
import TabButton from 'tab-button'
|
import TabButton from 'tab-button'
|
||||||
|
import { compact, every, filter, find, forEach, get, isEmpty, map, some, sortedUniq, uniq } from 'lodash'
|
||||||
import { Sr } from 'render-xo-item'
|
import { Sr } from 'render-xo-item'
|
||||||
import { Container, Row, Col } from 'grid'
|
import { Container, Row, Col } from 'grid'
|
||||||
import {
|
import {
|
||||||
@ -36,7 +37,6 @@ import { SizeInput, Toggle } from 'form'
|
|||||||
import { XoSelect, Size, Text } from 'editable'
|
import { XoSelect, Size, Text } from 'editable'
|
||||||
import { confirm } from 'modal'
|
import { confirm } from 'modal'
|
||||||
import { error } from 'notification'
|
import { error } from 'notification'
|
||||||
import { compact, every, filter, find, forEach, get, map, some, sortedUniq, uniq } from 'lodash'
|
|
||||||
import {
|
import {
|
||||||
attachDiskToVm,
|
attachDiskToVm,
|
||||||
createDisk,
|
createDisk,
|
||||||
@ -53,6 +53,7 @@ import {
|
|||||||
isSrWritable,
|
isSrWritable,
|
||||||
isVmRunning,
|
isVmRunning,
|
||||||
migrateVdi,
|
migrateVdi,
|
||||||
|
rescanSrs,
|
||||||
setBootableVbd,
|
setBootableVbd,
|
||||||
subscribeResourceSets,
|
subscribeResourceSets,
|
||||||
} from 'xo'
|
} from 'xo'
|
||||||
@ -449,11 +450,15 @@ class AttachDisk extends Component {
|
|||||||
}))
|
}))
|
||||||
@connectStore(() => {
|
@connectStore(() => {
|
||||||
const getAllVbds = createGetObjectsOfType('VBD')
|
const getAllVbds = createGetObjectsOfType('VBD')
|
||||||
|
const getIsoSrs = createGetObjectsOfType('SR').filter((_, { pool: { $pool } }) => sr =>
|
||||||
|
sr.$pool === $pool && sr.SR_type === 'iso'
|
||||||
|
)
|
||||||
|
|
||||||
return (state, props) => ({
|
return (state, props) => ({
|
||||||
allVbds: getAllVbds(state, props),
|
allVbds: getAllVbds(state, props),
|
||||||
checkPermissions: getCheckPermissions(state, props),
|
checkPermissions: getCheckPermissions(state, props),
|
||||||
isAdmin: isAdmin(state, props),
|
isAdmin: isAdmin(state, props),
|
||||||
|
isoSrs: getIsoSrs(state, props),
|
||||||
resolvedResourceSet: getResolvedResourceSet(state, props, !props.isAdmin && props.resourceSet !== undefined),
|
resolvedResourceSet: getResolvedResourceSet(state, props, !props.isAdmin && props.resourceSet !== undefined),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -609,6 +614,8 @@ export default class TabDisks extends Component {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_rescanIsoSrs = () => rescanSrs(this.props.isoSrs)
|
||||||
|
|
||||||
actions = [
|
actions = [
|
||||||
{
|
{
|
||||||
disabled: selectedVbds => some(selectedVbds, 'attached'),
|
disabled: selectedVbds => some(selectedVbds, 'attached'),
|
||||||
@ -639,7 +646,7 @@ export default class TabDisks extends Component {
|
|||||||
]
|
]
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { allVbds, resolvedResourceSet, vm } = this.props
|
const { allVbds, isoSrs, resolvedResourceSet, vm } = this.props
|
||||||
|
|
||||||
const { attachDisk, newDisk } = this.state
|
const { attachDisk, newDisk } = this.state
|
||||||
|
|
||||||
@ -704,6 +711,14 @@ export default class TabDisks extends Component {
|
|||||||
<Col mediumSize={5}>
|
<Col mediumSize={5}>
|
||||||
<IsoDevice vm={vm} />
|
<IsoDevice vm={vm} />
|
||||||
</Col>
|
</Col>
|
||||||
|
<Col mediumSize={1}>
|
||||||
|
<ActionButton
|
||||||
|
disabled={isEmpty(isoSrs)}
|
||||||
|
handler={this._rescanIsoSrs}
|
||||||
|
icon='refresh'
|
||||||
|
tooltip={_('rescanIsoSrs')}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Container>
|
</Container>
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user