Compare commits

..

6 Commits

Author SHA1 Message Date
MlssFrncJrg
2313809c11 feat(rest-api): expose proxy updater state endpoint (#10773)
* feat(rest-api): expose proxy updater state endpoint
2026-11-25 14:54:08 +01:00
GeraldineFromVates
21d458cdd1 Feat/qa test/readable report mail (#10867)
* feat(qa-test): show status, Paris time and commit in report subject

* feat(qa-test): show test counts in report subject

* feat(qa-test): show test summary at the top of report body

* feat(qa-test): show run duration in report summary
2026-11-25 14:14:18 +01:00
OlivierFL
fa675eead1 chore(web-core): remove unused --color-logo variable (#10895) 2026-11-25 12:07:49 +01:00
OlivierFL
31c3f5bb20 feat(web-core): add data colors for charts (#10894) 2026-11-25 11:59:03 +01:00
OlivierFL
7e850aedaf fix(web-core): mix dark status backgrounds from their item color (#10888)
* fix(web-core): mix dark status backgrounds from their item color

In dark mode, the selected, hover and active backgrounds of success, warning and danger
mixed black with the text color, unlike brand and info which use the item color.
Only danger was affected (its text and item colors differ): its backgrounds were too
light and the tertiary danger button text failed WCAG 1.4.3 on hover (4.38:1).

* docs(changelog): add the PR number of the dark status backgrounds fix

* fix(web-core): mix dark danger backgrounds from the danger background base

The design system mixes the dark danger selected, hover and active backgrounds
from #e73642, like the light ones: #451014 / #5c161a / #741b21. The tertiary
danger button text still passes WCAG 1.4.3 (4.77:1 on hover, 5.12:1 when active).

* fix(web-core): declare the dark danger background base
2026-11-25 11:49:34 +01:00
OlivierFL
069cb2816a fix(web-core): align light danger background tints with the design system (#10891)
* fix(web-core): align light danger background tints with the design system

* docs(changelog): add the PR number of the light danger backgrounds fix
2026-11-25 11:38:08 +01:00
24 changed files with 226 additions and 405 deletions

View File

@@ -472,6 +472,7 @@ export type XoApp = EventEmitter & {
getPlugin(id: XoPlugin['id']): Promise<XoPlugin>
getPlugins(): Promise<XoPlugin[]>
getProxy(id: XoProxy['id']): Promise<XoProxy>
getProxyApplianceUpdaterState(id: XoProxy['id']): Promise<{ level: string; message: string; state: string }>
getRemote(id: XoBackupRepository['id']): Promise<XoBackupRepository>
getAllRemotes(): Promise<XoBackupRepository[]>
removeRemote(id: XoBackupRepository['id']): Promise<void>

View File

@@ -42,7 +42,7 @@ const progress = computed(() => {
.progress-circle-fill {
animation: progress 1s ease-out forwards;
fill: none;
stroke: var(--color-success-item-base);
stroke: var(--color-success-data);
stroke-width: 1.2;
stroke-linecap: round;
stroke-dasharray: v-bind(progress), 100;

View File

@@ -68,11 +68,11 @@ const hasError = computed(() => hostStoreHasError.value || vmStoreHasError.value
<style lang="postcss" scoped>
.progress-item {
--progress-bar-height: 1.2rem;
--progress-bar-color: var(--color-brand-item-base);
--progress-bar-color: var(--color-brand-data);
--progress-bar-background-color: var(--color-neutral-background-disabled);
&.warning {
--progress-bar-color: var(--color-warning-item-base);
--progress-bar-color: var(--color-warning-data);
--footer-value-color: var(--color-warning-item-base);
}

View File

@@ -56,7 +56,7 @@ const inactive = computed(() => props.total - props.active)
width: 1.3rem;
height: 1.3rem;
border-radius: 0.65rem;
background-color: var(--color-success-item-base);
background-color: var(--color-success-data);
&.inactive {
background-color: var(--color-neutral-background-disabled);

View File

@@ -37,12 +37,38 @@ function getBranchName() {
}
}
function getCommitHash() {
try {
return execSync('git rev-parse --short HEAD', { encoding: 'utf8', cwd: ROOT }).trim()
} catch {
return 'unknown'
}
}
function formatDatetime(date) {
// "2026-05-20 08:42 UTC"
return date
.toISOString()
.replace('T', ' ')
.replace(/:\d{2}\.\d+Z$/, ' UTC')
// "19/11/2026 13:43 (Paris)"
return `${date.toLocaleString('fr-FR', {
timeZone: 'Europe/Paris',
dateStyle: 'short',
timeStyle: 'short',
})} (Paris)`
}
function formatDuration(ms) {
const hours = Math.floor(ms / 3600000)
const minutes = Math.floor((ms / 60000) % 60)
.toString()
.padStart(2, '0')
return `${hours}h${minutes}`
}
function getCount(output, label) {
const match = output.match(new RegExp(`ℹ ${label} (\\d+)`))
if (match === null) {
return '?'
} else {
return match[1]
}
}
// ---------------------------------------------------------------------------
@@ -123,14 +149,27 @@ if (process.argv.includes('--smtp-test')) {
// ---------------------------------------------------------------------------
const branch = getBranchName()
const commitHash = getCommitHash()
const startedAt = new Date()
process.stderr.write(`[run-and-report] branch=${branch}\n`)
const { success, output, logFilePath } = await runTests()
const runtimeInMs = Date.now() - startedAt.getTime()
const emoji = success ? '✅' : '❌'
const status = success ? 'success' : 'failure'
const subject = `test run ${formatDatetime(startedAt)} ${branch} ${status}`
const successTests = getCount(output, 'pass')
const totalTests = getCount(output, 'tests')
const failedTests = getCount(output, 'fail')
const cancelledTests = getCount(output, 'cancelled')
const skippedTests = getCount(output, 'skipped')
const subject = `${emoji} ${status} ${successTests}/${totalTests} passed ${formatDatetime(startedAt)} on ${branch}@${commitHash}`
const summary = `Result: ${emoji} ${status}
Commit: ${branch}@${commitHash}
Tests: ${successTests}/${totalTests} passed, ${failedTests} failed, ${cancelledTests} cancelled, ${skippedTests} skipped
Duration: ${formatDuration(runtimeInMs)}`
// Attach the full structured debug log if we found its path
const attachments = []
@@ -149,7 +188,9 @@ await transport.sendMail({
from: process.env.SMTP_FROM ?? process.env.SMTP_USER,
to: process.env.SMTP_TO,
subject,
text: output,
text: `${summary}
----------------------------------------
${output}`,
attachments,
})

View File

@@ -27,3 +27,9 @@ export const proxy = {
}
export const proxyHealth = { success: true }
export const proxyApplianceUpdaterState = {
level: 'info',
message: 'All up to date',
state: 'xoa-up-to-date',
}

View File

@@ -15,7 +15,7 @@ import {
import { inject } from 'inversify'
import { provide } from 'inversify-binding-decorators'
import type { Request as ExRequest } from 'express'
import type { XoProxy } from '@vates/types'
import type { XoApp, XoProxy } from '@vates/types'
import { acl } from '../middlewares/acl.middleware.mjs'
import { ApiError } from '../helpers/error.helper.mjs'
@@ -28,7 +28,13 @@ import {
unauthorizedResp,
type Unbrand,
} from '../open-api/common/response.common.mjs'
import { partialProxies, proxy, proxyHealth, proxyIds } from '../open-api/oa-examples/proxy.oa-example.mjs'
import {
partialProxies,
proxy,
proxyHealth,
proxyIds,
proxyApplianceUpdaterState,
} from '../open-api/oa-examples/proxy.oa-example.mjs'
import type { SendObjects } from '../helpers/helper.type.mjs'
import { XoController } from '../abstract-classes/xo-controller.mjs'
import { RestApi } from '../rest-api/rest-api.mjs'
@@ -146,4 +152,35 @@ export class ProxyController extends XoController<XoProxy> {
return { success: true }
}
/**
* Returns the state of the proxy appliance updater (e.g. `xoa-up-to-date`, or a state ending with `-upgrade-needed`)
*
* Before reading the state, sets the updater channel to the one expected by Xen Orchestra.
* A successful result is cached for 60 seconds per proxy, errors are not cached.
*
* Required privilege:
* - resource: proxy, action: read
*
* @example id "e625ea0c-a876-405a-b838-109d762efe88"
*/
@Example(proxyApplianceUpdaterState)
@Extension('x-mcp-exposure', 'allow')
@Get('{id}/appliance_updater_state')
@Middlewares(
acl({
resource: 'proxy',
action: 'read',
objectId: 'params.id',
getObject: ({ restApi }) => restApi.xoApp.getProxy,
})
)
@SuccessResponse(200, 'OK')
@Response(forbiddenOperationResp.status, forbiddenOperationResp.description)
@Response(notFoundResp.status, notFoundResp.description)
@Response(internalServerErrorResp.status, internalServerErrorResp.description)
@Response(proxyUnreachableResp.status, proxyUnreachableResp.description)
getProxyApplianceUpdaterState(@Path() id: string): ReturnType<XoApp['getProxyApplianceUpdaterState']> {
return callProxy(this.restApi.xoApp.getProxyApplianceUpdaterState(id as XoProxy['id']))
}
}

View File

@@ -5,47 +5,65 @@ import { ApiError } from '../helpers/error.helper.mjs'
import { ProxyController } from './proxy.controller.mjs'
import type { RestApi } from '../rest-api/rest-api.mjs'
function createController(checkProxyHealth: (id: string) => Promise<void>) {
const proxyId = 'e625ea0c-a876-405a-b838-109d762efe88'
const updaterState = { level: 'info', message: 'xoa is up to date', state: 'xoa-up-to-date' }
const unreachableErrors = [
Object.assign(new TypeError('fetch failed'), { code: 'PROXY_UNREACHABLE' }),
Object.assign(new Error('cannot get the proxy address'), { code: 'PROXY_UNREACHABLE' }),
]
function createController(result: () => Promise<unknown>) {
const calls: unknown[] = []
const record =
(method: string) =>
async (...args: unknown[]) => {
calls.push([method, ...args])
return result()
}
const restApi = {
xoApp: {
checkProxyHealth: async (id: string) => {
calls.push(['checkProxyHealth', id])
return checkProxyHealth(id)
},
checkProxyHealth: record('checkProxyHealth'),
getProxyApplianceUpdaterState: record('getProxyApplianceUpdaterState'),
},
} as unknown as RestApi
const controller = new ProxyController(restApi)
return { calls, controller }
}
const proxyId = 'e625ea0c-a876-405a-b838-109d762efe88'
for (const [method, xoAppMethod, xoAppResult, expected] of [
['getProxyHealth', 'checkProxyHealth', undefined, { success: true }],
['getProxyApplianceUpdaterState', 'getProxyApplianceUpdaterState', updaterState, updaterState],
] as const) {
describe(`ProxyController.${method}`, () => {
it(`forwards the id to ${xoAppMethod} and returns the result`, async () => {
const { calls, controller } = createController(async () => xoAppResult)
describe('ProxyController.getProxyHealth', () => {
it('forwards the id and returns success when the proxy is reachable', async () => {
const { calls, controller } = createController(async () => {})
assert.deepEqual(await controller.getProxyHealth(proxyId), { success: true })
assert.deepEqual(calls, [['checkProxyHealth', proxyId]])
})
it('throws a 502 ApiError when the proxy is unreachable', async () => {
const { controller } = createController(async () => {
throw Object.assign(new TypeError('fetch failed'), { code: 'PROXY_UNREACHABLE' })
assert.deepEqual(await controller[method](proxyId), expected)
assert.deepEqual(calls, [[xoAppMethod, proxyId]])
})
await assert.rejects(
controller.getProxyHealth(proxyId),
error => error instanceof ApiError && error.status === 502 && error.message === 'Proxy unreachable'
)
})
for (const unreachableError of unreachableErrors) {
it(`throws a 502 ApiError on "${unreachableError.message}"`, async () => {
const { controller } = createController(async () => {
throw unreachableError
})
it('rethrows unrelated errors unchanged', async () => {
const unrelatedError = new Error('500 Internal Server Error')
const { controller } = createController(async () => {
throw unrelatedError
await assert.rejects(
controller[method](proxyId),
error => error instanceof ApiError && error.status === 502 && error.message === 'Proxy unreachable'
)
})
}
it('rethrows unrelated errors unchanged', async () => {
const unrelatedError = new Error('401 Unauthorized')
const { controller } = createController(async () => {
throw unrelatedError
})
await assert.rejects(controller[method](proxyId), error => error === unrelatedError)
})
await assert.rejects(controller.getProxyHealth(proxyId), error => error === unrelatedError)
})
})
}

View File

@@ -1,6 +1,4 @@
:root {
--color-logo: #282467;
/* NEUTRALS */
--color-neutral-txt-primary: #1a1b38;
@@ -31,6 +29,7 @@
--color-brand-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-brand-item-base));
--color-brand-item-active: color-mix(in srgb, #ffffff 40%, var(--color-brand-item-base));
--color-brand-item-disabled: #d2ceff;
--color-brand-data: #8a80ff;
/* INFO */
@@ -47,6 +46,7 @@
--color-info-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-info-item-base));
--color-info-item-active: color-mix(in srgb, #ffffff 40%, var(--color-info-item-base));
--color-info-item-disabled: #abdafa;
--color-info-data: #1498f0;
/* SUCCESS */
@@ -63,6 +63,7 @@
--color-success-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-success-item-base));
--color-success-item-active: color-mix(in srgb, #ffffff 40%, var(--color-success-item-base));
--color-success-item-disabled: #abdcc9;
--color-success-data: #2ca577;
/* WARNING */
@@ -79,6 +80,7 @@
--color-warning-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-warning-item-base));
--color-warning-item-active: color-mix(in srgb, #ffffff 40%, var(--color-warning-item-base));
--color-warning-item-disabled: #f9cca3;
--color-warning-data: #e07410;
/* DANGER */
@@ -86,20 +88,20 @@
--color-danger-txt-hover: color-mix(in srgb, #000000 20%, var(--color-danger-txt-base));
--color-danger-txt-active: color-mix(in srgb, #000000 40%, var(--color-danger-txt-base));
--color-danger-background-selected: color-mix(in srgb, #ffffff 90%, var(--color-danger-item-base));
--color-danger-background-hover: color-mix(in srgb, #ffffff 80%, var(--color-danger-item-base));
--color-danger-background-active: color-mix(in srgb, #ffffff 70%, var(--color-danger-item-base));
--color-danger-background-base: #e73642;
--color-danger-background-selected: color-mix(in srgb, #ffffff 90%, var(--color-danger-background-base));
--color-danger-background-hover: color-mix(in srgb, #ffffff 80%, var(--color-danger-background-base));
--color-danger-background-active: color-mix(in srgb, #ffffff 70%, var(--color-danger-background-base));
--color-danger-txt-item: #fff0f1;
--color-danger-item-base: #be1621;
--color-danger-item-hover: color-mix(in srgb, #000000 20%, var(--color-danger-item-base));
--color-danger-item-active: color-mix(in srgb, #000000 40%, var(--color-danger-item-base));
--color-danger-item-disabled: #e5a2a6;
--color-danger-data: #be1621;
}
:root.dark {
--color-logo: #e5e5e7;
/* NEUTRALS */
--color-neutral-txt-primary: #f8f8f8;
@@ -130,6 +132,7 @@
--color-brand-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-brand-item-base));
--color-brand-item-active: color-mix(in srgb, #ffffff 40%, var(--color-brand-item-base));
--color-brand-item-disabled: #393566;
--color-brand-data: #8f84ff;
/* INFO */
@@ -146,6 +149,7 @@
--color-info-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-info-item-base));
--color-info-item-active: color-mix(in srgb, #ffffff 40%, var(--color-info-item-base));
--color-info-item-disabled: #124161;
--color-info-data: #2ca3f2;
/* SUCCESS */
@@ -153,15 +157,16 @@
--color-success-txt-hover: color-mix(in srgb, #ffffff 20%, var(--color-success-txt-base));
--color-success-txt-active: color-mix(in srgb, #ffffff 40%, var(--color-success-txt-base));
--color-success-background-selected: color-mix(in srgb, #000000 70%, var(--color-success-txt-base));
--color-success-background-hover: color-mix(in srgb, #000000 60%, var(--color-success-txt-base));
--color-success-background-active: color-mix(in srgb, #000000 50%, var(--color-success-txt-base));
--color-success-background-selected: color-mix(in srgb, #000000 70%, var(--color-success-item-base));
--color-success-background-hover: color-mix(in srgb, #000000 60%, var(--color-success-item-base));
--color-success-background-active: color-mix(in srgb, #000000 50%, var(--color-success-item-base));
--color-success-txt-item: #092017;
--color-success-item-base: #2ca878;
--color-success-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-success-item-base));
--color-success-item-active: color-mix(in srgb, #ffffff 40%, var(--color-success-item-base));
--color-success-item-disabled: #124330;
--color-success-data: #2ca878;
/* WARNING */
@@ -169,15 +174,16 @@
--color-warning-txt-hover: color-mix(in srgb, #ffffff 20%, var(--color-warning-txt-base));
--color-warning-txt-active: color-mix(in srgb, #ffffff 40%, var(--color-warning-txt-base));
--color-warning-background-selected: color-mix(in srgb, #000000 70%, var(--color-warning-txt-base));
--color-warning-background-hover: color-mix(in srgb, #000000 60%, var(--color-warning-txt-base));
--color-warning-background-active: color-mix(in srgb, #000000 50%, var(--color-warning-txt-base));
--color-warning-background-selected: color-mix(in srgb, #000000 70%, var(--color-warning-item-base));
--color-warning-background-hover: color-mix(in srgb, #000000 60%, var(--color-warning-item-base));
--color-warning-background-active: color-mix(in srgb, #000000 50%, var(--color-warning-item-base));
--color-warning-txt-item: #261403;
--color-warning-item-base: #ef7f18;
--color-warning-item-hover: color-mix(in srgb, #ffffff 20%, var(--color-warning-item-base));
--color-warning-item-active: color-mix(in srgb, #ffffff 40%, var(--color-warning-item-base));
--color-warning-item-disabled: #60330a;
--color-warning-data: #ef7f18;
/* DANGER */
@@ -185,13 +191,15 @@
--color-danger-txt-hover: color-mix(in srgb, #ffffff 20%, var(--color-danger-txt-base));
--color-danger-txt-active: color-mix(in srgb, #ffffff 40%, var(--color-danger-txt-base));
--color-danger-background-selected: color-mix(in srgb, #000000 70%, var(--color-danger-txt-base));
--color-danger-background-hover: color-mix(in srgb, #000000 60%, var(--color-danger-txt-base));
--color-danger-background-active: color-mix(in srgb, #000000 50%, var(--color-danger-txt-base));
--color-danger-background-base: #e73642;
--color-danger-background-selected: color-mix(in srgb, #000000 70%, var(--color-danger-background-base));
--color-danger-background-hover: color-mix(in srgb, #000000 60%, var(--color-danger-background-base));
--color-danger-background-active: color-mix(in srgb, #000000 50%, var(--color-danger-background-base));
--color-danger-txt-item: #fff0f1;
--color-danger-item-base: #be1621;
--color-danger-item-hover: color-mix(in srgb, #000000 20%, var(--color-danger-item-base));
--color-danger-item-active: color-mix(in srgb, #000000 40%, var(--color-danger-item-base));
--color-danger-item-disabled: #4c090d;
--color-danger-data: #c41723;
}

View File

@@ -3,6 +3,15 @@
* Default theme is defined in web-core/_colors.pcss
*/
/* Data colors are tuned for the default theme only: themed charts keep each theme's own accent colors */
:root:is(.theme-nord, .theme-solarized, .theme-dracula, .theme-monokai) {
--color-brand-data: var(--color-brand-item-base);
--color-info-data: var(--color-info-item-base);
--color-success-data: var(--color-success-item-base);
--color-warning-data: var(--color-warning-item-base);
--color-danger-data: var(--color-danger-item-base);
}
/*
* Nord Theme - Light Mode
* An arctic, north-bluish color palette
@@ -14,8 +23,6 @@
* Aurora: #bf616a (red), #d08770 (orange), #ebcb8b (yellow), #a3be8c (green), #b48ead (purple)
*/
:root.theme-nord {
--color-logo: #5e81ac;
/* NEUTRALS */
--color-neutral-txt-primary: #2e3440;
--color-neutral-txt-secondary: #4c566a;
@@ -109,8 +116,6 @@
* Nord Theme - Dark Mode
*/
:root.dark.theme-nord {
--color-logo: #88c0d0;
/* NEUTRALS */
--color-neutral-txt-primary: #eceff4;
--color-neutral-txt-secondary: #d8dee9;
@@ -210,8 +215,6 @@
* violet #6c71c4, blue #268bd2, cyan #2aa198, green #859900
*/
:root.theme-solarized {
--color-logo: #268bd2;
/* NEUTRALS */
--color-neutral-txt-primary: #657b83;
--color-neutral-txt-secondary: #93a1a1;
@@ -305,8 +308,6 @@
* Solarized Theme - Dark Mode
*/
:root.dark.theme-solarized {
--color-logo: #268bd2;
/* NEUTRALS */
--color-neutral-txt-primary: #839496;
--color-neutral-txt-secondary: #586e75;
@@ -406,8 +407,6 @@
* Purple: #bd93f9, Red: #ff5555, Yellow: #f1fa8c
*/
:root.theme-dracula {
--color-logo: #bd93f9;
/* NEUTRALS */
--color-neutral-txt-primary: #282a36;
--color-neutral-txt-secondary: #44475a;
@@ -501,8 +500,6 @@
* Dracula Theme - Dark Mode
*/
:root.dark.theme-dracula {
--color-logo: #bd93f9;
/* NEUTRALS */
--color-neutral-txt-primary: #f8f8f2;
--color-neutral-txt-secondary: #6272a4;
@@ -601,8 +598,6 @@
* Pink: #f92672, Green: #a6e22e, Blue: #66d9ef, Orange: #fd971f, Purple: #ae81ff
*/
:root.theme-monokai {
--color-logo: #f92672;
/* NEUTRALS */
--color-neutral-txt-primary: #272822;
--color-neutral-txt-secondary: #75715e;
@@ -696,8 +691,6 @@
* Monokai Theme - Dark Mode
*/
:root.dark.theme-monokai {
--color-logo: #f92672;
/* NEUTRALS */
--color-neutral-txt-primary: #f8f8f2;
--color-neutral-txt-secondary: #a8a8a0;

View File

@@ -117,7 +117,7 @@ const className = computed(() => [
color: var(--color-brand-item-base);
.fill {
stroke: var(--color-brand-item-base);
stroke: var(--color-brand-data);
}
.background {
@@ -129,7 +129,7 @@ const className = computed(() => [
color: var(--color-info-item-base);
.fill {
stroke: var(--color-info-item-base);
stroke: var(--color-info-data);
}
.background {
@@ -137,7 +137,7 @@ const className = computed(() => [
}
.success {
stroke: var(--color-success-item-base);
stroke: var(--color-success-data);
}
.icon {
@@ -149,7 +149,7 @@ const className = computed(() => [
color: var(--color-warning-item-base);
.fill {
stroke: var(--color-warning-item-base);
stroke: var(--color-warning-data);
}
.background {
@@ -161,7 +161,7 @@ const className = computed(() => [
color: var(--color-danger-item-base);
.fill {
stroke: var(--color-danger-item-base);
stroke: var(--color-danger-data);
}
.background {

View File

@@ -80,7 +80,7 @@ const computedSegments = computed(() => {
fill: transparent;
&.accent--info {
stroke: var(--color-info-item-base);
stroke: var(--color-info-data);
}
&.accent--secondary {
@@ -88,15 +88,15 @@ const computedSegments = computed(() => {
}
&.accent--success {
stroke: var(--color-success-item-base);
stroke: var(--color-success-data);
}
&.accent--warning {
stroke: var(--color-warning-item-base);
stroke: var(--color-warning-data);
}
&.accent--danger {
stroke: var(--color-danger-item-base);
stroke: var(--color-danger-data);
}
&.accent--muted {

View File

@@ -72,7 +72,7 @@ const classNames = computed(() => toVariants({ accent }))
&.accent--info {
.circle-icon {
color: var(--color-info-item-base);
color: var(--color-info-data);
}
}
@@ -84,19 +84,19 @@ const classNames = computed(() => toVariants({ accent }))
&.accent--success {
.circle-icon {
color: var(--color-success-item-base);
color: var(--color-success-data);
}
}
&.accent--warning {
.circle-icon {
color: var(--color-warning-item-base);
color: var(--color-warning-data);
}
}
&.accent--danger {
.circle-icon {
color: var(--color-danger-item-base);
color: var(--color-danger-data);
}
}

View File

@@ -57,19 +57,19 @@ const className = computed(() => toVariants({ accent }))
/* ACCENT */
&.accent--info {
.fill {
background-color: var(--color-info-item-base);
background-color: var(--color-info-data);
}
}
&.accent--warning {
.fill {
background-color: var(--color-warning-item-base);
background-color: var(--color-warning-data);
}
}
&.accent--danger {
.fill {
background-color: var(--color-danger-item-base);
background-color: var(--color-danger-data);
}
}
}

View File

@@ -54,19 +54,19 @@ useResizeObserver(ellipsisElement, ([entry]) => {
/* ACCENT VARIANTS */
&.accent--info {
background-color: var(--color-info-item-base);
background-color: var(--color-info-data);
}
&.accent--success {
background-color: var(--color-success-item-base);
background-color: var(--color-success-data);
}
&.accent--warning {
background-color: var(--color-warning-item-base);
background-color: var(--color-warning-data);
}
&.accent--danger {
background-color: var(--color-danger-item-base);
background-color: var(--color-danger-data);
}
}
</style>

View File

@@ -12,8 +12,8 @@ export const useChartTheme = (pinia?: Pinia) => {
background: style.getPropertyValue('--color-neutral-background-primary'),
text: style.getPropertyValue('--color-neutral-txt-secondary'),
splitLine: style.getPropertyValue('--color-neutral-border'),
primary: style.getPropertyValue('--color-brand-item-base'),
secondary: style.getPropertyValue('--color-warning-item-base'),
primary: style.getPropertyValue('--color-brand-data'),
secondary: style.getPropertyValue('--color-warning-data'),
})
const colors = ref(getColors())

View File

@@ -9,13 +9,15 @@
> Users must be able to say: "Nice enhancement, I'm eager to test it"
- [REST API] Get the state of a proxy appliance updater: `GET /rest/v0/proxies/:id/appliance_updater_state` (PR [#10773](https://github.com/vatesfr/xen-orchestra/pull/10773))
### Bug fixes
> Users must be able to say: "I had this issue, happy to know it's fixed"
- [Light theme] Danger backgrounds (selected, hover and active) use the lighter red tints of the design system (PR [#10891](https://github.com/vatesfr/xen-orchestra/pull/10891))
- [Dark mode] Selected, hovered and pressed backgrounds of danger elements (buttons, tags, chips, toasters…) are darker, as designed, so their text is easier to read (PR [#10888](https://github.com/vatesfr/xen-orchestra/pull/10888))
- [Backups/Merge] The background merge no longer crashes with `ENAMETOOLONG` when a VM's backups are locked by another job: it waits 5 minutes before trying again instead of retrying in a loop (PR [#10866](https://github.com/vatesfr/xen-orchestra/pull/10866))
- [SDN Controller] A host that joins a pool with private networks is now wired into them as soon as the host is enabled
- [SDN Controller] When a host is ejected from a pool, the tunnels to it are now removed from the remaining hosts (including the star-center host), so no stale tunnel is left on the pool after a host leaves a pool with private networks
- [V2V] When the import of a disk fails before its transfer starts, the task shows the reason given by the migration engine (e.g. `could not connect: timed out`) instead of `stream has ended without data, was looking for 8 bytes` (PR [#10842](https://github.com/vatesfr/xen-orchestra/pull/10842))
- [XO6] A VM converted into a template no longer stays in the VM list and treeview, contribution by [@pcbeingused333](https://github.com/pcbeingused333), fixes issue [#10717](https://github.com/vatesfr/xen-orchestra/issues/10717) (PR [#10884](https://github.com/vatesfr/xen-orchestra/pull/10884))
@@ -36,8 +38,12 @@
<!--packages-start-->
- @vates/nbd-client patch
- @vates/types minor
- @xen-orchestra/backups patch
- @xen-orchestra/rest-api minor
- @xen-orchestra/web patch
- @xen-orchestra/web-core patch
- xo-collection patch
- xo-server-sdn-controller patch
- xo-server patch
<!--packages-end-->

View File

@@ -1254,20 +1254,6 @@ class SDNController extends EventEmitter {
return
}
// The tunnel legs of a removed host on the remaining hosts (in
// particular on the star center) are not cleaned up by XAPI: re-run
// the network registration of its pool, as on plugin load, to remove
// them and rewire the remaining hosts
const poolUuid = object?.$type === 'host' ? object.$pool.uuid : undefined
if (poolUuid !== undefined) {
await Promise.all(
map(
filter(this.privateNetworks, privateNetwork => privateNetwork.networks[poolUuid] !== undefined),
privateNetwork => privateNetwork.addNetwork(privateNetwork.networks[poolUuid])
)
)
}
// If a network is removed, clean this.privateNetworks from it
const networkRef = this._networks.get(id)
if (networkRef !== undefined) {
@@ -1345,10 +1331,6 @@ class SDNController extends EventEmitter {
this._newHosts.splice(i, 1)
// The OVSDB client can not have been created when the host was added, as it
// was not enabled yet: create it now that the host is up.
this._getOrCreateOvsdbClient(host)
log.debug('Sync pool certificates', {
newHost: host.name_label,
pool: host.$pool.name_label,
@@ -1574,7 +1556,7 @@ class SDNController extends EventEmitter {
async _addHostToPrivateNetworks(host) {
const xapi = host.$xapi
const tunnels = Object.values(xapi.objects.indexes.type.tunnel ?? {})
const tunnels = Object.values(xapi.objects.indexes.type.SDN_tunnel ?? {})
for (const tunnel of tunnels) {
const accessPif = xapi.getObjectByRef(tunnel.access_PIF)
if (accessPif.host !== host.$ref) {

View File

@@ -299,163 +299,6 @@ describe('SDN controller reliability', () => {
})
})
describe('a host joining a pool with private networks', () => {
function makeJoiningHost(xapi) {
return {
$type: 'host',
$ref: 'host-ref-1',
$id: 'host-id-1',
$xapi: xapi,
name_label: 'joining-host',
enabled: false,
PIFs: [],
$pool: { uuid: 'pool-uuid-1', $ref: 'pool-ref-1', $id: 'pool-id-1', name_label: 'pool' },
}
}
it('creates the OVSDB client when the just-joined host becomes enabled', async () => {
const controller = createFakeController()
const xapi = createFakeXapi()
xapi.objects = new EventEmitter()
xapi.objects.indexes = { type: {} }
controller._getOrCreateOfChannel = mock.fn(() => undefined)
controller._setBridgeControllerForHost = mock.fn()
const host = makeJoiningHost(xapi)
controller._objectsAdded({ 'host-id-1': host })
// the host is not enabled yet: no client on the add event
assert.equal(controller.ovsdbClients[host.$ref], undefined)
assert.deepEqual(controller._newHosts, [host])
// the host becomes enabled: the client must be created by the update path
host.enabled = true
host.PIFs = ['pif-ref-1']
controller._objectsUpdated({ 'host-id-1': host })
await new Promise(resolve => setImmediate(resolve))
assert.notEqual(controller.ovsdbClients[host.$ref], undefined)
assert.deepEqual(controller._newHosts, [])
})
it('adds the host to the private networks through its tunnels', async () => {
const controller = createFakeController()
const xapi = createFakeXapi()
const network = { $ref: 'network-ref-1', name_label: 'test-network' }
const accessPif = {
$ref: 'pif-ref-tunnel',
host: 'host-ref-1',
device: 'tunnel0',
currently_attached: true,
$network: network,
}
// a tunnel for another host must be ignored
xapi.objects.indexes = {
type: {
tunnel: [
{ $ref: 'tunnel-ref-1', access_PIF: 'pif-ref-tunnel' },
{ $ref: 'tunnel-ref-2', access_PIF: 'pif-ref-other-host' },
],
},
}
xapi.getObjectByRef = ref =>
ref === accessPif.$ref ? accessPif : { $ref: 'pif-ref-other-host', host: 'host-ref-other', $network: network }
const host = makeJoiningHost(xapi)
host.enabled = true
const addHostToPrivateNetwork = mock.fn(async () => undefined)
controller._addHostToPrivateNetwork = addHostToPrivateNetwork
await controller._addHostToPrivateNetworks(host)
// only the tunnel whose access PIF belongs to the host is processed
assert.equal(addHostToPrivateNetwork.mock.calls.length, 1)
assert.equal(addHostToPrivateNetwork.mock.calls[0].arguments[0], host)
assert.equal(addHostToPrivateNetwork.mock.calls[0].arguments[1], network)
})
})
describe('a host ejected from a pool with private networks', () => {
function makeEjectContext() {
const controller = createFakeController()
const xapi = createFakeXapi()
xapi.objects = new EventEmitter()
xapi.objects.indexes = { type: {} }
const poolUuid = 'pool-uuid-1'
const host = {
$type: 'host',
$ref: 'host-ref-1',
$id: 'host-id-1',
$xapi: xapi,
name_label: 'ejected-host',
enabled: true,
PIFs: [],
$pool: { uuid: poolUuid, $ref: 'pool-ref-1', $id: 'pool-id-1', name_label: 'pool' },
}
const network = {
$ref: 'network-ref-1',
$id: 'network-id-1',
$pool: { uuid: poolUuid, $ref: 'pool-ref-1', $id: 'pool-id-1', $xapi: xapi },
name_label: 'test-network',
}
const addNetwork = mock.fn(async () => undefined)
controller.privateNetworks = {
// the network of the pool of the removed host
'private-network-uuid-1': {
uuid: 'private-network-uuid-1',
networks: { [poolUuid]: network },
center: { $ref: 'host-ref-2' },
addNetwork,
},
// a network of another pool must not be touched
'private-network-uuid-2': {
uuid: 'private-network-uuid-2',
networks: { 'pool-uuid-2': { $ref: 'network-ref-2' } },
center: { $ref: 'host-ref-3' },
addNetwork: mock.fn(async () => undefined),
},
}
// a client of the removed host, to check it is dropped
const ovsdbClient = { host }
controller.ovsdbClients = { [host.$ref]: ovsdbClient }
controller.ofChannels = { [host.$ref]: { host } }
return { controller, xapi, host, network, addNetwork }
}
it('rewires the private networks of the host pool', async () => {
const { controller, xapi, host, network, addNetwork } = makeEjectContext()
controller._objectsRemoved(xapi, { 'host-id-1': host })
await new Promise(resolve => setImmediate(resolve))
// the client and channel of the removed host are dropped
assert.equal(controller.ovsdbClients[host.$ref], undefined)
assert.equal(controller.ofChannels[host.$ref], undefined)
// the network of the host's pool is re-registered: this is what removes
// the stale tunnel legs (resetForNetwork) on the remaining hosts
assert.equal(addNetwork.mock.calls.length, 1)
assert.equal(addNetwork.mock.calls[0].arguments[0], network)
})
it('does not rewire for a non-host object removal', async () => {
const { controller, xapi, addNetwork } = makeEjectContext()
controller._objectsRemoved(xapi, { 'pif-id-1': { $type: 'PIF', $ref: 'pif-ref-1', $id: 'pif-id-1' } })
await new Promise(resolve => setImmediate(resolve))
assert.equal(addNetwork.mock.calls.length, 0)
})
})
describe('VIF traffic rules', () => {
// a VIF on a host where the XAPI plugin fails to apply (or remove) the rule
function controllerWithFailingPlugin() {

View File

@@ -87,10 +87,9 @@ export class PrivateNetwork {
host: this.center.name_label,
})
let hostResult
let centerResult
let bridgeName
try {
;[hostResult, centerResult] = await Promise.all([
;[bridgeName] = await Promise.all([
hostClient.addInterfaceAndPort(network, centerPif.IP, encapsulation, vni, password, this.uuid),
centerClient.addInterfaceAndPort(centerNetwork, hostPif.IP, encapsulation, vni, password, this.uuid),
])
@@ -104,22 +103,14 @@ export class PrivateNetwork {
})
return
}
if (hostResult === undefined) {
return
}
log.info('Host added', {
privateNetwork: this.uuid,
network: network.name_label,
host: host.name_label,
pool: host.$pool.name_label,
})
// The reconcile re-runs on every host metrics event: log only when the
// host or the center side has actually been (re)wired
if (hostResult.added || centerResult?.added) {
log.info('Host added', {
privateNetwork: this.uuid,
network: network.name_label,
host: host.name_label,
pool: host.$pool.name_label,
})
}
return hostResult.name
return bridgeName
}
addNetwork(network) {

View File

@@ -1,79 +0,0 @@
import { describe, it } from 'node:test'
import { strict as assert } from 'node:assert'
import { PrivateNetwork } from './private-network.js'
describe('PrivateNetwork.addHost', () => {
const transportPif = { network: 'network-ref-1', IP: '10.0.0.1' }
function makePrivateNetwork(hostResult, centerResult) {
const controller = {
privateNetworks: {},
registerPrivateNetwork: privateNetwork => {
controller.privateNetworks[privateNetwork.uuid] = privateNetwork
},
ovsdbClients: {
'host-ref-1': { addInterfaceAndPort: async () => hostResult },
'host-ref-center': { addInterfaceAndPort: async () => centerResult },
},
}
const network = {
$ref: 'network-ref-1',
$xapi: { getRecord: async () => network },
other_config: {},
}
const pif = { network: 'network-ref-1' }
const host = {
$ref: 'host-ref-1',
name_label: 'host-1',
$PIFs: [pif],
$pool: { uuid: 'pool-uuid-1', name_label: 'pool' },
}
const center = {
$ref: 'host-ref-center',
name_label: 'center',
$PIFs: [pif],
$pool: { uuid: 'pool-uuid-1', name_label: 'pool' },
}
const privateNetwork = new PrivateNetwork(controller, 'private-network-uuid')
privateNetwork.center = center
privateNetwork.networks = { 'pool-uuid-1': network }
// always report the transport PIF, so getTransportPif does not need the XAPI
privateNetwork.getTransportPif = async () => transportPif
return { privateNetwork, host, center }
}
it('returns the bridge name when the port already exists on both sides', async () => {
const { privateNetwork, host } = makePrivateNetwork(
{ name: 'xapi1', added: false },
{ name: 'xapi2', added: false }
)
assert.equal(await privateNetwork.addHost(host), 'xapi1')
})
it('returns the bridge name when only the host side was (re)wired', async () => {
const { privateNetwork, host } = makePrivateNetwork(
{ name: 'xapi1', added: true },
{ name: 'xapi2', added: false }
)
assert.equal(await privateNetwork.addHost(host), 'xapi1')
})
it('returns the bridge name when only the center side was (re)wired', async () => {
const { privateNetwork, host } = makePrivateNetwork(
{ name: 'xapi1', added: false },
{ name: 'xapi2', added: true }
)
assert.equal(await privateNetwork.addHost(host), 'xapi1')
})
it('returns nothing when the host side could not be connected', async () => {
const { privateNetwork, host } = makePrivateNetwork(undefined, { name: 'xapi2', added: true })
assert.equal(await privateNetwork.addHost(host), undefined)
})
it('does nothing for the star-center host itself', async () => {
const { privateNetwork, center } = makePrivateNetwork(undefined, undefined)
assert.equal(await privateNetwork.addHost(center), undefined)
})
})

View File

@@ -100,8 +100,7 @@ export class OvsdbClient {
if (password === undefined) {
socket.destroy()
this._adding = this._adding.filter(elem => elem.id !== network.uuid || elem.addr !== remoteAddress)
// The port already exists: nothing has been added
return { name: bridge.name, added: false }
return bridge.name
}
// Remove port and interface to recreate it with new password
@@ -200,7 +199,7 @@ export class OvsdbClient {
host: this.host.name_label,
})
socket.destroy()
return { name: bridge.name, added: true }
return bridge.name
}
async resetForNetwork(network, privateNetworkUuid) {
@@ -355,16 +354,9 @@ export class OvsdbClient {
const where = [['target', '==', TARGET]]
const selectResult = await this._select('Controller', ['_uuid'], where, socket)
// The Controller row is created by setBridgeController(), which may not have
// run yet on a host that just joined the pool: don't crash, it will be set
// later (next PIF event or the join flow).
if (selectResult === undefined) {
socket.destroy()
return
}
this._controllerUuid = selectResult._uuid[1]
}
assert.notStrictEqual(this._controllerUuid, undefined)
const bridge = await this._getBridgeForNetwork(network, socket)
if (bridge.uuid === undefined) {

View File

@@ -74,25 +74,3 @@ describe('a bridge XO already controls', () => {
assert.equal(transactions[0].length, 2)
})
})
describe('a network bridge on a host without a controller yet', () => {
// a client on a host that just joined the pool: the Controller row is not
// created yet (setBridgeController has not run), so the select finds nothing
function makeClient() {
const client = new OvsdbClient({ name_label: 'host', $PIFs: [{ $network: { uuid: 'net', name_label: 'net' } }] })
const transactions = []
client._connect = async () => ({ destroy() {} })
client._select = async () => undefined
client._sendOvsdbTransaction = async params => {
transactions.push(params)
return [{ error: null, result: [{ uuid: ['uuid', 'controller'] }] }]
}
return { client, transactions }
}
it('does not throw and sends no transaction when the Controller row is missing', async () => {
const { client, transactions } = makeClient()
await client.setBridgeControllerForNetwork({ uuid: 'net', name_label: 'net' })
assert.deepEqual(transactions, [])
})
})

View File

@@ -289,6 +289,10 @@ export default class Proxy {
// ensure the updater is using the expected channel otherwise the state will not be correct
await this.callProxyMethod(id, 'appliance.updater.configure', { channel: await this._getChannel() })
} catch (error) {
// getState would fail the same way, after waiting for another timeout
if (error.code === PROXY_UNREACHABLE) {
throw error
}
log.warn('failed to set proxy updater channel', { error })
}