feat(xo-server,xo-web): disable Load Balancer during Rolling Pool Update (#6089)

Fixes #5711
Follow-up of #6057
This commit is contained in:
Pierre Donias
2022-01-17 10:08:32 +01:00
committed by GitHub
parent 73fd7c7d54
commit 6756faa1cc
5 changed files with 28 additions and 4 deletions

View File

@@ -13,6 +13,7 @@
- [Delta Backup] When using S3 remote, retry uploading VHD parts on Internal Error to support [Blackblaze](https://www.backblaze.com/b2/docs/calling.html#error_handling) (PR [#6086](https://github.com/vatesfr/xen-orchestra/issues/6086)) (Forum [5397](https://xcp-ng.org/forum/topic/5397/delta-backups-failing-aws-s3-uploadpartcopy-cpu-too-busy/5))
- [Backup] Add sanity check of aliases on S3 remotes (PR [6043](https://github.com/vatesfr/xen-orchestra/pull/6043))
- [Export/Disks] Allow the export of disks in VMDK format(PR [#5982](https://github.com/vatesfr/xen-orchestra/pull/5982))
- [Rolling Pool Update] Automatically pause load balancer plugin during the update [#5711](https://github.com/vatesfr/xen-orchestra/issues/5711)
### Bug fixes

View File

@@ -1,3 +1,4 @@
import { defer as deferrable } from 'golike-defer'
import { format } from 'json-rpc-peer'
import { Ref } from 'xen-api'
@@ -131,9 +132,14 @@ installPatches.description = 'Install patches on hosts'
// -------------------------------------------------------------------
export async function rollingUpdate({ pool }) {
export const rollingUpdate = deferrable(async function ($defer, { pool }) {
if ((await this.getPlugin('load-balancer'))?.loaded) {
await this.unloadPlugin('load-balancer')
$defer(() => this.loadPlugin('load-balancer'))
}
await this.getXapi(pool).rollingPoolUpdate()
}
})
rollingUpdate.params = {
pool: { type: 'string' },

View File

@@ -92,7 +92,7 @@ export default class {
}
}
async _getPlugin(id) {
async getPlugin(id) {
const {
configurationPresets,
configurationSchema,
@@ -123,7 +123,7 @@ export default class {
}
async getPlugins() {
return /* await */ Promise.all(mapToArray(this._plugins, ({ id }) => this._getPlugin(id)))
return /* await */ Promise.all(mapToArray(this._plugins, ({ id }) => this.getPlugin(id)))
}
// Validate the configuration and configure the plugin instance.

View File

@@ -1004,6 +1004,8 @@ const messages = {
rollingPoolUpdateMessage:
'Are you sure you want to start a rolling pool update? Running VMs will be migrated back and forth and this can take a while.',
rollingPoolUpdateHaWarning: 'High Availability is enabled. This will automatically disable it during the update.',
rollingPoolUpdateLoadBalancerWarning:
'Load Balancer plugin is running. This will automatically pause it during the update.',
poolNeedsDefaultSr: 'The pool needs a default SR to install the patches.',
vmsHaveCds: '{nVms, number} VM{nVms, plural, one {} other {s}} {nVms, plural, one {has} other {have}} CDs',
ejectCds: 'Eject CDs',

View File

@@ -1,10 +1,16 @@
import _ from 'intl'
import addSubscriptions from 'add-subscriptions'
import BaseComponent from 'base-component'
import Icon from 'icon'
import React from 'react'
import { connectStore } from 'utils'
import { createGetObjectsOfType } from 'selectors'
import { subscribePlugins } from '../'
@addSubscriptions(() => ({
plugins: subscribePlugins,
}))
@connectStore(
{
pools: createGetObjectsOfType('pool'),
@@ -14,6 +20,8 @@ import { createGetObjectsOfType } from 'selectors'
export default class RollingPoolUpdateModal extends BaseComponent {
render() {
const pool = this.props.pools[this.props.pool]
const loadBalancerPlugin =
this.props.plugins !== undefined && this.props.plugins.find(plugin => plugin.name === 'load-balancer')
return (
<div>
@@ -25,6 +33,13 @@ export default class RollingPoolUpdateModal extends BaseComponent {
</em>
</p>
)}
{loadBalancerPlugin !== undefined && loadBalancerPlugin.loaded && (
<p>
<em className='text-warning'>
<Icon icon='alarm' /> {_('rollingPoolUpdateLoadBalancerWarning')}
</em>
</p>
)}
</div>
)
}