feat(xo-server/patching): check date consistency before patching (#3292)
Fixes #3056
This commit is contained in:
parent
06d38808be
commit
8fbf2786fd
@ -14,6 +14,7 @@
|
||||
- [Backup NG form] Move "Use compression" checkbox in the advanced settings [#2711](https://github.com/vatesfr/xen-orchestra/issues/2711) (PR [#3281](https://github.com/vatesfr/xen-orchestra/pull/3281))
|
||||
- [Backup NG form] Ability to remove previous backups first before backup the VMs [#3212](https://github.com/vatesfr/xen-orchestra/issues/3212) (PR [#3260](https://github.com/vatesfr/xen-orchestra/pull/3260))
|
||||
- [Backup reports] Send report for the interrupted backup jobs on the server startup [#2998](https://github.com/vatesfr/xen-orchestra/issues/#2998) (PR [3164](https://github.com/vatesfr/xen-orchestra/pull/3164) [3154](https://github.com/vatesfr/xen-orchestra/pull/3154))
|
||||
- [Patching] Check date consistency before patching to avoid error on install [#3056](https://github.com/vatesfr/xen-orchestra/issues/3056)
|
||||
|
||||
### Bug fixes
|
||||
|
||||
|
@ -64,6 +64,7 @@ import {
|
||||
isVmRunning,
|
||||
NULL_REF,
|
||||
optional,
|
||||
parseDateTime,
|
||||
prepareXapiParam,
|
||||
} from './utils'
|
||||
|
||||
@ -2339,5 +2340,17 @@ export default class Xapi extends XapiBase {
|
||||
)
|
||||
}
|
||||
|
||||
// =================================================================
|
||||
async _assertConsistentHostServerTime (hostRef) {
|
||||
if (
|
||||
Math.abs(
|
||||
parseDateTime(
|
||||
await this.call('host.get_servertime', hostRef)
|
||||
).getTime() - Date.now()
|
||||
) > 2e3
|
||||
) {
|
||||
throw new Error(
|
||||
'host server time and XOA date are not consistent with each other'
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,6 +320,8 @@ export default {
|
||||
patchUuid,
|
||||
host
|
||||
) {
|
||||
await this._assertConsistentHostServerTime(host.$ref)
|
||||
|
||||
const [vdi] = await Promise.all([
|
||||
this._getUpdateVdi($defer, patchUuid, host.$id),
|
||||
this._ejectToolsIsos(host.$ref),
|
||||
@ -361,6 +363,8 @@ export default {
|
||||
|
||||
// platform_version >= 2.1.1
|
||||
_installPatchUpdateOnAllHosts: deferrable(async function ($defer, patchUuid) {
|
||||
await this._assertConsistentHostServerTime(this.pool.master)
|
||||
|
||||
let [vdi] = await Promise.all([
|
||||
this._getUpdateVdi($defer, patchUuid),
|
||||
this._ejectToolsIsos(),
|
||||
|
Loading…
Reference in New Issue
Block a user