Skip to content

Commit

Permalink
fix(xo-web/SR): destination SRs are ISOs if we are migrating ISOs (#7431
Browse files Browse the repository at this point in the history
)

Fixes #7392
  • Loading branch information
MathieuRA committed Mar 6, 2024
1 parent 48e6d58 commit e52a0bd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

> Users must be able to say: “I had this issue, happy to know it's fixed”
- [ISO SR] During ISO migration, the destination SRs were not ISO SRs [#7392](https://github.com/vatesfr/xen-orchestra/issues/7392) (PR [#7431](https://github.com/vatesfr/xen-orchestra/pull/7431))

### Packages to release

> When modifying a package, add it here with its release type.
Expand All @@ -28,5 +30,6 @@
<!--packages-start-->

- xo-server patch
- xo-web patch

<!--packages-end-->
1 change: 1 addition & 0 deletions packages/xo-web/src/common/xo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const XEN_VIDEORAM_VALUES = [1, 2, 4, 8, 16]

// ===================================================================

export const isSrIso = sr => sr && sr.content_type === 'iso' && sr.size > 0
export const isSrWritable = sr => sr && sr.content_type !== 'iso' && sr.size > 0
export const isSrWritableOrIso = sr => sr && sr.size > 0
export const isSrShared = sr => sr && sr.shared
Expand Down
5 changes: 3 additions & 2 deletions packages/xo-web/src/common/xo/migrate-vdi-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { createCompare, createCompareContainers } from 'utils'
import { createSelector } from 'selectors'
import { SelectResourceSetsSr, SelectSr as SelectAnySr } from 'select-objects'

import { isSrShared, isSrWritable } from '../'
import { isSrIso, isSrShared, isSrWritable } from '../'

const compareSrs = createCompare([isSrShared])

Expand All @@ -33,7 +33,8 @@ export default class MigrateVdiModalBody extends Component {

_getSrPredicate = createSelector(
() => this.props.pool,
pool => sr => isSrWritable(sr) && sr.$pool === pool
() => this.props.isoSr,
(pool, isoSr) => sr => (isoSr ? isSrIso(sr) : isSrWritable(sr)) && sr.$pool === pool
)

render() {
Expand Down
2 changes: 2 additions & 0 deletions packages/xo-web/src/xo-app/sr/tab-disks.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
exportVdi,
importVdi,
isVmRunning,
isSrIso,
isSrShared,
migrateVdi,
} from 'xo'
Expand Down Expand Up @@ -361,6 +362,7 @@ export default class SrDisks extends Component {
<MigrateVdiModalBody
pool={this.props.sr.$pool}
warningBeforeMigrate={this._getGenerateWarningBeforeMigrate(vdis)}
isoSr={isSrIso(this.props.sr)}
/>
),
}).then(({ sr }) => {
Expand Down

0 comments on commit e52a0bd

Please sign in to comment.