fix(hosts): multipathing should not require disconnecting srs on local storage (#10592)

XO-2336
This commit is contained in:
ayoub-el-kajji-v
2026-10-19 16:07:07 +02:00
committed by GitHub
parent ab4d372ce2
commit d32c9879b1
4 changed files with 27 additions and 9 deletions

View File

@@ -90,6 +90,7 @@
- [Servers] Fix a pool left in a broken state when its connection was lost twice in a row within 5 minutes (e.g. during a toolstack restart): it could be displayed as connecting while connected and its objects could no longer be acted upon, or it would never be reconnected automatically (PR [#10577](https://github.com/vatesfr/xen-orchestra/pull/10577))
- [Swagger] Fixed a typo in the VM collection: `xentools` → `xenTools`, and added a missing type to the server collection `poolMembersAddresses` [#10514](https://github.com/vatesfr/xen-orchestra/issues/10514) (PR [#10598](https://github.com/vatesfr/xen-orchestra/pull/10598))
- [VM/console] Fix opening console in new tab (PR [#10616](https://github.com/vatesfr/xen-orchestra/pull/10616))
- [Host] Enabling multipathing on hosts only disconnects shared SRs, local storage SRs stay connected(PR [#10592](https://github.com/vatesfr/xen-orchestra/pull/10592))
### Packages to release

View File

@@ -297,16 +297,28 @@ export default class Xapi extends XapiBase {
async setHostMultipathing($defer, hostId, multipathing) {
const host = this.getObject(hostId)
// Only shared SRs are affected by multipathing, local SRs can stay connected.
//
// Unplugging a shared SR would break running VMs with disks on it, the
// user must migrate them first.
const vmsOnSharedSrs = host.$resident_VMs.filter(
vm => !vm.is_control_domain && vm.$VBDs.some(vbd => vbd.$VDI?.$SR?.shared)
)
if (vmsOnSharedSrs.length !== 0) {
throw forbiddenOperation(
'set host multipathing',
`the following VMs have disks on shared SRs and must be migrated first: ${vmsOnSharedSrs
.map(vm => vm?.name_label + ': ' + vm.uuid)
.join(', ')}`
)
}
if (host.enabled) {
await this.disableHost(hostId)
$defer(() => this.enableHost(hostId))
}
// Xen center evacuate running VMs before unplugging the PBDs.
// The evacuate method uses the live migration to migrate running VMs
// from host to another. It only works when a shared SR is present
// in the host. For this reason we chose to show a warning instead.
const pluggedPbds = host.$PBDs.filter(pbd => pbd.currently_attached)
const pluggedPbds = host.$PBDs.filter(pbd => pbd.currently_attached && pbd.$SR?.shared)
await asyncMapSettled(pluggedPbds, async pbd => {
const ref = pbd.$ref
await this.unplugPbd(ref)

View File

@@ -1151,9 +1151,9 @@ const messages = {
hostMultipathingSrs: 'Click to see concerned SRs',
hostMultipathingPaths: '{nActives, number} of {nPaths, number} path{nPaths, plural, one {} other {s}}',
hostMultipathingRequiredState:
'This action will not be fulfilled if a VM is in a running state. Please ensure that all VMs are evacuated or stopped before performing this action!',
'This action will not be fulfilled if a VM is in a running state on shared SRs. Please ensure that all VMs are evacuated or stopped before performing this action!',
hostMultipathingWarning:
'The host{nHosts, plural, one {} other {s}} will lose their connection to the SRs. Do you want to continue?',
'The host{nHosts, plural, one {} other {s}} will lose their connection to the shared SRs. Do you want to continue?',
hostXenServerVersion: 'Version',
hostStatusEnabled: 'Enabled',
hostStatusDisabled: 'Disabled',

View File

@@ -16,10 +16,15 @@ import { Sr } from '../../render-xo-item'
pbd =>
hostIds.includes(pbd.host)
),
pbds => {
createGetObjectsOfType('SR'),
(pbds, srs) => {
const srIds = new Set([])
for (const id in pbds) {
srIds.add(pbds[id].SR)
const pbd = pbds[id]
const sr = srs[pbd.SR]
if (sr !== undefined && sr.shared) {
srIds.add(pbd.SR)
}
}
return [...srIds]
}