diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index 9be7331ae..32f640ad9 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -11,6 +11,7 @@ - [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)) - [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 diff --git a/packages/xo-web/src/common/intl/messages.js b/packages/xo-web/src/common/intl/messages.js index c4c0b09c5..027b28ae7 100644 --- a/packages/xo-web/src/common/intl/messages.js +++ b/packages/xo-web/src/common/intl/messages.js @@ -1073,6 +1073,7 @@ const messages = { containerRestart: 'Restart this container', // ----- VM disk tab ----- + rescanIsoSrs: 'Rescan all ISO SRs', vbdCreateDeviceButton: 'New disk', vdiAttachDevice: 'Attach disk', vdiAttachDeviceConfirm: 'The selected VDI is already attached to this VM. Are you sure you want to continue?', diff --git a/packages/xo-web/src/xo-app/vm/tab-disks.js b/packages/xo-web/src/xo-app/vm/tab-disks.js index 16b58a100..77de257f1 100644 --- a/packages/xo-web/src/xo-app/vm/tab-disks.js +++ b/packages/xo-web/src/xo-app/vm/tab-disks.js @@ -11,6 +11,7 @@ import React from 'react' import StateButton from 'state-button' import SortedTable from 'sorted-table' 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 { Container, Row, Col } from 'grid' import { @@ -36,7 +37,6 @@ import { SizeInput, Toggle } from 'form' import { XoSelect, Size, Text } from 'editable' import { confirm } from 'modal' import { error } from 'notification' -import { compact, every, filter, find, forEach, get, map, some, sortedUniq, uniq } from 'lodash' import { attachDiskToVm, createDisk, @@ -53,6 +53,7 @@ import { isSrWritable, isVmRunning, migrateVdi, + rescanSrs, setBootableVbd, subscribeResourceSets, } from 'xo' @@ -449,11 +450,15 @@ class AttachDisk extends Component { })) @connectStore(() => { const getAllVbds = createGetObjectsOfType('VBD') + const getIsoSrs = createGetObjectsOfType('SR').filter((_, { pool: { $pool } }) => sr => + sr.$pool === $pool && sr.SR_type === 'iso' + ) return (state, props) => ({ allVbds: getAllVbds(state, props), checkPermissions: getCheckPermissions(state, props), isAdmin: isAdmin(state, props), + isoSrs: getIsoSrs(state, props), 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 = [ { disabled: selectedVbds => some(selectedVbds, 'attached'), @@ -639,7 +646,7 @@ export default class TabDisks extends Component { ] render() { - const { allVbds, resolvedResourceSet, vm } = this.props + const { allVbds, isoSrs, resolvedResourceSet, vm } = this.props const { attachDisk, newDisk } = this.state @@ -704,6 +711,14 @@ export default class TabDisks extends Component {