Compare commits

..

5 Commits

Author SHA1 Message Date
Joris K
5ca2958d2a fix(web-core): stop the page sliding sideways to closed side panels (#10973) 2026-12-02 17:55:29 +01:00
Killian
205ae67940 docs(backups): add a procedure to repair a broken incremental chain (#10966)
* docs(backups): add a procedure to repair a broken incremental chain

No page told users what to do when a delta backup chain is broken on the
backup repository (a disk file missing or unreadable).

The new page works from the web interface and the REST API only, so it
applies to an air-gapped XOA. It starts from the job log's Clean VM
directory warnings, then relies on what each run already does since
XO 5.100.0: delete the broken restore points and fall back to a full
when no valid base is left. The manual steps (reclaim-space through the
REST API or Delete backups in XO 5, then a forced full) cover what that
run doesn't: failing runs, and corrupted data the header check misses.

The two new screenshots were taken on a chain broken on purpose. The
troubleshooting page links the procedure from the unexpected full
export section.
2026-12-02 17:33:30 +01:00
Florent BEAUCHAMP
addfdd5475 fix(vmware-explorer): detect secure boot -improve snapshots for esxi6 (#10968)
* fix(vmware-explorer): detect secure boot for esxi6

* changelog

* fix: improve compatibility with automatic snapshot
2026-12-02 15:43:36 +01:00
spacotte-vates
5512fc65a6 feat(acl): resolve selectors on partial objects (#10731)
* feat(complex-matcher): throw when unknown state

* update changelog

* lil fixes

* fix review Killian

* move code from package/complex-matcher to xen-orchestra/acl

* fix review MathieuRA

* improve comment
2026-12-02 12:27:06 +01:00
Marie Garde
1f8f265afc fix(xo5): fix crash on metadata job with all objects (#10933)
* fix(xo5): fix crash on metadata job with all objects

* fix changelog

* rebase ok
2026-12-02 10:59:48 +01:00
24 changed files with 685 additions and 38 deletions

View File

@@ -8,9 +8,28 @@ export type SupportedResource = XoAclSupportedResource<SupportedActionsByResourc
export type SupportedActions<T extends SupportedResource> = XoAclSupportedActions<SupportedActionsByResource, T>
export type TPrivilege<T extends SupportedResource> = XoAclPrivilege<SupportedActionsByResource, T>
export const UNKNOWN = Symbol('UNKNOWN')
/**
* Lists the top-level fields read by a selector.
*/
function getSelectorFields(node: CM.Node): string[] {
if (node instanceof CM.Property || node instanceof CM.TruthyProperty) {
return [node.name]
}
if (node instanceof CM.Not) {
return getSelectorFields(node.child)
}
if (node instanceof CM.And || node instanceof CM.Or) {
return node.children.flatMap(getSelectorFields)
}
return node instanceof CM.Null ? [] : ['*']
}
export class Privilege<T extends SupportedResource> {
#action: TPrivilege<T>['action']
#selector?: (object: object) => boolean
#selectorFields: string[] = []
#resource: TPrivilege<T>['resource']
#effect: TPrivilege<T>['effect']
@@ -28,9 +47,14 @@ export class Privilege<T extends SupportedResource> {
Privilege.checkActionIsValid(resource, action)
this.#action = action
this.#selector = selector !== undefined ? CM.parse(selector).createPredicate() : undefined
this.#resource = resource
this.#effect = effect
if (selector !== undefined) {
const node = CM.parse(selector)
this.#selector = node.createPredicate()
this.#selectorFields = getSelectorFields(node)
}
}
get effect() {
@@ -44,11 +68,20 @@ export class Privilege<T extends SupportedResource> {
return this.#action === '*' || this.#action === action || action.startsWith(`${this.#action}:`)
}
#matchSelector(object: object) {
#matchSelector(object: object, knownFields?: string[]) {
if (this.#selector === undefined) {
return true
}
// `*` is a term not bound to a property (e.g. `foo`), it may match any field, including missing ones
// The `*` check is there to handle the case where a `*` field would exist
if (
knownFields !== undefined &&
this.#selectorFields.some(field => field === '*' || !(field in object || knownFields.includes(field)))
) {
return UNKNOWN
}
return this.#selector(object)
}
@@ -60,11 +93,12 @@ export class Privilege<T extends SupportedResource> {
action: SupportedActions<Resource>
resource: Resource
object: object
}): boolean {
knownFields?: string[]
}): boolean | typeof UNKNOWN {
return (
this.#matchResource(constraint.resource) &&
this.#matchAction(constraint.action) &&
this.#matchSelector(constraint.object)
this.#matchSelector(constraint.object, constraint.knownFields)
)
}

View File

@@ -7,6 +7,7 @@ import {
SupportedActions,
SupportedActionsByResource,
SupportedResource,
UNKNOWN,
} from './class/privilege.mjs'
// Export all types constructed using SUPPORTED_ACTIONS_BY_RESOURCE
@@ -23,6 +24,7 @@ export type AnyPrivilegeOnParam = {
resource: Resource
action: SupportedActions<Resource>
objects: object | object[]
knownFields?: string[]
}
}[SupportedResource]
@@ -32,12 +34,14 @@ export function hasPrivilegeOn<T extends SupportedResource>({
resource,
objects,
userPrivileges,
knownFields,
}: {
user: XoUser
resource: T
action: SupportedActions<T>
objects: object | object[]
userPrivileges: AnyPrivilege[]
knownFields?: string[]
}) {
// Function that will be called outside of the module
// We cannot be sure types are respected
@@ -63,7 +67,7 @@ export function hasPrivilegeOn<T extends SupportedResource>({
return true
}
const effectsByObject = new Map<object, Privilege<T>['effect'][]>()
const effectsByObject = new Map<object, { known: boolean; effect: Privilege<T>['effect'] }[]>()
if (Array.isArray(objects)) {
objects.forEach(obj => effectsByObject.set(obj, []))
} else {
@@ -74,20 +78,49 @@ export function hasPrivilegeOn<T extends SupportedResource>({
const privilege = new CPrivilege(userPrivilege as Privilege<typeof userPrivilege.resource>)
for (const [object, effects] of effectsByObject.entries()) {
if (!privilege.match({ action, resource, object })) {
const result = privilege.match({ action, resource, object, knownFields })
if (!result) {
continue
}
effects.push(privilege.effect)
effects.push({ known: result !== UNKNOWN, effect: privilege.effect })
}
}
if (
Array.from(effectsByObject.values()).some(
effects => effects.length === 0 || effects.some(effect => effect === 'deny')
)
) {
return false
let isUndecidable = false
for (const effects of effectsByObject.values()) {
let hasAllow = false
let hasKnownAllow = false
let hasUnknownDeny = false
for (const { known, effect } of effects) {
if (effect === 'allow') {
hasAllow = true
hasKnownAllow ||= known
} else if (known) {
return false
} else {
hasUnknownDeny = true
}
}
if (!hasAllow) {
return false
}
// do not throw yet: another object may still be known to be denied
if (hasUnknownDeny || !hasKnownAllow) {
isUndecidable = true
}
}
if (isUndecidable) {
const error: Error & { code?: string } = new Error(
`The privilege couldn't be decided because the object is missing fields the selectors need. action: ${action}, resource: ${resource}`
)
error.code = 'RBAC_UNKNOWN_RESULT'
throw error
}
return true
}
@@ -101,6 +134,7 @@ export function getMissingPrivileges(params: AnyPrivilegeOnParam[], userPrivileg
action: param.action as SupportedActions<typeof param.resource>,
objects: param.objects,
userPrivileges,
knownFields: param.knownFields,
})
)
.map(({ action, objects, resource }) => {
@@ -142,6 +176,7 @@ export function filterObjectsWithPrivilege<Resource extends SupportedResource, O
action: SupportedActions<Resource>
objects: Object[]
userPrivileges: AnyPrivilege[]
knownFields?: string[]
}) {
return param.objects.filter(obj => hasPrivilegeOn({ ...param, objects: obj }))
}

View File

@@ -3,7 +3,7 @@ import assert from 'node:assert'
import type { Branded } from '@vates/types/common'
import type { XoUser } from '@vates/types/xo'
import { Privilege } from '../class/privilege.mjs'
import { Privilege, UNKNOWN } from '../class/privilege.mjs'
import type { Privilege as TPrivilege } from '../index.mjs'
import {
filterObjectsWithPrivilege,
@@ -81,6 +81,108 @@ suite('Privilege.match behavior', () => {
const vmImportPrivilege = new Privilege({ action: 'import:vm', resource: 'sr', effect: 'allow' })
assert.strictEqual(vmImportPrivilege.match({ resource: 'sr', action: 'import:vdi:url', object }), false)
})
suite('on a partial object', () => {
const ownVmPrivilege = new Privilege({
action: 'read',
resource: 'vm',
selector: 'creation:creator:2',
effect: 'allow',
})
const partialObject = { id: 'alma' }
test('Should not match a missing property if known fields are not provided', () => {
assert.strictEqual(ownVmPrivilege.match({ resource: 'vm', action: 'read', object: partialObject }), false)
})
test('Should not match a missing property if it is a known field', () => {
assert.strictEqual(
ownVmPrivilege.match({
resource: 'vm',
action: 'read',
object: partialObject,
knownFields: ['id', 'creation'],
}),
false
)
})
test('Should return UNKNOWN if the selector uses an unknown field', () => {
assert.strictEqual(
ownVmPrivilege.match({ resource: 'vm', action: 'read', object: partialObject, knownFields: ['id'] }),
UNKNOWN
)
})
test('Should not match because of the resource even if the selector is unknown', () => {
assert.strictEqual(
ownVmPrivilege.match({ resource: 'host', action: 'read', object: partialObject, knownFields: ['id'] }),
false
)
})
test('Should not match because of the action even if the selector is unknown', () => {
assert.strictEqual(
ownVmPrivilege.match({ resource: 'vm', action: 'start', object: partialObject, knownFields: ['id'] }),
false
)
})
test('Should match without selector', () => {
assert.strictEqual(
privilege.match({ resource: 'vm', action: 'read', object: partialObject, knownFields: [] }),
true
)
})
test('Should resolve a field present on the object even if it is not listed', () => {
assert.strictEqual(
ownVmPrivilege.match({
resource: 'vm',
action: 'read',
object: { creation: { creator: '2' } },
knownFields: [],
}),
true
)
})
test('Should resolve a field provided by a getter', () => {
class Vm {
get creation() {
return { creator: '2' }
}
}
assert.strictEqual(
ownVmPrivilege.match({ resource: 'vm', action: 'read', object: new Vm(), knownFields: [] }),
true
)
})
test('Should return UNKNOWN on a term not bound to a property', () => {
const bareTermPrivilege = new Privilege({ action: 'read', resource: 'vm', selector: 'alma', effect: 'allow' })
assert.strictEqual(
bareTermPrivilege.match({ resource: 'vm', action: 'read', object: partialObject, knownFields: ['id'] }),
UNKNOWN
)
})
test('Should return UNKNOWN if one of the fields is unknown, even if the others decide the result', () => {
const orPrivilege = new Privilege({
action: 'read',
resource: 'vm',
selector: '|(id:alma creation:creator:2)',
effect: 'allow',
})
assert.strictEqual(
orPrivilege.match({ resource: 'vm', action: 'read', object: partialObject, knownFields: ['id'] }),
UNKNOWN
)
})
})
})
suite('ACL V2 behavior', async () => {
@@ -397,6 +499,205 @@ suite('ACL V2 behavior', async () => {
assert.strictEqual(vms.length, 2)
})
})
suite('partial objects behavior', () => {
const UNKNOWN_RESULT = { code: 'RBAC_UNKNOWN_RESULT' }
const vmReadAll = {
id: privilegeId,
action: 'read',
resource: 'vm',
effect: 'allow',
roleId,
} satisfies TPrivilege<'vm'>
const vmReadOwn = {
id: privilegeId,
action: 'read',
resource: 'vm',
selector: `creation:creator:${user.id}`,
effect: 'allow',
roleId,
} satisfies TPrivilege<'vm'>
const vmDenyReadOnPool = {
id: privilegeId,
action: 'read',
resource: 'vm',
selector: '$pool:2',
effect: 'deny',
roleId,
} satisfies TPrivilege<'vm'>
const partialVm = { id: 'partial-vm' }
const partialVmOnDeniedPool = { id: 'partial-vm-denied', $pool: '2' }
suite('hasPrivilegeOn', () => {
test('Should always return true for admin', () => {
assert.strictEqual(
hasPrivilegeOn({
user: admin,
action: 'read',
resource: 'vm',
objects: partialVm,
knownFields: ['id'],
userPrivileges: [vmReadOwn],
}),
true
)
})
test('Should keep the current behavior if known fields are not provided', () => {
assert.strictEqual(
hasPrivilegeOn({ user, action: 'read', resource: 'vm', objects: partialVm, userPrivileges: [vmReadOwn] }),
false
)
})
test('Should throw if the only allow privilege is unknown', () => {
assert.throws(
() =>
hasPrivilegeOn({
user,
action: 'read',
resource: 'vm',
objects: partialVm,
knownFields: ['id'],
userPrivileges: [vmReadOwn],
}),
UNKNOWN_RESULT
)
})
test('Should return false if the unknown field is known to be absent', () => {
assert.strictEqual(
hasPrivilegeOn({
user,
action: 'read',
resource: 'vm',
objects: partialVm,
knownFields: ['id', 'creation'],
userPrivileges: [vmReadOwn],
}),
false
)
})
test('Should return true if an allow privilege is known even if another one is unknown', () => {
assert.strictEqual(
hasPrivilegeOn({
user,
action: 'read',
resource: 'vm',
objects: partialVm,
knownFields: ['id'],
userPrivileges: [vmReadOwn, vmReadAll],
}),
true
)
})
test('Should throw if a deny privilege is unknown, even with a known allow privilege', () => {
assert.throws(
() =>
hasPrivilegeOn({
user,
action: 'read',
resource: 'vm',
objects: partialVm,
knownFields: ['id'],
userPrivileges: [vmReadAll, vmDenyReadOnPool],
}),
UNKNOWN_RESULT
)
})
test('Should return true if a deny privilege is known not to match', () => {
assert.strictEqual(
hasPrivilegeOn({
user,
action: 'read',
resource: 'vm',
objects: partialVm,
knownFields: ['id', '$pool'],
userPrivileges: [vmReadAll, vmDenyReadOnPool],
}),
true
)
})
test('Should return false if a deny privilege is known to match, even with an unknown allow privilege', () => {
assert.strictEqual(
hasPrivilegeOn({
user,
action: 'read',
resource: 'vm',
objects: partialVmOnDeniedPool,
knownFields: ['id', '$pool'],
userPrivileges: [vmReadOwn, vmDenyReadOnPool],
}),
false
)
})
test('Should return false if one of the objects is known to be denied, even if another one is unknown', () => {
assert.strictEqual(
hasPrivilegeOn({
user,
action: 'read',
resource: 'vm',
objects: [partialVm, partialVmOnDeniedPool],
knownFields: ['id'],
userPrivileges: [vmReadAll, vmDenyReadOnPool],
}),
false
)
})
test('Should throw if the other objects are allowed and one is unknown', () => {
assert.throws(
() =>
hasPrivilegeOn({
user,
action: 'read',
resource: 'vm',
objects: [{ id: 'allowed-vm', $pool: '1' }, partialVm],
knownFields: ['id'],
userPrivileges: [vmReadAll, vmDenyReadOnPool],
}),
UNKNOWN_RESULT
)
})
})
suite('getMissingPrivileges', () => {
test('Should throw if a privilege is unknown', () => {
assert.throws(
() =>
getMissingPrivileges(
[{ user, action: 'read', resource: 'vm', objects: partialVm, knownFields: ['id'] }],
[vmReadOwn]
),
UNKNOWN_RESULT
)
})
})
suite('filterObjectsWithPrivilege', () => {
test('Should throw if a privilege is unknown on one of the objects', () => {
assert.throws(
() =>
filterObjectsWithPrivilege({
user,
action: 'read',
resource: 'vm',
objects: [partialVm],
knownFields: ['id'],
userPrivileges: [vmReadOwn],
}),
UNKNOWN_RESULT
)
})
})
})
})
suite('getActionStrings', () => {

View File

@@ -89,7 +89,7 @@ const CONTROLLER_PREFIXES = {
* 'config.annotation'?: string,
* 'config.instanceUuid'?: string,
* 'config.firmware'?: string,
* 'config.bootOptions.efiSecureBootEnabled'?: unknown,
* 'config.bootOptions'?: { efiSecureBootEnabled?: unknown },
* 'config.template'?: unknown,
* 'config.hardware.numCPU'?: unknown,
* 'config.hardware.memoryMB'?: unknown,
@@ -379,7 +379,7 @@ export function buildInventory({
annotation: properties['config.annotation'],
instanceUuid: properties['config.instanceUuid'],
firmware: firmware === 'efi' ? 'uefi' : firmware,
secureBoot: isTrue(properties['config.bootOptions.efiSecureBootEnabled']),
secureBoot: isTrue(properties['config.bootOptions']?.efiSecureBootEnabled),
isTemplate: isTrue(properties['config.template']),
cpus: toNumber(properties['config.hardware.numCPU']),
memory: memoryMb === undefined ? undefined : memoryMb * 1024 * 1024,

View File

@@ -1,7 +1,14 @@
import assert from 'node:assert/strict'
import { describe, it } from 'node:test'
import { countSnapshots, findDatacenter, parseDevices, parseGuestNics, parseVlan } from './_inventory.mjs'
import {
buildInventory,
countSnapshots,
findDatacenter,
parseDevices,
parseGuestNics,
parseVlan,
} from './_inventory.mjs'
// shaped as the SOAP library returns them: the nested references and types are not normalized
const typed = (type, value) => ({ attributes: { 'xsi:type': type }, ...value })
@@ -202,3 +209,37 @@ describe('findDatacenter', function () {
assert.equal(findDatacenter('group-a', loop, datacenterIds), undefined)
})
})
describe('buildInventory', function () {
const EMPTY = {
about: {},
datacenters: {},
clusters: {},
hosts: {},
datastores: {},
networks: {},
portgroups: {},
folders: {},
computeResources: {},
}
it('reads secure boot from the boot options, absent before vSphere 6.5', function () {
const { vms } = buildInventory({
...EMPTY,
vms: {
'vm-65': { 'config.bootOptions': { efiSecureBootEnabled: 'true' } },
// ESXi 6.0: the boot options have no `efiSecureBootEnabled`
'vm-60': { 'config.bootOptions': { bootDelay: '0' } },
'vm-none': {},
},
})
assert.deepEqual(
vms.map(({ id, secureBoot }) => ({ id, secureBoot })),
[
{ id: 'vm-65', secureBoot: true },
{ id: 'vm-60', secureBoot: false },
{ id: 'vm-none', secureBoot: false },
]
)
})
})

View File

@@ -623,7 +623,9 @@ export default class Esxi extends EventEmitter {
'config.annotation',
'config.instanceUuid',
'config.firmware',
'config.bootOptions.efiSecureBootEnabled',
// the whole object rather than `config.bootOptions.efiSecureBootEnabled`: that property only
// exists since vSphere 6.5, and an unknown path fails the whole request (InvalidProperty)
'config.bootOptions',
'config.template',
'config.hardware.numCPU',
'config.hardware.memoryMB',
@@ -1134,9 +1136,11 @@ export default class Esxi extends EventEmitter {
* @returns {Promise<object>} the `info` of the successful task
*/
async snapshot(vmId, name, description, { signal, timeout = 30 * 60e3 } = {}) {
// not `CreateSnapshotEx_Task`: it only exists since vSphere 8 (absent from the WSDL of older
// hosts), and its only addition, the quiesce spec, is not used
return this.#runTask(
'CreateSnapshotEx_Task',
{ _this: vmId, name, description, memory: false },
'CreateSnapshot_Task',
{ _this: vmId, name, description, memory: false, quiesce: false },
{ signal, timeout }
)
}

View File

@@ -696,7 +696,7 @@ describe('tasks', function () {
const controller = new AbortController()
const { esxi, vimClient } = await connectedEsxi({
responses: {
CreateSnapshotEx_Task: () => startedTask(),
CreateSnapshot_Task: () => startedTask(),
RetrievePropertiesEx: () => {
controller.abort()
return taskInfo('running')

View File

@@ -59,6 +59,7 @@ Testing uses **Vitest 5** with a single `unit` project (see `vitest.config.ts`):
| `test/expect-loader.ts` | `hasLoader(wrapper)`: whether a `UiLoader` is rendered; `expectLoaderInsteadOf(wrapper, findContent)`: a `UiLoader` shown and the content it stands for empty (also used by XO 6) |
| `test/select.ts` | `openSelect`, `findShownSelections`, `findSelectOptionLabels`, `pickSelectOption(wrapper, label, { detailed? })`: opens a `VtsSelect`, reads the selection it shows, reads or picks its options (`detailed`: the option shows details after its label); `chooseSelectOption(wrapper, label, { container?, detailed? })`: opens the select inside `container`, then picks the option (also used by XO 6) |
| `test/is-placeholder-shown.ts` | `isPlaceholderShown(field)`: whether a readonly input shows its placeholder in place of its value |
| `test/can-focus-input.ts` | `canFocusInput(wrapper)`: whether the first input of a wrapper attached to the document takes the focus, which an `inert` ancestor prevents |
| `test/inject-or-throw.ts` | `injectOrThrow(key)`: `inject(key)`, throwing when nothing provides it |
| `test/mount-with-setup.ts` | `mountWithSetup(setup, { global?, attachTo? })`: mounts a component whose `setup` sets up what its render needs below it (a select, a provided context) and returns that render (XO 6 wraps it with its config); `mountWithSetupResult(setup, options)`: the same, keeping what `setup` builds (a form, a composable's return), `setup` returning `{ result, render }`, returns `{ wrapper, result }`; `mountComposableUnderSetup(setup, composable, options)`: runs `composable` (given what `setup` returned) in a child of the component whose `setup` provides what it injects, returns `{ provided, result }` |
| `test/mount-with-select.ts` | `renderSelect(id, { accent?, ref? }, slots?)`: renders the `VtsSelect` of a select id, `neutral` accent by default; `mountSelect`: a `VtsSelect` of string sources, its config, accent, wrapper message, option slot and a callback receiving the mounted select |

View File

@@ -46,7 +46,7 @@ const columnTransition = `grid-template-columns ${PANEL_TRANSITION_DURATION}ms`
display: grid;
grid-template-columns: minmax(0, 1fr) 0;
grid-template-rows: minmax(0, 1fr);
overflow: hidden;
overflow: clip;
.content {
overflow-y: auto;

View File

@@ -0,0 +1,38 @@
import VtsLayoutSidebar from '@core/components/layout/VtsLayoutSidebar.vue'
import { useRightSidebarStore } from '@core/packages/sidebar'
import { canFocusInput } from '@core-test/can-focus-input.ts'
import { createGlobalTestConfig } from '@core-test/create-global-test-config.ts'
import { mount } from '@vue/test-utils'
import { h, nextTick } from 'vue'
beforeEach(() => {
localStorage.clear()
})
function mountSidebar({ isExpanded }: { isExpanded: boolean }) {
localStorage.setItem('sidebar.right.expanded', String(isExpanded))
return mount(VtsLayoutSidebar, {
props: { side: 'right' },
slots: { default: () => h('input') },
global: createGlobalTestConfig(),
attachTo: document.body,
})
}
it('lets the focus into an expanded sidebar', () => {
expect(canFocusInput(mountSidebar({ isExpanded: true }))).toBe(true)
})
it('keeps the focus out of a collapsed sidebar', () => {
expect(canFocusInput(mountSidebar({ isExpanded: false }))).toBe(false)
})
it('lets the focus in once the sidebar expands', async () => {
const wrapper = mountSidebar({ isExpanded: false })
useRightSidebarStore().toggleExpand(true)
await nextTick()
expect(canFocusInput(wrapper)).toBe(true)
})

View File

@@ -1,5 +1,5 @@
<template>
<div :class="className" class="vts-layout-sidebar">
<div :class="className" class="vts-layout-sidebar" :inert="!sidebar.isExpanded">
<VtsResizeHandle v-if="showResizeHandle" :position="resizeHandlePosition" :resizable="sidebar" />
<div v-if="slots.header || (showLock && !ui.isSmall)" class="header">
<div v-if="slots.header" class="start">

View File

@@ -0,0 +1,36 @@
import VtsSidePanel from '@core/components/panel/VtsSidePanel.vue'
import { canFocusInput } from '@core-test/can-focus-input.ts'
import { createGlobalTestConfig } from '@core-test/create-global-test-config.ts'
import { mount } from '@vue/test-utils'
import { h } from 'vue'
beforeEach(() => {
localStorage.clear()
})
function mountPanel({ hasSelection }: { hasSelection: boolean }) {
localStorage.setItem('panel.locked', 'false')
return mount(VtsSidePanel, {
props: { hasSelection, persistent: true },
slots: { default: () => h('input') },
global: createGlobalTestConfig(),
attachTo: document.body,
})
}
it('lets the focus into a panel that a selection expands', () => {
expect(canFocusInput(mountPanel({ hasSelection: true }))).toBe(true)
})
it('keeps the focus out of a collapsed panel', () => {
expect(canFocusInput(mountPanel({ hasSelection: false }))).toBe(false)
})
it('lets the focus in once a selection expands the panel', async () => {
const wrapper = mountPanel({ hasSelection: false })
await wrapper.setProps({ hasSelection: true })
expect(canFocusInput(wrapper)).toBe(true)
})

View File

@@ -1,6 +1,6 @@
<!-- v5 -->
<template>
<div class="vts-side-panel" :class="{ mobile: uiStore.isSmall }">
<div class="vts-side-panel" :class="{ mobile: uiStore.isSmall }" :inert="!panelStore.isExpanded">
<VtsResizeHandle v-if="showResizeHandle" position="start" :resizable="panelStore" />
<VtsPanel
:closable="isClosable"

View File

@@ -95,7 +95,7 @@ function handleBackdropClick() {
display: flex;
flex: 1;
min-height: 0;
overflow-x: hidden;
overflow-x: clip;
}
.header {

View File

@@ -0,0 +1,10 @@
import type { VueWrapper } from '@vue/test-utils'
// Whether the first input of a wrapper attached to the document takes the focus, which an `inert` ancestor prevents
export function canFocusInput(wrapper: Pick<VueWrapper, 'get'>) {
const input = wrapper.get('input').element
input.focus()
return document.activeElement === input
}

View File

@@ -13,6 +13,8 @@
- [@vates/task] With the new `skipSubtasksAfterAbort` option of a root task, a subtask created after the abort fails without running, unless it is created with `cleanup: true`, which is meant for the cleanup steps of an aborted task (PR [#10875](https://github.com/vatesfr/xen-orchestra/pull/10875))
- [Pool] In the pool header, the "New VM" button comes before "Add host", in the same order as in the treeview (PR [#10897](https://github.com/vatesfr/xen-orchestra/pull/10897))
- [Forms & backups] Checkboxes and radio buttons fix style, backup job form fix style (PR [#10940](https://github.com/vatesfr/xen-orchestra/pull/10940))
- [XO5/Backup] The backup job list no longer crashes on metadata jobs created in XO 6 with all or dynamically selected pools, and shows the modes of jobs targeting all or dynamically selected repositories (PR [#10933](https://github.com/vatesfr/xen-orchestra/pull/10933))
- [V2V] Fix the compatibility with ESXi 6: secure boot detection and snapshot creation (PR [#10968](https://github.com/vatesfr/xen-orchestra/pull/10968))
### Bug fixes
@@ -21,6 +23,7 @@
- [Backup reports] Aborted or interrupted VMs are no longer counted as failed (PR [#10875](https://github.com/vatesfr/xen-orchestra/pull/10875))
- [Backup] Correctly cleanup the snapshot of a VM without any backed up disk: only a CDROM or only `[NOBAK]` disks (PR [#10789](https://github.com/vatesfr/xen-orchestra/pull/10789))
- [SDN Controller] Network traffic rules are now enforced on VMs started after the rule was created, when a pool's first traffic rule is a network rule: only VIF rules used to set up the SDN controller's event handling, so such network rules were recorded but never (re)applied (PR [#10917](https://github.com/vatesfr/xen-orchestra/pull/10917))
- [Layout] The page no longer slides sideways to show the closed side panel or "My tasks" when the keyboard focus moves past the last element of the page, and their content can no longer be reached while they are closed (PR [#10973](https://github.com/vatesfr/xen-orchestra/pull/10973))
### Packages to release
@@ -39,12 +42,15 @@
<!--packages-start-->
- @vates/task minor
- @xen-orchestra/acl minor
- @xen-orchestra/backups minor
- @xen-orchestra/vmware-explorer patch
- @xen-orchestra/web minor
- @xen-orchestra/web-core minor
- @xen-orchestra/xapi minor
- xo-server minor
- xo-server-backup-reports minor
- xo-server-sdn-controller patch
- xo-web minor
<!--packages-end-->

View File

@@ -0,0 +1,145 @@
---
sidebar_label: Repair a broken chain
sidebar_position: 8.5
---
# Repair a broken incremental backup chain
An [incremental backup](./backup-types/incremental_backups.md) is a chain: one key backup, then deltas that each depend on the previous one. _Key_ is the current term: older versions, and settings such as **Force full backup** or **Full backup interval**, call it a _full_ backup. If a disk file of the chain is missing or unreadable on the backup repository (BR), no restore point after it can be restored.
:::tip
A [full backup interval](./backup-types/incremental_backups.md#key-backup-interval) caps the length of a chain, and so the number of restore points one broken file can take down, at the cost of a regular full export.
:::
This procedure only uses the XO web interface and its REST API, so it also works on an [air-gapped](../airgap.md) XOA.
:::warning
Never delete, move or rename files on the BR by hand: that is how chains break.
:::
## In short
1. Read the job log to find the broken restore points.
2. Run the job once: in most cases, XO repairs the chain by itself.
3. If it doesn't, delete the broken restore points (from the break up to the next key backup),
4. then force a full backup of the VM, by deleting the job's snapshot on it, to start a new chain.
5. Check that the new chain restores.
## Before you start
- **An admin account**, and an [authentication token](../automation/restapi.md#creation) for the REST calls.
- **Healthy storage**: fix a BR that is full, read-only or disconnecting first.
- **Your XO version** (_About_ page in XO 5):
- 6.9.0 or later is needed for [option A](#clean) of step 3
- 6.10.0 fixes merges that fail at every run: if you are older, [upgrade](../getting-started/updater.md) first if you can
- **An XO Proxy**, if the BR uses one, at the same release as the XOA.
## 1. Read the job log {#identify}
In XO 5, open **Backup → Overview**, then the log of the last run (the button next to the schedule's **Run** button). The _Clean VM directory_ task of the VM lists what is broken:
<UiDetail src="/img/xo5/backup-log-broken-chain.png" alt="Log of a backup run: the Clean VM directory task of the VM shows the warnings disk broken: parent missing or broken, disk file missing, incremental backup is incomplete, disk check error and parent disk is missing; the run then ends with Type: full" width={600} />
| warning | before XO 6.5.0 | meaning |
| ----------------------------------------------------------------------- | -------------------------------------------- | --------------------------- |
| `parent disk is missing`, `disk broken: parent missing or broken` | `parent VHD is missing` | a delta lost its parent |
| `failed to open disk`, `disk check error` | `VHD check error` | a disk is unreadable |
| `incremental backup is incomplete`, `disk file missing` | `some VHDs linked to the backup are missing` | a restore point lost a disk |
| `merge chain lost disks before its cleanup step…`, `orphan merge state` | `orphan merge state` | a merge was interrupted |
The file name in a warning is the date of its backup: `20261130T220012Z.vhd` is the run of 30 November 2026 at 22:00:12 UTC. The restore points from that date up to the next key backup are broken: a key backup starts a new chain, which the break doesn't reach.
:::tip
Download the log first (the buttons at the top of the log window copy or download it): it is what Vates support needs if you open a ticket.
:::
## 2. Run the job once {#run}
Every run of an incremental backup job starts with this _Clean VM directory_ check, and repairs what it finds:
- it deletes the restore points whose chain is broken
- when no valid restore point is left to build on, the run exports a full backup (`Type: full` at the bottom of the log above), which starts a new chain
The run still ends successfully. So click the schedule's **Run** button, or wait for the next scheduled run, then check its log:
- **no warning anymore** in the next run's _Clean VM directory_ task: the chain is repaired, go to [step 5](#verify)
- **otherwise** (the run fails, the warnings come back, or a restore fails while the log shows no warning): go on with step 3
## 3. Delete the broken restore points {#clean}
First, in **Backup → Overview**, disable every schedule of the job and wait for a run in progress to end: a run could otherwise add a delta on top of the broken chain.
### Option A: let XO find them (XO 6.9.0 and later)
To find the ID of the BR, open it in XO 6 (**Administration → Backup & Replication → Backup repositories**): it is its **UUID**. The first call below is a dry run: with `merge` and `remove` disabled, XO only reports. The second cleans for real:
<Terminal shell title="clean one VM's backups through the REST API">{`TOKEN=KQxQdm2vMiv7jBIK0hgkmgxKzemd8wSJ7ugFGKFkTbs
XO=https://xoa.example.org
BR=c4284e12-37c9-7967-b9e8-83ef229c3e03
curl -X POST -b authenticationToken=$TOKEN -H 'Content-Type: application/json' -d '{"vmUuid":"9d0d04f7-bb1f-8292-3294-17c6371827c5","merge":false,"remove":false}' "$XO/rest/v0/backup-repositories/$BR/actions/reclaim-space"
curl -X POST -b authenticationToken=$TOKEN -H 'Content-Type: application/json' -d '{"vmUuid":"9d0d04f7-bb1f-8292-3294-17c6371827c5"}' "$XO/rest/v0/backup-repositories/$BR/actions/reclaim-space"`}</Terminal>
- `vmUuid` is the UUID of the VM (also the name of its folder in `xo-vm-backups/`); it works for a VM deleted from the pool too.
- Each call answers a `taskId`: once the task has ended, `GET /rest/v0/tasks/<taskId>` lists the `warnings` of [step 1](#identify).
- The real run deletes the broken restore points and the files nothing uses anymore, and finishes or drops interrupted merges. Valid restore points are kept.
### Option B: from the interface (any version)
1. In XO 5, open **Backup → Restore**, find the VM, then click its red **Delete backups…** button (the trash icon).
<UiDetail src="/img/xo5/restore-health-check.png" alt="The Backup → Restore view: each VM row ends with three buttons, Restore health check (check mark), Restore (arrow) and Delete backups (trash)" width={620} />
2. Select the restore points from the date of the break up to the last one before the next key backup (the newest one if there is none), keep **Free delta disk space now** enabled, then click **OK**:
<UiDetail src="/img/xo5/delete-vm-backups.png" alt="The Delete backups modal: the two most recent restore points, both differencing, are selected; the two key backups below are not; Free delta disk space now is enabled" width={600} />
## 4. Force a full backup {#full}
The check of step 2 reads the headers of the disks, not their data: when the data of a disk is corrupted, the next delta would still build on it. A full backup starts a new chain that depends on nothing.
### Option A: delete the job's snapshot on the VM (this VM only)
A delta is built on the snapshot the job left on the VM at its previous run. Without it, the next run exports a full backup of this VM, and of this VM only:
1. In XO 6, open the VM, then its **Snapshots** tab.
2. For each snapshot named `[XO Backup <job name>] <VM name>`, open its **⋯** menu, then click **Delete**:
<UiDetail src="/img/xo6/vm-snapshot-delete.png" alt="The Snapshots tab of a VM in XO 6: the actions menu of the snapshot [XO Backup Nightly delta backup] KAN-qa-reference is open, with Revert VM here and Delete" width={620} />
A job can leave more than one snapshot on the VM: delete them all, or the next run builds on the one left.
3. Enable the job's schedules again, and run it (or wait for its next run).
4. In the log, check `Type: full` at the bottom.
This works for backup jobs. An incremental replication job can also build on a snapshot left by another job, so it may still export a delta.
### Option B: force a full backup of every VM of the schedule
When several VMs of the job need a new chain:
1. In **Backup → Overview**, edit the job. In its **Schedules** panel, click the edit (pencil) button of the schedule:
<UiDetail src="/img/xo5/backup-schedule-list.png" alt="The job edit page: the Schedules panel lists each schedule with its state, cron pattern, timezone, Force full backup setting and retention, and an edit button" width={700} />
2. Check **Force full backup**, then click **OK** and save the job:
<UiDetail src="/img/xo5/create-backup-schedule.png" alt="The Schedule form: name, retention, then the Health check and Force full backup checkboxes above the month/day/hour/minute pickers" width={480} />
3. Back in **Backup → Overview**, enable this schedule and click its **Run** button.
4. In the log, check `Type: full` at the bottom.
5. **Uncheck Force full backup** again, or every run stays a full.
6. Enable the other schedules of the job again.
The BR needs room for one more full backup: the valid restore points of the old chain stay until retention removes them.
## 5. Check that the new chain restores {#verify}
- In **Backup → Restore**, find the VM, click its **Restore health check** button (the check mark, see [step 3](#clean)), then pick the newest restore point and an SR.
- To check every future run, enable [Health check](./backup-features-and-settings.md#backup-health-check) on the schedule.
## Special cases
- **A merge fails at every run** (for example with `ENOENT`): fixed in XO 6.10.0. [Upgrade](../getting-started/updater.md) the XOA and its proxies, then start over. If you can't, contact Vates support with the log before touching any file.
- **[Immutable BR](./scale-and-security/immutability.md)**: protected files can't be deleted before their protection ends, so the broken restore points stay until then. Steps 4 and 5 still give you a healthy chain right away.
- **[S3 Object Lock](./scale-and-security/object-lock.md)**: deleting doesn't fail: the broken restore points disappear from XO, but the bucket keeps a locked copy of their files, billed until its retention ends.
- **Incremental replication**: the chain lives on the target SR, see [Could not find the base VM](./backup_troubleshooting.md#could-not-find-the-base-vm).

View File

@@ -24,7 +24,7 @@ Nevertheless, there are several reasons for XO to trigger a key (full) export in
- the _Force full backup_ option is enabled for the current schedule
- a new disk has been added to the VM (only this disk is completely exported)
- the reference snapshot for this backup job is missing on the source VM
- the previously exported backup/replication is missing or corrupted
- the previously exported backup/replication is missing or corrupted (see [Repair a broken incremental backup chain](./backup_chain_repair.md))
- XO could not compute a safe delta for a disk (for example a qcow2 disk exported without NBD): it forces a full rather than risking a broken chain
:::tip

View File

@@ -244,13 +244,6 @@ To access advanced options:
#### Enabling Passkeys in XOA with Keycloak
:::warning Don't lock yourself out
If Keycloak is unreachable, nobody can sign in through it. Plan a way back in before you rely on it:
- **Keep a local admin account.** Enabling `auth-oidc` doesn't disable password login: the XOA login page still offers **Sign in with password**. Keep at least one [built-in](#built-in) _admin_ account with a password, store its credentials somewhere safe, and consider protecting it with [TOTP](#otp-authentication-2fa).
- **Don't host Keycloak only on the pool that XOA manages.** A Rolling Pool Update or a host reboot can stop or migrate its VM, locking you out of XOA right when you need it. Run it on separate hardware or another pool, ideally as several instances behind a load balancer.
:::
##### Generating certificates
To support passkeys in XOA, the Keycloak server must expose its OIDC endpoints over HTTPS.

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -56,6 +56,8 @@ const isMirrorBackupType = item => item?.type === 'mirrorBackup'
const isBackupType = item => item?.type === 'backup'
const isPatternNotEmpty = pattern => typeof pattern === 'string' || !isEmpty(get(() => destructPattern(pattern)))
const MODES = [
{
label: 'mirrorFullBackup',
@@ -71,23 +73,23 @@ const MODES = [
},
{
label: 'backup',
test: job => isBackupType(job) && job.mode === 'full' && !isEmpty(get(() => destructPattern(job.remotes))),
test: job => isBackupType(job) && job.mode === 'full' && isPatternNotEmpty(job.remotes),
},
{
label: 'deltaBackup',
test: job => isBackupType(job) && job.mode === 'delta' && !isEmpty(get(() => destructPattern(job.remotes))),
test: job => isBackupType(job) && job.mode === 'delta' && isPatternNotEmpty(job.remotes),
},
{
label: 'continuousReplication',
test: job => isBackupType(job) && job.mode === 'delta' && !isEmpty(get(() => destructPattern(job.srs))),
test: job => isBackupType(job) && job.mode === 'delta' && isPatternNotEmpty(job.srs),
},
{
label: 'disasterRecovery',
test: job => isBackupType(job) && job.mode === 'full' && !isEmpty(get(() => destructPattern(job.srs))),
test: job => isBackupType(job) && job.mode === 'full' && isPatternNotEmpty(job.srs),
},
{
label: 'poolMetadata',
test: job => !isEmpty(destructPattern(job.pools)),
test: job => isPatternNotEmpty(job.pools),
},
{
label: 'xoConfig',

View File

@@ -24,6 +24,7 @@ export const constructPattern = values =>
export const usesExpressions = job =>
typeof job.srs === 'string' ||
typeof job.remotes === 'string' ||
typeof job.pools === 'string' ||
Object.values(job.settings ?? {}).some(settings =>
['healthCheckVmsWithTags', 'fullInterval', 'vmFilter'].some(key => typeof settings?.[key] === 'string')
)