mirror of
https://github.com/vatesfr/xen-orchestra.git
synced 2026-11-25 00:08:28 -06:00
Compare commits
1 Commits
log-trace
...
proxy-api-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e65a139ab |
28
.github/workflows/ci.yml
vendored
28
.github/workflows/ci.yml
vendored
@@ -5,46 +5,34 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# https://github.com/actions/checkout
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y curl qemu-utils python3-vmdkstream git libxml2-utils libfuse2 nbdkit
|
||||
|
||||
# https://turbo.build/repo/docs/guides/ci-vendors/github-actions#caching-with-github-actionscache
|
||||
- name: Cache Turbo
|
||||
uses: actions/cache@v4
|
||||
# https://github.com/actions/cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: '.turbo'
|
||||
key: ${{ runner.os }}-turbo-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-turbo-
|
||||
|
||||
# https://github.com/actions/setup-node
|
||||
path: '**/node_modules/.cache/turbo'
|
||||
key: ${{ runner.os }}-turbo-cache
|
||||
- name: Setup Node environment
|
||||
uses: actions/setup-node@v4
|
||||
# https://github.com/actions/setup-node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '20'
|
||||
node-version: '18'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install project dependencies
|
||||
run: yarn
|
||||
|
||||
- name: Ensure packages are sorted in CHANGELOG.unreleased.md
|
||||
run: ./scripts/gen-deps-list.js --check-order > /dev/null
|
||||
|
||||
- name: Ensure yarn.lock is up-to-date
|
||||
run: git diff --exit-code yarn.lock
|
||||
|
||||
- name: Build the project
|
||||
run: yarn build
|
||||
|
||||
- name: Unit tests
|
||||
run: yarn test-unit
|
||||
|
||||
- name: Lint tests
|
||||
run: yarn test-lint
|
||||
|
||||
- name: Integration tests
|
||||
run: sudo yarn test-integration
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it, beforeEach } = require('node:test')
|
||||
const { describe, it, beforeEach } = require('test')
|
||||
const assert = require('assert').strict
|
||||
const { spy } = require('sinon')
|
||||
|
||||
|
||||
@@ -30,9 +30,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sinon": "^18.0.0"
|
||||
"sinon": "^18.0.0",
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const assert = require('assert')
|
||||
|
||||
const { coalesceCalls } = require('./')
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const assert = require('node:assert').strict
|
||||
|
||||
const { compose } = require('./')
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const assert = require('assert')
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
|
||||
const { decorateClass, decorateWith, decorateMethodsWith, perInstance } = require('./')
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const assert = require('node:assert/strict')
|
||||
const test = require('node:test')
|
||||
const test = require('test')
|
||||
|
||||
const diff = require('./index.js')
|
||||
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const { useFakeTimers, spy, assert } = require('sinon')
|
||||
|
||||
const { createDebounceResource } = require('./debounceResource')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const { spy, assert } = require('sinon')
|
||||
|
||||
const { deduped } = require('./deduped')
|
||||
|
||||
@@ -14,21 +14,22 @@
|
||||
"url": "https://vates.fr"
|
||||
},
|
||||
"license": "ISC",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.5",
|
||||
"engines": {
|
||||
"node": ">=8.10"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vates/multi-key-map": "^0.2.0",
|
||||
"@xen-orchestra/async-map": "^0.1.2",
|
||||
"@xen-orchestra/log": "^0.7.1",
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"ensure-array": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sinon": "^18.0.0"
|
||||
"sinon": "^18.0.0",
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vates/fuse-vhd",
|
||||
"version": "2.1.2",
|
||||
"version": "2.1.1",
|
||||
"license": "ISC",
|
||||
"private": false,
|
||||
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@vates/fuse-vhd",
|
||||
@@ -19,12 +19,12 @@
|
||||
},
|
||||
"main": "./index.mjs",
|
||||
"dependencies": {
|
||||
"@xen-orchestra/fs": "^4.2.1",
|
||||
"@xen-orchestra/log": "^0.7.1",
|
||||
"@xen-orchestra/fs": "^4.1.7",
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"fuse-native": "^2.2.6",
|
||||
"lru-cache": "^7.14.0",
|
||||
"promise-toolbox": "^0.21.0",
|
||||
"vhd-lib": "^4.11.1"
|
||||
"vhd-lib": "^4.11.0"
|
||||
},
|
||||
"bin": {
|
||||
"xo-fuse-vhd": "./cli.mjs"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const { jsonHash } = require('@vates/json-hash')
|
||||
const assert = require('node:assert/strict')
|
||||
const test = require('node:test')
|
||||
const test = require('test')
|
||||
|
||||
const cases = [
|
||||
[null, 'dCNOmK_nSY-12vHzasLXiswzlGT5UHA7jAGYkvmCuQs'],
|
||||
|
||||
@@ -23,8 +23,11 @@
|
||||
"engines": {
|
||||
"node": ">=14.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const assert = require('node:assert')
|
||||
|
||||
const { MultiKeyMap } = require('./')
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,9 @@ export default class MultiNbdClient {
|
||||
async connect() {
|
||||
const candidates = [...this.#settings]
|
||||
|
||||
const promises = []
|
||||
const baseOptions = this.#options
|
||||
const _connect = async () => {
|
||||
const _connect = async () => {
|
||||
if (candidates.length === 0) {
|
||||
return
|
||||
}
|
||||
@@ -62,11 +63,11 @@ export default class MultiNbdClient {
|
||||
return _connect()
|
||||
}
|
||||
}
|
||||
// don't connect in parallel since this can lead to race condition
|
||||
// on distributed systems ( like the NBD server of the XAPI)
|
||||
for (let i = 0; i < this.#nbdConcurrency; i++) {
|
||||
await _connect()
|
||||
promises.push(_connect())
|
||||
}
|
||||
await Promise.all(promises)
|
||||
|
||||
if (this.#clients.length === 0) {
|
||||
throw new Error(`Fail to connect to any Nbd client`)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"url": "https://vates.fr"
|
||||
},
|
||||
"license": "ISC",
|
||||
"version": "3.1.2",
|
||||
"version": "3.1.0",
|
||||
"engines": {
|
||||
"node": ">=14.0"
|
||||
},
|
||||
@@ -22,9 +22,9 @@
|
||||
"@vates/async-each": "^1.0.0",
|
||||
"@vates/read-chunk": "^1.2.0",
|
||||
"@xen-orchestra/async-map": "^0.1.2",
|
||||
"@xen-orchestra/log": "^0.7.1",
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"promise-toolbox": "^0.21.0",
|
||||
"xen-api": "^4.5.0"
|
||||
"xen-api": "^4.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap": "^18.7.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@vates/node-vsphere-soap",
|
||||
"version": "2.1.1",
|
||||
"version": "2.1.0",
|
||||
"description": "interface to vSphere SOAP/WSDL from node for interfacing with vCenter or ESXi, forked from node-vsphere-soap",
|
||||
"main": "lib/client.mjs",
|
||||
"author": "reedog117",
|
||||
@@ -11,11 +11,14 @@
|
||||
},
|
||||
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
|
||||
"dependencies": {
|
||||
"@xen-orchestra/log": "^0.7.1",
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"axios": "^1.4.0",
|
||||
"soap": "^1.0.0",
|
||||
"soap-cookie": "^0.10.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"vsphere",
|
||||
"vcenter",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import assert from 'assert'
|
||||
import { describe, it } from 'node:test'
|
||||
import { describe, it } from 'test'
|
||||
|
||||
import * as vc from '../lib/client.mjs'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { strict as assert } from 'node:assert'
|
||||
import test from 'node:test'
|
||||
import test from 'test'
|
||||
|
||||
import {
|
||||
generateHotp,
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const assert = require('assert/strict')
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
|
||||
const { every, not, some } = require('./')
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const assert = require('node:assert').strict
|
||||
|
||||
const { Readable } = require('stream')
|
||||
|
||||
@@ -25,12 +25,15 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"author": {
|
||||
"name": "Vates SAS",
|
||||
"url": "https://vates.fr"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.2.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"isutf8": "^4.0.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const assert = require('node:assert').strict
|
||||
|
||||
const { Readable } = require('stream')
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,15 +49,6 @@ const result = await task.runInside(fn)
|
||||
// if fn rejects, the task will be marked as failed
|
||||
// if fn resolves, the task will be marked as succeeded
|
||||
const result = await task.run(fn)
|
||||
|
||||
// manually starts the task
|
||||
task.start()
|
||||
|
||||
// manually finishes the task in success state
|
||||
task.success(result)
|
||||
|
||||
// manually finishes the task in failure state
|
||||
task.failure(error)
|
||||
```
|
||||
|
||||
Inside a task:
|
||||
|
||||
@@ -65,15 +65,6 @@ const result = await task.runInside(fn)
|
||||
// if fn rejects, the task will be marked as failed
|
||||
// if fn resolves, the task will be marked as succeeded
|
||||
const result = await task.run(fn)
|
||||
|
||||
// manually starts the task
|
||||
task.start()
|
||||
|
||||
// manually finishes the task in success state
|
||||
task.success(result)
|
||||
|
||||
// manually finishes the task in failure state
|
||||
task.failure(error)
|
||||
```
|
||||
|
||||
Inside a task:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const assert = require('node:assert').strict
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
|
||||
const { makeOnProgress } = require('./combineEvents.js')
|
||||
const { Task } = require('./index.js')
|
||||
|
||||
@@ -131,15 +131,10 @@ class Task {
|
||||
|
||||
#end(status, result) {
|
||||
assert.equal(this.#status, PENDING)
|
||||
assert.equal(this.#running, false)
|
||||
|
||||
this.#status = status
|
||||
this.#emit('end', { status, result })
|
||||
this.#onProgress = alreadyEnded
|
||||
this.#status = status
|
||||
}
|
||||
|
||||
failure(error) {
|
||||
this.#end(FAILURE, error)
|
||||
}
|
||||
|
||||
info(message, data) {
|
||||
@@ -147,8 +142,10 @@ class Task {
|
||||
}
|
||||
|
||||
#maybeStart() {
|
||||
if (this.#startData !== undefined) {
|
||||
this.start()
|
||||
const startData = this.#startData
|
||||
if (startData !== undefined) {
|
||||
this.#startData = undefined
|
||||
this.#emit('start', startData)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +170,6 @@ class Task {
|
||||
this.#running = false
|
||||
return result
|
||||
} catch (result) {
|
||||
this.#running = false
|
||||
this.#end(FAILURE, result)
|
||||
throw result
|
||||
}
|
||||
@@ -185,18 +181,6 @@ class Task {
|
||||
this.#emit('property', { name, value })
|
||||
}
|
||||
|
||||
start() {
|
||||
const startData = this.#startData
|
||||
assert.notEqual(startData, undefined, 'task has already started')
|
||||
|
||||
this.#startData = undefined
|
||||
this.#emit('start', startData)
|
||||
}
|
||||
|
||||
success(result) {
|
||||
this.#end(SUCCESS, result)
|
||||
}
|
||||
|
||||
warning(message, data) {
|
||||
assert.equal(this.status, PENDING)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const assert = require('node:assert').strict
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
|
||||
const { makeOnProgress } = require('./combineEvents.js')
|
||||
const { Task } = require('./index.js')
|
||||
@@ -145,43 +145,6 @@ describe('Task', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('#failure()', function () {
|
||||
const error = new Error()
|
||||
|
||||
it('throws if the task has not started yet', function () {
|
||||
const task = createTask()
|
||||
|
||||
assert.throws(() => task.failure(error), { message: 'task has not started yet' })
|
||||
})
|
||||
|
||||
it('throws if the task is running', function () {
|
||||
const task = createTask()
|
||||
task.runInside(noop)
|
||||
|
||||
assert.throws(() => task.failure(error), { code: 'ERR_ASSERTION' })
|
||||
})
|
||||
|
||||
it('throws if the task has already finished', function () {
|
||||
const task = createTask()
|
||||
task.start()
|
||||
task.success()
|
||||
|
||||
assert.throws(() => task.failure(error), { code: 'ERR_ASSERTION' })
|
||||
})
|
||||
|
||||
it('finishes the task and mark it as failed', function () {
|
||||
const task = createTask()
|
||||
task.start()
|
||||
task.failure(error)
|
||||
|
||||
assertEvent(task, {
|
||||
status: 'failure',
|
||||
result: error,
|
||||
type: 'end',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('.info()', function () {
|
||||
it('does nothing when run outside a task', function () {
|
||||
Task.info('foo')
|
||||
@@ -281,59 +244,6 @@ describe('Task', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('#start', function () {
|
||||
it('starts the task', function () {
|
||||
const task = createTask()
|
||||
task.start()
|
||||
|
||||
assertEvent(task, { type: 'start' })
|
||||
})
|
||||
|
||||
it('throws when the task has already started', function () {
|
||||
const task = createTask()
|
||||
task.start()
|
||||
|
||||
assert.throws(() => task.start(), { message: 'task has already started' })
|
||||
})
|
||||
})
|
||||
|
||||
describe('#success()', function () {
|
||||
const result = {}
|
||||
|
||||
it('throws if the task has not started yet', function () {
|
||||
const task = createTask()
|
||||
|
||||
assert.throws(() => task.success(result), { message: 'task has not started yet' })
|
||||
})
|
||||
|
||||
it('throws if the task is running', function () {
|
||||
const task = createTask()
|
||||
task.runInside(noop)
|
||||
|
||||
assert.throws(() => task.success(result), { code: 'ERR_ASSERTION' })
|
||||
})
|
||||
|
||||
it('throws if the task has already finished', function () {
|
||||
const task = createTask()
|
||||
task.start()
|
||||
task.success()
|
||||
|
||||
assert.throws(() => task.success(result), { code: 'ERR_ASSERTION' })
|
||||
})
|
||||
|
||||
it('finishes the task and mark it as successful', function () {
|
||||
const task = createTask()
|
||||
task.start()
|
||||
task.success(result)
|
||||
|
||||
assertEvent(task, {
|
||||
status: 'success',
|
||||
result,
|
||||
type: 'end',
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('.warning()', function () {
|
||||
it('does nothing when run outside a task', function () {
|
||||
Task.warning('foo')
|
||||
|
||||
@@ -13,13 +13,16 @@
|
||||
"url": "https://vates.fr"
|
||||
},
|
||||
"license": "ISC",
|
||||
"version": "0.6.0",
|
||||
"version": "0.4.1",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
|
||||
@@ -121,8 +121,7 @@ const xml = `
|
||||
</methodResponse>
|
||||
`
|
||||
|
||||
// do not normalize or trim whitespaces as it will break string values
|
||||
const tree = parseXml(xml, { normalize: false, trim: false })
|
||||
const tree = parseXml(xml)
|
||||
|
||||
// it can now be passed to the XML-RPC parser
|
||||
xmlRpcParser.parse(tree)
|
||||
|
||||
@@ -139,8 +139,7 @@ const xml = `
|
||||
</methodResponse>
|
||||
`
|
||||
|
||||
// do not normalize or trim whitespaces as it will break string values
|
||||
const tree = parseXml(xml, { normalize: false, trim: false })
|
||||
const tree = parseXml(xml)
|
||||
|
||||
// it can now be passed to the XML-RPC parser
|
||||
xmlRpcParser.parse(tree)
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
"node": ">=12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vates/xml": "^2.0.0"
|
||||
"@vates/xml": "^2.0.0",
|
||||
"test": "^3.3.0"
|
||||
},
|
||||
"exports": {
|
||||
"./formatter": "./formatter.js",
|
||||
@@ -27,6 +28,6 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const { parseXml } = require('@vates/xml/parse')
|
||||
const { readFileSync } = require('node:fs')
|
||||
const { xmlRpcFormatter } = require('@vates/xml-rpc/formatter')
|
||||
const assert = require('node:assert/strict')
|
||||
const test = require('node:test')
|
||||
const test = require('test')
|
||||
|
||||
const methodCall = require('./methodCall.js')
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ const { parseXml } = require('@vates/xml/parse')
|
||||
const { readFileSync } = require('node:fs')
|
||||
const { xmlRpcParser } = require('@vates/xml-rpc/parser')
|
||||
const assert = require('node:assert/strict')
|
||||
const test = require('node:test')
|
||||
const test = require('test')
|
||||
|
||||
const methodCall = require('./methodCall.js')
|
||||
|
||||
|
||||
@@ -21,12 +21,15 @@
|
||||
"dependencies": {
|
||||
"sax": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.3.0"
|
||||
},
|
||||
"exports": {
|
||||
"./format": "./format.js",
|
||||
"./parse": "./parse.js"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ const { formatXml } = require('@vates/xml/format')
|
||||
const { join } = require('node:path')
|
||||
const { readFileSync } = require('node:fs')
|
||||
const assert = require('node:assert/strict')
|
||||
const test = require('node:test')
|
||||
const test = require('test')
|
||||
|
||||
test('format()', function () {
|
||||
const xml = String(readFileSync(join(__dirname, 'data.xml')))
|
||||
|
||||
@@ -4,7 +4,7 @@ const { parseXml } = require('@vates/xml/parse')
|
||||
const { readFileSync } = require('node:fs')
|
||||
const { join } = require('node:path')
|
||||
const assert = require('node:assert/strict')
|
||||
const test = require('node:test')
|
||||
const test = require('test')
|
||||
|
||||
test('parse()', function () {
|
||||
const xml = String(readFileSync(join(__dirname, 'data.xml')))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const assert = require('assert').strict
|
||||
const sinon = require('sinon')
|
||||
|
||||
|
||||
@@ -32,9 +32,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sinon": "^18.0.0"
|
||||
"sinon": "^18.0.0",
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
|
||||
const assert = require('assert/strict')
|
||||
const { afterEach, describe, it } = require('node:test')
|
||||
const { afterEach, describe, it } = require('test')
|
||||
|
||||
const { AlteredRecordError, AuditCore, MissingRecordError, NULL_ID, Storage } = require('.')
|
||||
|
||||
|
||||
@@ -7,17 +7,17 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/vatesfr/xen-orchestra.git"
|
||||
},
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.0",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vates/decorate-with": "^2.1.0",
|
||||
"@xen-orchestra/log": "^0.7.1",
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"golike-defer": "^0.5.1",
|
||||
"object-hash": "^2.0.1"
|
||||
},
|
||||
@@ -26,5 +26,8 @@
|
||||
"author": {
|
||||
"name": "Vates SAS",
|
||||
"url": "https://vates.fr"
|
||||
},
|
||||
"devDependencies": {
|
||||
"test": "^3.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
|
||||
"dependencies": {
|
||||
"@xen-orchestra/async-map": "^0.1.2",
|
||||
"@xen-orchestra/backups": "^0.54.3",
|
||||
"@xen-orchestra/fs": "^4.2.1",
|
||||
"@xen-orchestra/backups": "^0.54.0",
|
||||
"@xen-orchestra/fs": "^4.1.7",
|
||||
"filenamify": "^6.0.0",
|
||||
"getopts": "^2.2.5",
|
||||
"lodash": "^4.17.15",
|
||||
|
||||
@@ -59,8 +59,8 @@ export class HealthCheckVmBackup {
|
||||
const running = new Date()
|
||||
remainingTimeout -= running - started
|
||||
|
||||
// wait for the guest tools to be detected
|
||||
await xapi.waitObjectState(restoredVm.guest_metrics, gm => gm?.PV_drivers_detected, {
|
||||
// wait for the guest tool version to be defined
|
||||
await xapi.waitObjectState(restoredVm.guest_metrics, gm => gm?.PV_drivers_version?.major !== undefined, {
|
||||
timeout: remainingTimeout,
|
||||
timeoutMessage: refOrUuid =>
|
||||
`timeout reached while waiting for ${refOrUuid} to report the driver version through the Xen tools. Please check or update the Xen tools.`,
|
||||
|
||||
@@ -79,13 +79,8 @@ export class ImportVmBackup {
|
||||
debug('found disks, wlll search its snapshots', { snapshots: xapiDisk.snapshots })
|
||||
for (const snapshotRef of xapiDisk.snapshots) {
|
||||
const snapshot = await this._xapi.getRecord('VDI', snapshotRef)
|
||||
|
||||
debug('handling snapshot', { snapshot })
|
||||
if (snapshot.type === 'cbt_metadata') {
|
||||
// disk without data can't be used as a base
|
||||
debug('cbt metadata snapshot, skip')
|
||||
continue
|
||||
}
|
||||
|
||||
// take only the first snapshot
|
||||
if (snapshotCandidate && snapshotCandidate.snapshot_time < snapshot.snapshot_time) {
|
||||
debug('already got a better candidate')
|
||||
|
||||
@@ -107,13 +107,10 @@ export class RemoteAdapter {
|
||||
async *_getLvmLogicalVolumes(devicePath, pvId, vgName) {
|
||||
yield this._getLvmPhysicalVolume(devicePath, pvId && (await this._findPartition(devicePath, pvId)))
|
||||
|
||||
debug('activate LVM volume group', { vgName })
|
||||
await fromCallback(execFile, 'vgchange', ['-ay', vgName])
|
||||
try {
|
||||
debug('get LVM volume group name and path', { vgName })
|
||||
yield lvs(['lv_name', 'lv_path'], vgName)
|
||||
} finally {
|
||||
debug('deactivate LVM volume group', { vgName })
|
||||
await fromCallback(execFile, 'vgchange', ['-an', vgName])
|
||||
}
|
||||
}
|
||||
@@ -124,22 +121,15 @@ export class RemoteAdapter {
|
||||
args.push('-o', partition.start * 512, '--sizelimit', partition.size)
|
||||
}
|
||||
args.push('--show', '-f', devicePath)
|
||||
|
||||
debug('attach loop device', { devicePath, partition })
|
||||
const path = (await fromCallback(execFile, 'losetup', args)).trim()
|
||||
try {
|
||||
debug('list LVM physical volume', { path })
|
||||
await fromCallback(execFile, 'pvscan', ['--cache', path])
|
||||
|
||||
yield path
|
||||
} finally {
|
||||
try {
|
||||
const vgNames = await pvs('vg_name', path)
|
||||
|
||||
debug('deactivate LVM volume groups', { vgNames })
|
||||
await fromCallback(execFile, 'vgchange', ['-an', ...vgNames])
|
||||
} finally {
|
||||
debug('detach loop device', { path })
|
||||
await fromCallback(execFile, 'losetup', ['-d', path])
|
||||
}
|
||||
}
|
||||
@@ -160,7 +150,6 @@ export class RemoteAdapter {
|
||||
|
||||
const path = yield getTmpDir()
|
||||
const mount = options => {
|
||||
debug('mount device', { devicePath, mountPath: path })
|
||||
return fromCallback(execFile, 'mount', [
|
||||
`--options=${options.join(',')}`,
|
||||
`--source=${devicePath}`,
|
||||
@@ -178,7 +167,6 @@ export class RemoteAdapter {
|
||||
try {
|
||||
yield path
|
||||
} finally {
|
||||
debug('umount device', { devicePath, mountPath: path })
|
||||
await fromCallback(execFile, 'umount', ['--lazy', path])
|
||||
}
|
||||
}
|
||||
@@ -348,8 +336,6 @@ export class RemoteAdapter {
|
||||
|
||||
const diskPath = handler.getFilePath('/' + diskId)
|
||||
const mountDir = yield getTmpDir()
|
||||
|
||||
debug('mount VHD (vhdimount)', { diskPath, mountPath: mountDir })
|
||||
await fromCallback(execFile, 'vhdimount', [diskPath, mountDir])
|
||||
try {
|
||||
let max = 0
|
||||
@@ -371,7 +357,6 @@ export class RemoteAdapter {
|
||||
|
||||
yield `${mountDir}/${maxEntry}`
|
||||
} finally {
|
||||
debug('umount VHD (fusermount)', { diskPath, mountPath: mountDir })
|
||||
await fromCallback(execFile, 'fusermount', ['-uz', mountDir])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import test from 'node:test'
|
||||
import test from 'test'
|
||||
import { strict as assert } from 'node:assert'
|
||||
|
||||
import tmp from 'tmp'
|
||||
|
||||
@@ -121,19 +121,7 @@ export async function checkAliases(
|
||||
) {
|
||||
const aliasFound = []
|
||||
for (const alias of aliasPaths) {
|
||||
let target
|
||||
try {
|
||||
target = await resolveVhdAlias(handler, alias)
|
||||
} catch (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
logWarn('missing target of alias', { alias })
|
||||
if (remove) {
|
||||
logInfo('removing alias and non VHD target', { alias, target })
|
||||
await handler.unlink(target)
|
||||
await handler.unlink(alias)
|
||||
}
|
||||
}
|
||||
}
|
||||
const target = await resolveVhdAlias(handler, alias)
|
||||
|
||||
if (!isVhdFile(target)) {
|
||||
logWarn('alias references non VHD target', { alias, target })
|
||||
@@ -213,9 +201,9 @@ export async function cleanVm(
|
||||
|
||||
// remove broken VHDs
|
||||
await asyncMap(vhds, async path => {
|
||||
if (removeTmp && basename(path)[0] === '.') {
|
||||
if(removeTmp && basename(path)[0] === '.'){
|
||||
logInfo('deleting temporary VHD', { path })
|
||||
return VhdAbstract.unlink(handler, path)
|
||||
return VhdAbstract.unlink(handler, path)
|
||||
}
|
||||
try {
|
||||
await Disposable.use(openVhd(handler, path, { checkSecondFooter: !interruptedVhds.has(path) }), vhd => {
|
||||
|
||||
@@ -1,23 +1,16 @@
|
||||
import Disposable from 'promise-toolbox/Disposable'
|
||||
import { createLogger } from '@xen-orchestra/log'
|
||||
import { join } from 'node:path'
|
||||
import { mkdir, rmdir } from 'node:fs/promises'
|
||||
import { tmpdir } from 'os'
|
||||
|
||||
const { debug } = createLogger('xo:backups:getTmpDir')
|
||||
|
||||
const MAX_ATTEMPTS = 3
|
||||
|
||||
export async function getTmpDir() {
|
||||
for (let i = 0; true; ++i) {
|
||||
const path = join(tmpdir(), Math.random().toString(36).slice(2))
|
||||
try {
|
||||
debug('creating directory', { path })
|
||||
await mkdir(path)
|
||||
return new Disposable(() => {
|
||||
debug('removing directory', { path })
|
||||
return rmdir(path)
|
||||
}, path)
|
||||
return new Disposable(() => rmdir(path), path)
|
||||
} catch (error) {
|
||||
if (i === MAX_ATTEMPTS) {
|
||||
throw error
|
||||
|
||||
@@ -52,32 +52,14 @@ export async function exportIncrementalVm(
|
||||
$snapshot_of$uuid: vdi.$snapshot_of?.uuid,
|
||||
$SR$uuid: vdi.$SR.uuid,
|
||||
}
|
||||
try {
|
||||
streams[`${vdiRef}.vhd`] = await vdi.$exportContent({
|
||||
baseRef: baseVdi?.$ref,
|
||||
cancelToken,
|
||||
format: 'vhd',
|
||||
nbdConcurrency,
|
||||
preferNbd,
|
||||
})
|
||||
} catch (err) {
|
||||
if (err.code === 'VDI_CANT_DO_DELTA') {
|
||||
// fall back to a base
|
||||
Task.info(`Can't do delta, will try to get a full stream`, { vdi })
|
||||
streams[`${vdiRef}.vhd`] = await vdi.$exportContent({
|
||||
cancelToken,
|
||||
format: 'vhd',
|
||||
nbdConcurrency,
|
||||
preferNbd,
|
||||
})
|
||||
// only warn if the fall back succeed
|
||||
Task.warning(`Can't do delta with this vdi, transfer will be a full`, {
|
||||
vdi,
|
||||
})
|
||||
} else {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
streams[`${vdiRef}.vhd`] = await vdi.$exportContent({
|
||||
baseRef: baseVdi?.$ref,
|
||||
cancelToken,
|
||||
format: 'vhd',
|
||||
nbdConcurrency,
|
||||
preferNbd,
|
||||
})
|
||||
})
|
||||
|
||||
const suspendVdi = vm.$suspend_VDI
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { createLogger } from '@xen-orchestra/log'
|
||||
|
||||
import { asyncEach } from '@vates/async-each'
|
||||
import assert from 'node:assert'
|
||||
import * as UUID from 'uuid'
|
||||
@@ -13,7 +11,6 @@ import { Disposable } from 'promise-toolbox'
|
||||
import { openVhd } from 'vhd-lib'
|
||||
import { getVmBackupDir } from '../../_getVmBackupDir.mjs'
|
||||
|
||||
const { warn } = createLogger('xo:backups:Incrementalremote')
|
||||
class IncrementalRemoteVmBackupRunner extends AbstractRemote {
|
||||
_getRemoteWriter() {
|
||||
return IncrementalRemoteWriter
|
||||
@@ -49,7 +46,11 @@ class IncrementalRemoteVmBackupRunner extends AbstractRemote {
|
||||
})
|
||||
|
||||
const presentBaseVdis = new Map(baseUuidToSrcVdi)
|
||||
await this._callWriters(writer => writer.checkBaseVdis(presentBaseVdis), 'writer.checkBaseVdis()', false)
|
||||
await this._callWriters(
|
||||
writer => presentBaseVdis.size !== 0 && writer.checkBaseVdis(presentBaseVdis),
|
||||
'writer.checkBaseVdis()',
|
||||
false
|
||||
)
|
||||
// check if the parent vdi are present in all the remotes
|
||||
baseUuidToSrcVdi.forEach((srcVdiUuid, baseUuid) => {
|
||||
if (!presentBaseVdis.has(baseUuid)) {
|
||||
@@ -63,29 +64,17 @@ class IncrementalRemoteVmBackupRunner extends AbstractRemote {
|
||||
|
||||
for (const metadata of transferList) {
|
||||
assert.strictEqual(metadata.mode, 'delta')
|
||||
await this._selectBaseVm(metadata)
|
||||
await this._callWriters(writer => writer.prepare({ isBase: metadata.isBase }), 'writer.prepare()')
|
||||
const incrementalExport = await this._sourceRemoteAdapter.readIncrementalVmBackup(metadata, undefined, {
|
||||
useChain: false,
|
||||
})
|
||||
// don't trust metadata too much
|
||||
// recompute if it's a base backup
|
||||
// recompute if disks are differencing or not
|
||||
|
||||
const isVhdDifferencing = {}
|
||||
|
||||
await asyncEach(Object.entries(incrementalExport.streams), async ([key, stream]) => {
|
||||
isVhdDifferencing[key] = await isVhdDifferencingDisk(stream)
|
||||
})
|
||||
const hasDifferencingDisk = Object.values(isVhdDifferencing).includes(true)
|
||||
if (metadata.isBase === hasDifferencingDisk) {
|
||||
warn(`Metadata isBase and real disk value are different`, {
|
||||
metadataIsBase: metadata.isBase,
|
||||
diskIsBase: !hasDifferencingDisk,
|
||||
isVhdDifferencing,
|
||||
})
|
||||
}
|
||||
metadata.isBase = !hasDifferencingDisk
|
||||
metadata.isVhdDifferencing = isVhdDifferencing
|
||||
await this._selectBaseVm(metadata)
|
||||
await this._callWriters(writer => writer.prepare({ isBase: metadata.isBase }), 'writer.prepare()')
|
||||
|
||||
incrementalExport.streams = mapValues(incrementalExport.streams, this._throttleStream)
|
||||
await this._callWriters(
|
||||
|
||||
@@ -91,11 +91,9 @@ export const IncrementalXapi = class IncrementalXapiVmBackupRunner extends Abstr
|
||||
'writer.updateUuidAndChain()'
|
||||
)
|
||||
|
||||
if (isFull) {
|
||||
await setVmDeltaChainLength(this._xapi, exportedVm.$ref, 0)
|
||||
} else {
|
||||
if (!isFull) {
|
||||
await setVmDeltaChainLength(this._xapi, exportedVm.$ref, (this._deltaChainLength ?? 0) + 1)
|
||||
}
|
||||
} // on a full the delta chain will be null
|
||||
|
||||
// not the case if offlineBackup
|
||||
if (exportedVm.is_a_snapshot) {
|
||||
|
||||
@@ -203,13 +203,7 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
|
||||
for (const srcVdi of srcVdis) {
|
||||
const snapshots = await xapi.getRecords('VDI', srcVdi.snapshots)
|
||||
for (const snapshot of snapshots) {
|
||||
// only keep the snapshot related to this backup job
|
||||
// and only if the job is still using purge snapshot data or if the disk
|
||||
// is not a cbt metadata disk ( expect a type: user for normal disks)
|
||||
if (
|
||||
snapshot.other_config[JOB_ID] === jobId &&
|
||||
(this._settings.cbtDestroySnapshotData || snapshot.type !== 'cbt_metadata')
|
||||
) {
|
||||
if (snapshot.other_config[JOB_ID] === jobId) {
|
||||
this._jobSnapshotVdis.push(snapshot)
|
||||
}
|
||||
}
|
||||
@@ -225,14 +219,6 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
|
||||
await xapi.barrier()
|
||||
// ensure cached object are up to date
|
||||
this._jobSnapshotVdis = this._jobSnapshotVdis.map(vdi => xapi.getObject(vdi.$ref))
|
||||
|
||||
// get the datetime of the most recent snapshot
|
||||
const lastSnapshotDateTime = this._jobSnapshotVdis
|
||||
.map(({ other_config }) => other_config[DATETIME])
|
||||
.sort()
|
||||
.pop()
|
||||
|
||||
// remove older snapshot schedule per schedule
|
||||
const snapshotsPerSchedule = groupBy(this._jobSnapshotVdis, _ => _.other_config[SCHEDULE_ID])
|
||||
await asyncMap(Object.entries(snapshotsPerSchedule), async ([scheduleId, snapshots]) => {
|
||||
const snapshotPerDatetime = groupBy(snapshots, _ => _.other_config[DATETIME])
|
||||
@@ -245,13 +231,10 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
|
||||
...allSettings[scheduleId],
|
||||
...allSettings[this._vm.uuid],
|
||||
}
|
||||
const retention = settings.snapshotRetention ?? 0
|
||||
// ensure we never delete the last one for delta
|
||||
const minRetention = this.job.mode === 'delta' ? 1 : 0
|
||||
const retention = Math.max(settings.snapshotRetention ?? 0, minRetention)
|
||||
await asyncMap(getOldEntries(retention, datetimes), async datetime => {
|
||||
// keep the last snapshot across all schedules for delta
|
||||
// since we'll need it to compute delta for next backup
|
||||
if (this.job.mode === 'delta' && datetime === lastSnapshotDateTime) {
|
||||
return
|
||||
}
|
||||
const vdis = snapshotPerDatetime[datetime]
|
||||
let vmRef
|
||||
// if there is an attached VM => destroy the VM (Non CBT backups)
|
||||
|
||||
@@ -66,7 +66,7 @@ export class IncrementalRemoteWriter extends MixinRemoteWriter(AbstractIncrement
|
||||
|
||||
async beforeBackup() {
|
||||
await super.beforeBackup()
|
||||
return this._cleanVm({ merge: true, remove: true })
|
||||
return this._cleanVm({ merge: true })
|
||||
}
|
||||
|
||||
prepare({ isFull }) {
|
||||
@@ -149,9 +149,6 @@ export class IncrementalRemoteWriter extends MixinRemoteWriter(AbstractIncrement
|
||||
assert.notStrictEqual(parentPath, undefined, 'A differential VHD must have a parent')
|
||||
// forbid any kind of loop
|
||||
assert.ok(basename(parentPath) < basename(path), `vhd must be sorted to be chained`)
|
||||
// re-chainVhd is mandatory
|
||||
// since the parent may be a alias or not
|
||||
// and the child may be the other
|
||||
await chainVhd(handler, parentPath, handler, path)
|
||||
}
|
||||
|
||||
|
||||
@@ -15,15 +15,11 @@ import assert from 'node:assert'
|
||||
export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWriter) {
|
||||
async checkBaseVdis(baseUuidToSrcVdi) {
|
||||
const sr = this._sr
|
||||
if (baseUuidToSrcVdi.size === 0) {
|
||||
// searching for the vdis is expensive
|
||||
// don't do it if there is nothing to find
|
||||
return
|
||||
}
|
||||
|
||||
// @todo use an index if possible
|
||||
// @todo : this seems similare to decorateVmMetadata
|
||||
const replicatedVdis = sr.$VDIs
|
||||
|
||||
const replicatedVdis = sr.$VDIs
|
||||
.filter(vdi => {
|
||||
// REPLICATED_TO_SR_UUID is not used here since we are already filtering from sr.$VDIs
|
||||
return baseUuidToSrcVdi.has(vdi?.other_config[COPY_OF])
|
||||
@@ -107,10 +103,11 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
|
||||
.filter(_ => !!_)
|
||||
// @todo use index ?
|
||||
|
||||
const replicatedVdis = sr.$VDIs.filter(vdi => {
|
||||
// REPLICATED_TO_SR_UUID is not used here since we are already filtering from sr.$VDIs
|
||||
return sourceVdiUuids.includes(vdi?.other_config[COPY_OF])
|
||||
})
|
||||
const replicatedVdis = sr.$VDIs
|
||||
.filter(vdi => {
|
||||
// REPLICATED_TO_SR_UUID is not used here since we are already filtering from sr.$VDIs
|
||||
return sourceVdiUuids.includes(vdi?.other_config[COPY_OF])
|
||||
})
|
||||
|
||||
Object.values(backup.vdis).forEach(vdi => {
|
||||
vdi.other_config[COPY_OF] = vdi.uuid
|
||||
|
||||
@@ -65,7 +65,7 @@ In case any incoherence is detected, the file is deleted so it will be fully gen
|
||||
- `xo:backup:deltaChainLength` = n (number of delta copies/replicated since a full)
|
||||
- `xo:backup:exported` = 'true' (added at the end of the backup)
|
||||
|
||||
### Of created VMs , their associated VDIs and snapshots
|
||||
### Of created VMs , their associated VDIs and snapshots
|
||||
|
||||
- `other_config`:
|
||||
- `xo:backup:datetime`: format is UTC %Y%m%dT%H:%M:%SZ
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/vatesfr/xen-orchestra.git"
|
||||
},
|
||||
"version": "0.54.3",
|
||||
"version": "0.54.0",
|
||||
"engines": {
|
||||
"node": ">=14.18"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish --access public",
|
||||
"test-integration": "node --test *.integ.mjs"
|
||||
"test-integration": "node--test *.integ.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@iarna/toml": "^2.2.5",
|
||||
@@ -23,13 +23,13 @@
|
||||
"@vates/cached-dns.lookup": "^1.0.0",
|
||||
"@vates/compose": "^2.1.0",
|
||||
"@vates/decorate-with": "^2.1.0",
|
||||
"@vates/disposable": "^0.1.6",
|
||||
"@vates/fuse-vhd": "^2.1.2",
|
||||
"@vates/nbd-client": "^3.1.2",
|
||||
"@vates/disposable": "^0.1.5",
|
||||
"@vates/fuse-vhd": "^2.1.1",
|
||||
"@vates/nbd-client": "^3.1.0",
|
||||
"@vates/parse-duration": "^0.1.1",
|
||||
"@xen-orchestra/async-map": "^0.1.2",
|
||||
"@xen-orchestra/fs": "^4.2.1",
|
||||
"@xen-orchestra/log": "^0.7.1",
|
||||
"@xen-orchestra/fs": "^4.1.7",
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"@xen-orchestra/template": "^0.1.0",
|
||||
"app-conf": "^3.0.0",
|
||||
"compare-versions": "^6.0.0",
|
||||
@@ -47,18 +47,19 @@
|
||||
"tar": "^6.1.15",
|
||||
"uuid": "^9.0.0",
|
||||
"value-matcher": "^0.2.0",
|
||||
"vhd-lib": "^4.11.1",
|
||||
"xen-api": "^4.5.0",
|
||||
"vhd-lib": "^4.11.0",
|
||||
"xen-api": "^4.3.1",
|
||||
"yazl": "^2.5.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"fs-extra": "^11.1.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"sinon": "^18.0.0",
|
||||
"test": "^3.2.1",
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@xen-orchestra/xapi": "^7.7.1"
|
||||
"@xen-orchestra/xapi": "^7.6.0"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"author": {
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"preferGlobal": true,
|
||||
"dependencies": {
|
||||
"golike-defer": "^0.5.1",
|
||||
"xen-api": "^4.5.0"
|
||||
"xen-api": "^4.3.1"
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const test = require('node:test')
|
||||
const test = require('test')
|
||||
const assert = require('assert').strict
|
||||
const sinon = require('sinon')
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const assert = require('assert').strict
|
||||
|
||||
const mapValues = require('lodash/mapValues')
|
||||
|
||||
@@ -39,9 +39,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"postversion": "npm publish",
|
||||
"test": "node --test"
|
||||
"test": "node--test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sinon": "^18.0.0"
|
||||
"sinon": "^18.0.0",
|
||||
"test": "^3.2.1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const { describe, it } = require('node:test')
|
||||
const { describe, it } = require('test')
|
||||
const assert = require('assert').strict
|
||||
|
||||
const parse = require('./parse')
|
||||
|
||||
@@ -21,7 +21,6 @@ npm install --save @xen-orchestra/defined
|
||||
Returns the first non-`undefined` value from a list of arguments, evaluating functions if needed.
|
||||
|
||||
There is two ways to use this function:
|
||||
|
||||
- either with a single array argument: it should return the first non-undefined item
|
||||
- or with multiple arguments: it should return the first non-undefined argument
|
||||
|
||||
|
||||
@@ -8,43 +8,19 @@ const { getBoundPropertyDescriptor } = require('bind-property-descriptor')
|
||||
const { getSyncedHandler } = require('./')
|
||||
|
||||
const { getPrototypeOf, ownKeys } = Reflect
|
||||
function getAllBoundDescriptors(object, thisArg = object) {
|
||||
function getAllBoundDescriptors(object) {
|
||||
const descriptors = { __proto__: null }
|
||||
let current = object
|
||||
do {
|
||||
ownKeys(current).forEach(key => {
|
||||
if (!(key in descriptors)) {
|
||||
descriptors[key] = getBoundPropertyDescriptor(current, key, thisArg)
|
||||
descriptors[key] = getBoundPropertyDescriptor(current, key, object)
|
||||
}
|
||||
})
|
||||
} while ((current = getPrototypeOf(current)) !== null)
|
||||
return descriptors
|
||||
}
|
||||
|
||||
const extraMethods = {
|
||||
__proto__: null,
|
||||
|
||||
async cat(...files) {
|
||||
const { stdout } = process
|
||||
let onStdoutError
|
||||
stdout.once('error', error => {
|
||||
onStdoutError(error)
|
||||
})
|
||||
|
||||
for (const file of files) {
|
||||
const stream = await this.createReadStream(file)
|
||||
|
||||
// don't use stream.pipeline() as it would close stdout when the first stream finishes
|
||||
await new Promise((resolve, reject) => {
|
||||
stream.once('error', reject).once('end', resolve)
|
||||
onStdoutError = reject
|
||||
|
||||
stream.pipe(stdout)
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// https://gist.github.com/julien-f/18161f6032e808d6fa08782951ce3bfb
|
||||
async function repl({ prompt, context } = {}) {
|
||||
const repl = require('repl').start({
|
||||
@@ -68,34 +44,16 @@ async function repl({ prompt, context } = {}) {
|
||||
})
|
||||
}
|
||||
|
||||
async function* main([url, ...args]) {
|
||||
async function* main([url]) {
|
||||
if (url === undefined) {
|
||||
throw new TypeError('missing arg <url>')
|
||||
}
|
||||
|
||||
const handler = yield getSyncedHandler({ url })
|
||||
|
||||
const methods = Object.create(null, getAllBoundDescriptors(handler))
|
||||
Object.defineProperties(methods, getAllBoundDescriptors(extraMethods, handler))
|
||||
|
||||
if (args.length === 0) {
|
||||
await repl({
|
||||
prompt: handler.type + '> ',
|
||||
context: methods,
|
||||
})
|
||||
} else {
|
||||
const method = args.shift()
|
||||
const fn = methods[method]
|
||||
if (fn === undefined) {
|
||||
const message = 'unknown method: ' + method
|
||||
throw message
|
||||
}
|
||||
|
||||
const result = await fn(...args)
|
||||
if (result !== undefined) {
|
||||
console.log(result)
|
||||
}
|
||||
}
|
||||
await repl({
|
||||
prompt: handler.type + '> ',
|
||||
context: Object.create(null, getAllBoundDescriptors(handler)),
|
||||
})
|
||||
}
|
||||
|
||||
Disposable.wrap(main)(process.argv.slice(2)).catch(error => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"private": false,
|
||||
"name": "@xen-orchestra/fs",
|
||||
"version": "4.2.1",
|
||||
"version": "4.1.7",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"description": "The File System for Xen Orchestra backups.",
|
||||
"homepage": "https://github.com/vatesfr/xen-orchestra/tree/master/@xen-orchestra/fs",
|
||||
@@ -29,7 +29,7 @@
|
||||
"@vates/coalesce-calls": "^0.1.0",
|
||||
"@vates/decorate-with": "^2.1.0",
|
||||
"@vates/read-chunk": "^1.2.0",
|
||||
"@xen-orchestra/log": "^0.7.1",
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"bind-property-descriptor": "^2.0.0",
|
||||
"decorator-synchronized": "^0.6.0",
|
||||
"execa": "^5.0.0",
|
||||
@@ -41,7 +41,7 @@
|
||||
"proper-lockfile": "^4.1.2",
|
||||
"readable-stream": "^4.1.0",
|
||||
"through2": "^4.0.2",
|
||||
"xo-remote-parser": "^0.9.3"
|
||||
"xo-remote-parser": "^0.9.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.0.0",
|
||||
@@ -53,6 +53,7 @@
|
||||
"dotenv": "^16.0.0",
|
||||
"rimraf": "^5.0.1",
|
||||
"sinon": "^18.0.0",
|
||||
"test": "^3.3.0",
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
"scripts": {
|
||||
@@ -62,8 +63,9 @@
|
||||
"prebuild": "yarn run clean",
|
||||
"predev": "yarn run clean",
|
||||
"prepublishOnly": "yarn run build",
|
||||
"pretest": "yarn run build",
|
||||
"postversion": "npm publish",
|
||||
"test": "cd dist && node --test"
|
||||
"test": "node--test ./dist/"
|
||||
},
|
||||
"author": {
|
||||
"name": "Vates SAS",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import { describe, it } from 'test'
|
||||
import { strict as assert } from 'assert'
|
||||
|
||||
import { Readable } from 'readable-stream'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import { describe, it } from 'test'
|
||||
import { strict as assert } from 'assert'
|
||||
|
||||
import { Readable } from 'readable-stream'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import { describe, it } from 'test'
|
||||
import { strict as assert } from 'assert'
|
||||
|
||||
import { Readable } from 'node:stream'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import { describe, it } from 'test'
|
||||
import { strict as assert } from 'assert'
|
||||
|
||||
import guessAwsRegion from './_guessAwsRegion.js'
|
||||
|
||||
@@ -99,7 +99,7 @@ export default class RemoteHandlerAbstract {
|
||||
this.closeFile = sharedLimit(this.closeFile)
|
||||
this.copy = sharedLimit(this.copy)
|
||||
this.getInfo = sharedLimit(this.getInfo)
|
||||
this.getSizeOnDisk = sharedLimit(this.getSizeOnDisk)
|
||||
this.getSize = sharedLimit(this.getSize)
|
||||
this.list = sharedLimit(this.list)
|
||||
this.mkdir = sharedLimit(this.mkdir)
|
||||
this.openFile = sharedLimit(this.openFile)
|
||||
@@ -227,15 +227,13 @@ export default class RemoteHandlerAbstract {
|
||||
return timeout.call(this._getInfo(), this._timeout)
|
||||
}
|
||||
|
||||
// returns the real size occupied by an unencrypted file
|
||||
// encrypted files have metadata and padding that blur the real size
|
||||
// when using encryption, the file size is aligned with the encryption block size ( 16 bytes )
|
||||
// that means that the size will be 1 to 16 bytes more than the content size + the initialized vector length (16 bytes)
|
||||
async getSize(file) {
|
||||
assert.strictEqual(this.isEncrypted, false, `Can't compute size of an encrypted file ${file}`)
|
||||
return this.getSizeOnDisk(file)
|
||||
}
|
||||
|
||||
async getSizeOnDisk(file) {
|
||||
return timeout.call(this._getSize(typeof file === 'string' ? normalizePath(file) : file), this._timeout)
|
||||
const size = await timeout.call(this._getSize(typeof file === 'string' ? normalizePath(file) : file), this._timeout)
|
||||
return size - this.#encryptor.ivLength
|
||||
}
|
||||
|
||||
async __list(dir, { filter, ignoreMissing = false, prependDir = false } = {}) {
|
||||
@@ -390,11 +388,6 @@ export default class RemoteHandlerAbstract {
|
||||
info('will update metadata of this remote')
|
||||
return this.#createMetadata()
|
||||
} else {
|
||||
// to add a new encrypted fs remote, the remote directory must be empty, otherwise metadata.json is not created
|
||||
if (error.code === 'ENOENT' && error.path.includes('metadata.json')) {
|
||||
throw new Error('Remote directory must be empty.')
|
||||
}
|
||||
|
||||
warn(
|
||||
`The encryptionKey settings of this remote does not match the key used to create it. You won't be able to read any data from this remote`,
|
||||
{ error }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { after, beforeEach, describe, it } from 'node:test'
|
||||
import { after, beforeEach, describe, it } from 'test'
|
||||
import { strict as assert } from 'assert'
|
||||
import sinon from 'sinon'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { after, afterEach, before, beforeEach, describe, it } from 'node:test'
|
||||
import { after, afterEach, before, beforeEach, describe, it } from 'test'
|
||||
import { strict as assert } from 'assert'
|
||||
|
||||
import 'dotenv/config'
|
||||
@@ -34,7 +34,6 @@ const rejectionOf = p =>
|
||||
reason => reason
|
||||
)
|
||||
|
||||
// TODO : add tests on encrypted remote
|
||||
const handlers = [`file://${tmpdir()}`]
|
||||
if (process.env.xo_fs_nfs) handlers.push(process.env.xo_fs_nfs)
|
||||
if (process.env.xo_fs_smb) handlers.push(process.env.xo_fs_smb)
|
||||
@@ -98,12 +97,11 @@ handlers.forEach(url => {
|
||||
})
|
||||
})
|
||||
|
||||
// TODO : add test "should throw if remote is encrypted" on #getSize()
|
||||
describe('#getSizeOnDisk()', () => {
|
||||
beforeEach(() => handler.outputFile('file', TEST_DATA))
|
||||
describe('#getSize()', () => {
|
||||
before(() => handler.outputFile('file', TEST_DATA))
|
||||
|
||||
testWithFileDescriptor('file', 'r', async () => {
|
||||
assert.equal(await handler.getSizeOnDisk('file'), TEST_DATA_LEN)
|
||||
assert.equal(await handler.getSize('file'), TEST_DATA_LEN)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -119,6 +117,7 @@ handlers.forEach(url => {
|
||||
})
|
||||
|
||||
it('throws ENOENT if no such directory', async () => {
|
||||
await handler.rmtree('dir')
|
||||
assert.equal((await rejectionOf(handler.list('dir'))).code, 'ENOENT')
|
||||
})
|
||||
|
||||
@@ -191,7 +190,7 @@ handlers.forEach(url => {
|
||||
})
|
||||
|
||||
describe('#read()', () => {
|
||||
beforeEach(() => handler.outputFile('file', TEST_DATA))
|
||||
before(() => handler.outputFile('file', TEST_DATA))
|
||||
|
||||
const start = random(TEST_DATA_LEN)
|
||||
const size = random(TEST_DATA_LEN)
|
||||
|
||||
@@ -58,7 +58,7 @@ export default class LocalHandler extends RemoteHandlerAbstract {
|
||||
constructor(remote, opts = {}) {
|
||||
super(remote)
|
||||
|
||||
this.#addSyncStackTrace = (opts.syncStackTraces ?? true) ? addSyncStackTrace : dontAddSyncStackTrace
|
||||
this.#addSyncStackTrace = opts.syncStackTraces ?? true ? addSyncStackTrace : dontAddSyncStackTrace
|
||||
this.#retriesOnEagain = {
|
||||
delay: 1e3,
|
||||
retries: 9,
|
||||
|
||||
@@ -7,8 +7,7 @@ export default class NfsHandler extends MountHandler {
|
||||
const { host, port, path } = parse(remote.url)
|
||||
super(remote, opts, {
|
||||
type: 'nfs',
|
||||
device: `${host}:${path}`,
|
||||
options: port !== undefined ? `port=${port}` : undefined,
|
||||
device: `${host}${port !== undefined ? ':' + port : ''}:${path}`,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import { describe, it } from 'test'
|
||||
import { strict as assert } from 'assert'
|
||||
|
||||
import { relativeFromFile } from './path.js'
|
||||
|
||||
@@ -17,19 +17,19 @@
|
||||
"xo-lift-remote-immutability": "./liftProtection.mjs"
|
||||
},
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"version": "1.0.13",
|
||||
"version": "1.0.12",
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vates/async-each": "^1.0.0",
|
||||
"@xen-orchestra/backups": "^0.54.3",
|
||||
"@xen-orchestra/log": "^0.7.1",
|
||||
"@xen-orchestra/backups": "^0.54.0",
|
||||
"@xen-orchestra/log": "^0.6.0",
|
||||
"app-conf": "^3.0.0",
|
||||
"chokidar": "^3.5.3",
|
||||
"execa": "^5.0.0",
|
||||
"ms": "^2.1.3",
|
||||
"vhd-lib": "^4.11.1"
|
||||
"vhd-lib": "^4.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"rimraf": "^5.0.5",
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
|
||||
## **next**
|
||||
|
||||
- [Pool/Dashboard] `Patches` and `Status` cards are displayed with a greater minimum width (PR [#8108](https://github.com/vatesfr/xen-orchestra/pull/8108))
|
||||
- [Header] Update user menu button (PR [#8109](https://github.com/vatesfr/xen-orchestra/pull/8109))
|
||||
|
||||
## **0.5.0** (2024-10-31)
|
||||
|
||||
- Handle IPv6 hosts (PR [#8044](https://github.com/vatesfr/xen-orchestra/pull/8044))
|
||||
- [XOA deploy] Configure custom NTP servers (PR [#8059](https://github.com/vatesfr/xen-orchestra/pull/8059))
|
||||
- Handle IPv6 hosts
|
||||
|
||||
## **0.4.0** (2024-09-30)
|
||||
|
||||
|
||||
@@ -7,4 +7,4 @@
|
||||
|
||||
## Guidelines
|
||||
|
||||
Please follow the guidelines from [Web Core documentation](../web-core/docs/index.md)
|
||||
Please follow the guidelines from the `@xen-orchestra/web-core/docs/guidelines` directory.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@xen-orchestra/lite",
|
||||
"version": "0.5.0",
|
||||
"version": "0.4.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "GIT_HEAD=$(git rev-parse HEAD) vite",
|
||||
@@ -26,19 +26,19 @@
|
||||
"@types/file-saver": "^2.0.7",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^18.19.7",
|
||||
"@vitejs/plugin-vue": "^5.1.4",
|
||||
"@vitejs/plugin-vue": "^5.0.3",
|
||||
"@vue/tsconfig": "^0.5.1",
|
||||
"@vueuse/core": "^10.7.1",
|
||||
"@vueuse/math": "^10.7.1",
|
||||
"@vueuse/shared": "^10.7.1",
|
||||
"@xen-orchestra/web-core": "^0.4.0",
|
||||
"@xen-orchestra/web-core": "^0.3.0",
|
||||
"complex-matcher": "^0.7.1",
|
||||
"d3-time-format": "^4.1.0",
|
||||
"decorator-synchronized": "^0.6.0",
|
||||
"echarts": "^5.4.3",
|
||||
"file-saver": "^2.0.5",
|
||||
"highlight.js": "^11.9.0",
|
||||
"human-format": "^1.2.1",
|
||||
"human-format": "^1.2.0",
|
||||
"iterable-backoff": "^0.1.0",
|
||||
"json-rpc-2.0": "^1.7.0",
|
||||
"json5": "^2.2.3",
|
||||
@@ -48,19 +48,19 @@
|
||||
"marked": "^9.1.5",
|
||||
"minimist": "^1.2.8",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"pinia": "^2.2.6",
|
||||
"pinia": "^2.1.7",
|
||||
"placement.js": "^1.0.0-beta.5",
|
||||
"postcss": "^8.4.33",
|
||||
"postcss-color-function": "^4.1.0",
|
||||
"postcss-custom-media": "^10.0.2",
|
||||
"postcss-nested": "^6.0.1",
|
||||
"typescript": "~5.6.3",
|
||||
"vite": "^5.4.10",
|
||||
"vue": "~3.5.12",
|
||||
"typescript": "~5.3.3",
|
||||
"vite": "^5.0.11",
|
||||
"vue": "~3.4.13",
|
||||
"vue-echarts": "^6.6.8",
|
||||
"vue-i18n": "^9.9.0",
|
||||
"vue-router": "^4.4.0",
|
||||
"vue-tsc": "^2.1.10",
|
||||
"vue-tsc": "^1.8.27",
|
||||
"zx": "^7.2.3"
|
||||
},
|
||||
"private": true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div v-if="!route.meta.hasStoryNav && !xenApiStore.isConnected">
|
||||
<div v-if="!$route.meta.hasStoryNav && !xenApiStore.isConnected">
|
||||
<AppLogin />
|
||||
</div>
|
||||
<div v-else>
|
||||
@@ -10,7 +10,7 @@
|
||||
<RouterView />
|
||||
</main>
|
||||
</div>
|
||||
<VtsTooltipList />
|
||||
<TooltipList />
|
||||
</div>
|
||||
<ModalList />
|
||||
</template>
|
||||
@@ -24,15 +24,12 @@ import { useChartTheme } from '@/composables/chart-theme.composable'
|
||||
import { useUnreachableHosts } from '@/composables/unreachable-hosts.composable'
|
||||
import { usePoolStore } from '@/stores/xen-api/pool.store'
|
||||
import { useXenApiStore } from '@/stores/xen-api.store'
|
||||
import VtsTooltipList from '@core/components/tooltip-list/VtsTooltipList.vue'
|
||||
import TooltipList from '@core/components/tooltip/TooltipList.vue'
|
||||
import { useUiStore } from '@core/stores/ui.store'
|
||||
import { useActiveElement, useMagicKeys, whenever } from '@vueuse/core'
|
||||
import { logicAnd } from '@vueuse/math'
|
||||
import { computed } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const xenApiStore = useXenApiStore()
|
||||
|
||||
|
||||
91
@xen-orchestra/lite/src/components/AccountButton.vue
Normal file
91
@xen-orchestra/lite/src/components/AccountButton.vue
Normal file
@@ -0,0 +1,91 @@
|
||||
<template>
|
||||
<MenuList placement="bottom-end" border>
|
||||
<template #trigger="{ open, isOpen }">
|
||||
<button type="button" :class="{ active: isOpen }" class="account-button" @click="open">
|
||||
<UiIcon :icon="faCircleUser" class="user-icon" />
|
||||
<UiIcon :icon="faAngleDown" class="dropdown-icon" />
|
||||
</button>
|
||||
</template>
|
||||
<MenuItem :icon="faGear" @click="openSettings">{{ $t('settings') }}</MenuItem>
|
||||
<MenuItem :icon="faMessage" @click="openFeedbackUrl">
|
||||
{{ $t('send-us-feedback') }}
|
||||
</MenuItem>
|
||||
<MenuItem :icon="faArrowRightFromBracket" class="menu-item-logout" @click="logout">
|
||||
{{ $t('log-out') }}
|
||||
</MenuItem>
|
||||
</MenuList>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import UiIcon from '@/components/ui/icon/UiIcon.vue'
|
||||
import { useXenApiStore } from '@/stores/xen-api.store'
|
||||
import MenuItem from '@core/components/menu/MenuItem.vue'
|
||||
import MenuList from '@core/components/menu/MenuList.vue'
|
||||
import {
|
||||
faAngleDown,
|
||||
faArrowRightFromBracket,
|
||||
faCircleUser,
|
||||
faGear,
|
||||
faMessage,
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
import { nextTick } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const logout = () => {
|
||||
const xenApiStore = useXenApiStore()
|
||||
xenApiStore.disconnect()
|
||||
nextTick(() => router.push({ name: 'home' }))
|
||||
}
|
||||
|
||||
const openFeedbackUrl = () => {
|
||||
window.open('https://xcp-ng.org/forum/topic/4731/xen-orchestra-lite', '_blank', 'noopener')
|
||||
}
|
||||
|
||||
const openSettings = () => router.push({ name: 'settings' })
|
||||
</script>
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.account-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 1rem;
|
||||
color: var(--color-neutral-txt-primary);
|
||||
border: none;
|
||||
border-radius: 0.8rem;
|
||||
background-color: var(--color-neutral-background-secondary);
|
||||
gap: 0.8rem;
|
||||
|
||||
&:disabled {
|
||||
color: var(--color-neutral-border);
|
||||
}
|
||||
|
||||
&:not(:disabled) {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover,
|
||||
&:active,
|
||||
&.active {
|
||||
background-color: var(--color-neutral-background-primary);
|
||||
}
|
||||
|
||||
&:active,
|
||||
&.active {
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.user-icon {
|
||||
font-size: 2.4rem;
|
||||
}
|
||||
|
||||
.dropdown-icon {
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
|
||||
.menu-item-logout {
|
||||
color: var(--color-danger-txt-base);
|
||||
}
|
||||
</style>
|
||||
@@ -9,13 +9,13 @@
|
||||
<div class="right">
|
||||
<PoolOverrideWarning as-tooltip />
|
||||
<XoaButton v-if="isDesktop" />
|
||||
<AccountMenu />
|
||||
<AccountButton />
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import AccountMenu from '@/components/account-menu/AccountMenu.vue'
|
||||
import AccountButton from '@/components/AccountButton.vue'
|
||||
import PoolOverrideWarning from '@/components/PoolOverrideWarning.vue'
|
||||
import TextLogo from '@/components/TextLogo.vue'
|
||||
import UiIcon from '@/components/ui/icon/UiIcon.vue'
|
||||
@@ -37,7 +37,7 @@ const { trigger: navigationTrigger } = storeToRefs(navigationStore)
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 5.6rem;
|
||||
height: 5.5rem;
|
||||
padding: 1rem;
|
||||
border-bottom: 0.1rem solid var(--color-neutral-border);
|
||||
background-color: var(--color-neutral-background-secondary);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<FormCheckbox v-model="rememberMe" />
|
||||
{{ $t('keep-me-logged') }}
|
||||
</label>
|
||||
<UiButton size="medium" accent="info" variant="primary" type="submit" :busy="isConnecting">
|
||||
<UiButton size="medium" color="normal" level="primary" type="submit" :busy="isConnecting">
|
||||
{{ $t('login') }}
|
||||
</UiButton>
|
||||
</template>
|
||||
@@ -45,7 +45,7 @@ import UiIcon from '@/components/ui/icon/UiIcon.vue'
|
||||
import type { XenApiError } from '@/libs/xen-api/xen-api.types'
|
||||
import { usePageTitleStore } from '@/stores/page-title.store'
|
||||
import { useXenApiStore } from '@/stores/xen-api.store'
|
||||
import UiButton from '@core/components/ui/button/UiButton.vue'
|
||||
import UiButton from '@core/components/button/UiButton.vue'
|
||||
import { faExclamationCircle } from '@fortawesome/free-solid-svg-icons'
|
||||
import { useLocalStorage, whenever } from '@vueuse/core'
|
||||
import { storeToRefs } from 'pinia'
|
||||
|
||||
@@ -60,7 +60,7 @@ useEventListener(
|
||||
}
|
||||
|
||||
code:not(.hljs-code) {
|
||||
background-color: var(--color-info-background-selected);
|
||||
background-color: var(--color-normal-background-selected);
|
||||
padding: 0.3rem 0.6rem;
|
||||
border-radius: 0.6rem;
|
||||
}
|
||||
@@ -103,11 +103,11 @@ useEventListener(
|
||||
background-color: transparent;
|
||||
|
||||
&:hover {
|
||||
color: var(--color-info-txt-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
|
||||
&:active {
|
||||
color: var(--color-info-txt-hover);
|
||||
color: var(--color-normal-txt-hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<Transition name="slide">
|
||||
<nav v-if="isDesktop || isOpen" ref="navElement" :class="{ collapsible: isMobile }" class="app-navigation">
|
||||
<StoryMenu v-if="route.meta.hasStoryNav" />
|
||||
<StoryMenu v-if="$route.meta.hasStoryNav" />
|
||||
<InfraPoolList v-else />
|
||||
</nav>
|
||||
</Transition>
|
||||
@@ -15,9 +15,6 @@ import { useUiStore } from '@core/stores/ui.store'
|
||||
import { onClickOutside, whenever } from '@vueuse/core'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const uiStore = useUiStore()
|
||||
const { isMobile, isDesktop } = storeToRefs(uiStore)
|
||||
@@ -61,7 +58,6 @@ whenever(isOpen, () => {
|
||||
.slide-leave-active {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.slide-enter-from,
|
||||
.slide-leave-to {
|
||||
transform: translateX(-37rem);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<label class="form-widget">
|
||||
<span v-if="label || slots.label" class="label">
|
||||
<span v-if="label || $slots.label" class="label">
|
||||
<slot name="label">
|
||||
{{ label }}
|
||||
</slot>
|
||||
</span>
|
||||
<span class="widget">
|
||||
<span v-if="before || slots.before" class="before">
|
||||
<span v-if="before || $slots.before" class="before">
|
||||
<slot name="before">
|
||||
<UiIcon v-if="isIcon(before)" :icon="before" fixed-width />
|
||||
<template v-else>{{ before }}</template>
|
||||
@@ -15,7 +15,7 @@
|
||||
<span class="element">
|
||||
<slot />
|
||||
</span>
|
||||
<span v-if="after || slots.after" class="after">
|
||||
<span v-if="after || $slots.after" class="after">
|
||||
<slot name="after">
|
||||
<UiIcon v-if="isIcon(after)" :icon="after" fixed-width />
|
||||
<template v-else>{{ after }}</template>
|
||||
@@ -36,13 +36,6 @@ defineProps<{
|
||||
inline?: boolean
|
||||
}>()
|
||||
|
||||
const slots = defineSlots<{
|
||||
default(): any
|
||||
label?(): any
|
||||
before?(): any
|
||||
after?(): any
|
||||
}>()
|
||||
|
||||
const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon === 'object'
|
||||
</script>
|
||||
|
||||
@@ -68,7 +61,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
|
||||
gap: 0.1rem;
|
||||
|
||||
&:focus-within {
|
||||
outline: 1px solid var(--color-info-item-active);
|
||||
outline: 1px solid var(--color-normal-item-active);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +71,7 @@ const isIcon = (maybeIcon: any): maybeIcon is IconDefinition => typeof maybeIcon
|
||||
}
|
||||
|
||||
.form-widget:hover .widget {
|
||||
border-color: var(--color-info-item-hover);
|
||||
border-color: var(--color-normal-item-hover);
|
||||
}
|
||||
|
||||
.element {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</th>
|
||||
<td v-if="hasMultipleHosts">
|
||||
<UiSpinner v-if="!areAllLoaded" />
|
||||
<UiCounter
|
||||
<VtsCounter
|
||||
v-else
|
||||
v-tooltip="{
|
||||
placement: 'left',
|
||||
@@ -33,7 +33,7 @@ import UiCardSpinner from '@/components/ui/UiCardSpinner.vue'
|
||||
import UiSpinner from '@/components/ui/UiSpinner.vue'
|
||||
import UiTable from '@/components/ui/UiTable.vue'
|
||||
import type { XenApiPatchWithHostRefs } from '@/composables/host-patches.composable'
|
||||
import UiCounter from '@core/components/ui/counter/UiCounter.vue'
|
||||
import VtsCounter from '@core/components/counter/VtsCounter.vue'
|
||||
import { vTooltip } from '@core/directives/tooltip.directive'
|
||||
import { useUiStore } from '@core/stores/ui.store'
|
||||
import { computed } from 'vue'
|
||||
|
||||
@@ -27,6 +27,6 @@
|
||||
font-weight: 500;
|
||||
font-size: 2rem;
|
||||
line-height: 150%;
|
||||
color: var(--color-info-txt-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -33,7 +33,7 @@ const isRecordNotFound = computed(() => props.isReady && !props.uuidChecker(id.v
|
||||
}
|
||||
|
||||
.spinner {
|
||||
color: var(--color-info-txt-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
display: flex;
|
||||
margin: auto;
|
||||
width: 10rem;
|
||||
|
||||
@@ -26,7 +26,7 @@ const className = computed(() => `state-${props.state.toLocaleLowerCase()}`)
|
||||
|
||||
<style lang="postcss" scoped>
|
||||
.power-state-icon {
|
||||
color: var(--color-info-txt-item);
|
||||
color: var(--color-normal-txt-item);
|
||||
|
||||
&.state-running {
|
||||
color: var(--color-success-item-base);
|
||||
@@ -37,7 +37,7 @@ const className = computed(() => `state-${props.state.toLocaleLowerCase()}`)
|
||||
}
|
||||
|
||||
&.state-suspended {
|
||||
color: var(--color-info-txt-hover);
|
||||
color: var(--color-normal-txt-hover);
|
||||
}
|
||||
|
||||
&.state-halted {
|
||||
|
||||
@@ -36,7 +36,7 @@ defineProps<{
|
||||
|
||||
.icon {
|
||||
font-size: 2.5rem;
|
||||
color: var(--color-info-txt-base);
|
||||
color: var(--color-normal-txt-base);
|
||||
}
|
||||
|
||||
.title {
|
||||
|
||||
@@ -60,20 +60,20 @@ const computedData = computed(() => {
|
||||
}
|
||||
|
||||
.progress-item:nth-child(1) {
|
||||
--progress-bar-color: var(--color-info-txt-item);
|
||||
--progress-bar-color: var(--color-normal-txt-item);
|
||||
}
|
||||
|
||||
.progress-item:nth-child(2) {
|
||||
--progress-bar-color: var(--color-info-txt-active);
|
||||
--progress-bar-color: var(--color-normal-txt-active);
|
||||
}
|
||||
|
||||
.progress-item:nth-child(3) {
|
||||
--progress-bar-color: var(--color-info-txt-hover);
|
||||
--progress-bar-color: var(--color-normal-txt-hover);
|
||||
}
|
||||
|
||||
.progress-item {
|
||||
--progress-bar-height: 1.2rem;
|
||||
--progress-bar-color: var(--color-info-item-hover);
|
||||
--progress-bar-color: var(--color-normal-item-hover);
|
||||
--progress-bar-background-color: var(--color-neutral-background-disabled);
|
||||
|
||||
&.warning {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<UiButton
|
||||
v-if="xoaFound"
|
||||
size="medium"
|
||||
accent="info"
|
||||
variant="primary"
|
||||
color="normal"
|
||||
level="primary"
|
||||
:left-icon="faArrowUpRightFromSquare"
|
||||
class="xoa-button"
|
||||
@click="openXoa()"
|
||||
@@ -13,8 +13,8 @@
|
||||
<UiButton
|
||||
v-else
|
||||
size="medium"
|
||||
accent="info"
|
||||
variant="primary"
|
||||
color="normal"
|
||||
level="primary"
|
||||
:left-icon="faDownload"
|
||||
class="xoa-button"
|
||||
@click="openXoaDeploy()"
|
||||
@@ -26,7 +26,7 @@
|
||||
<script lang="ts" setup>
|
||||
import type { PRIMARY_ADDRESS_TYPE } from '@/libs/xen-api/xen-api.enums'
|
||||
import { usePoolStore } from '@/stores/xen-api/pool.store'
|
||||
import UiButton from '@core/components/ui/button/UiButton.vue'
|
||||
import UiButton from '@core/components/button/UiButton.vue'
|
||||
import { faDownload, faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user