Skip to content

Commit

Permalink
feat(xo-server,xo-web): disable Load Balancer during Rolling Pool Update
Browse files Browse the repository at this point in the history
Fixes #5711
Follow-up of #6057
  • Loading branch information
pdonias committed Jan 12, 2022
1 parent e9ca13a commit 6d2ef30
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Limit number of concurrent VM migrations per pool to `3` [#6065](https://github.com/vatesfr/xen-orchestra/issues/6065) (PR [#6076](https://github.com/vatesfr/xen-orchestra/pull/6076))
Can be changed in `xo-server`'s configuration file: `xapiOptions.vmMigrationConcurrency`
- [Rolling Pool Update] Automatically pause load balancer plugin during the update [#5711](https://github.com/vatesfr/xen-orchestra/issues/5711)

### Bug fixes

Expand All @@ -34,4 +35,5 @@
- @xen-orchestra/backups patch
- @xen-orchestra/backups-cli patch
- @xen-orchestra/proxy patch
- xo-server patch
- xo-server minor
- xo-web minor
10 changes: 10 additions & 0 deletions packages/xo-server/src/api/pool.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,17 @@ installPatches.description = 'Install patches on hosts'
// -------------------------------------------------------------------

export async function rollingUpdate({ pool }) {
const loadBalancerPlugin = (await this.getPlugins()).find(plugin => plugin.name === 'load-balancer')
const pauseLoadBalancer = loadBalancerPlugin?.loaded
if (pauseLoadBalancer) {
await this.unloadPlugin('load-balancer')
}

await this.getXapi(pool).rollingPoolUpdate()

if (pauseLoadBalancer) {
await this.loadPlugin('load-balancer')
}
}

rollingUpdate.params = {
Expand Down
2 changes: 2 additions & 0 deletions packages/xo-web/src/common/intl/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
14 changes: 14 additions & 0 deletions packages/xo-web/src/common/xo/rolling-pool-updates-modal/index.js
Original file line number Diff line number Diff line change
@@ -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'),
Expand All @@ -14,6 +20,7 @@ import { createGetObjectsOfType } from 'selectors'
export default class RollingPoolUpdateModal extends BaseComponent {
render() {
const pool = this.props.pools[this.props.pool]
const loadBalancerPlugin = this.props.plugins && this.props.plugins.find(plugin => plugin.name === 'load-balancer')

return (
<div>
Expand All @@ -25,6 +32,13 @@ export default class RollingPoolUpdateModal extends BaseComponent {
</em>
</p>
)}
{loadBalancerPlugin && loadBalancerPlugin.loaded && (
<p>
<em className='text-warning'>
<Icon icon='alarm' /> {_('rollingPoolUpdateLoadBalancerWarning')}
</em>
</p>
)}
</div>
)
}
Expand Down

0 comments on commit 6d2ef30

Please sign in to comment.