Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(xo-web/migrate/vm): allow to select private network for VIFs network #6200

Merged
merged 5 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

- [VM export] Feat export to `ova` format (PR [#6006](https://github.com/vatesfr/xen-orchestra/pull/6006))
- [Backup] Add _Restore Health Check_: ensure a backup is viable by doing an automatic test restore (requires guest tools in the VM) [#6148](https://github.com/vatesfr/xen-orchestra/pull/6148)
- [VM migrate] Allow to choose a private network for VIFs network (PR [#6200](https://github.com/vatesfr/xen-orchestra/pull/6200))

### Bug fixes

Expand Down
24 changes: 10 additions & 14 deletions packages/xo-web/src/common/xo/migrate-vm-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import BaseComponent from 'base-component'
import every from 'lodash/every'
import find from 'lodash/find'
import forEach from 'lodash/forEach'
import isEmpty from 'lodash/isEmpty'
import map from 'lodash/map'
import React from 'react'
import store from 'store'
Expand Down Expand Up @@ -81,21 +82,16 @@ export default class MigrateVmModalBody extends BaseComponent {
)

this._getTargetNetworkPredicate = createSelector(
createPicker(
() => this.props.pifs,
() => this.state.host.$PIFs
),
pifs => {
if (!pifs) {
return false
}

const networks = {}
forEach(pifs, pif => {
networks[pif.$network] = true
() => this.props.networks,
() => this.state.host.$poolId,
(networks, poolId) => {
const _networks = {}
forEach(networks, network => {
if (network.$poolId === poolId) {
_networks[network.id] = true
}
})

return network => networks[network.id]
return isEmpty(_networks) ? false : network => _networks[network.id]
}
)

Expand Down
23 changes: 9 additions & 14 deletions packages/xo-web/src/common/xo/migrate-vms-modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,16 @@ export default class MigrateVmsModalBody extends BaseComponent {
)

this._getTargetNetworkPredicate = createSelector(
createPicker(
() => this.props.pifs,
() => this.state.host.$PIFs
),
pifs => {
if (!pifs) {
return false
}

const networks = {}
forEach(pifs, pif => {
networks[pif.$network] = true
() => this.props.networks,
() => this.state.host.$poolId,
(networks, poolId) => {
const _networks = {}
forEach(networks, network => {
if (network.$poolId === poolId) {
_networks[network.id] = true
}
})

return network => networks[network.id]
return isEmpty(_networks) ? false : network => _networks[network.id]
}
)

Expand Down