Compare commits

..

2 Commits

Author SHA1 Message Date
Florent BEAUCHAMP
f60b69db60 improve performances 2026-02-26 09:12:11 +00:00
Florent BEAUCHAMP
0c98f0aeb9 feat(dedup): v3 use hashed disks 2026-02-26 09:12:10 +00:00
64 changed files with 496 additions and 968 deletions

View File

@@ -44,7 +44,7 @@ const IMMUTABILITY_METADATA_FILENAME = '/immutability.json'
const { debug, warn } = createLogger('xo:backups:RemoteAdapter')
export const compareTimestamp = (a, b) => a.timestamp - b.timestamp
const compareTimestamp = (a, b) => a.timestamp - b.timestamp
const noop = Function.prototype

View File

@@ -2,11 +2,10 @@ import { AbstractRemote } from './_AbstractRemote.mjs'
import { FullRemoteWriter } from '../_writers/FullRemoteWriter.mjs'
import { forkStreamUnpipe } from '../_forkStreamUnpipe.mjs'
import { watchStreamSize } from '../../_watchStreamSize.mjs'
import { AggregatedFullRemoteWriter } from '../_writers/AggregatedFullRemoteWriter.mjs'
export const FullRemote = class FullRemoteVmBackupRunner extends AbstractRemote {
_getRemoteWriters() {
return [FullRemoteWriter, AggregatedFullRemoteWriter]
_getRemoteWriter() {
return FullRemoteWriter
}
_filterTransferList(transferList) {

View File

@@ -5,14 +5,12 @@ import { FullRemoteWriter } from '../_writers/FullRemoteWriter.mjs'
import { FullXapiWriter } from '../_writers/FullXapiWriter.mjs'
import { watchStreamSize } from '../../_watchStreamSize.mjs'
import { AbstractXapi } from './_AbstractXapi.mjs'
import { AggregatedFullRemoteWriter } from '../_writers/AggregatedFullRemoteWriter.mjs'
import { AggregatedFullXapiWriter } from '../_writers/AggregatedFullXapiWriter.mjs'
const { debug } = createLogger('xo:backups:FullXapiVmBackup')
export const FullXapi = class FullXapiVmBackupRunner extends AbstractXapi {
_getWriters() {
return [FullRemoteWriter, FullXapiWriter, AggregatedFullRemoteWriter, AggregatedFullXapiWriter]
return [FullRemoteWriter, FullXapiWriter]
}
async _mustDoSnapshot() {

View File

@@ -11,12 +11,11 @@ import { Disposable } from 'promise-toolbox'
import { openVhd } from 'vhd-lib'
import { getVmBackupDir } from '../../_getVmBackupDir.mjs'
import { SynchronizedDisk, ThrottledDisk } from '@xen-orchestra/disk-transform'
import { AggregatedIncrementalRemoteWriter } from '../_writers/AggregatedIncrementalRemoteWriter.mjs'
const { warn } = createLogger('xo:backups:Incrementalremote')
class IncrementalRemoteVmBackupRunner extends AbstractRemote {
_getRemoteWriters() {
return [IncrementalRemoteWriter, AggregatedIncrementalRemoteWriter]
_getRemoteWriter() {
return IncrementalRemoteWriter
}
// we'll transfer the full list if at least one backup should be transferred

View File

@@ -15,19 +15,12 @@ import {
markExportSuccessfull,
} from '../../_otherConfig.mjs'
import { ThrottledDisk, SynchronizedDisk } from '@xen-orchestra/disk-transform'
import { AggregatedIncrementalRemoteWriter } from '../_writers/AggregatedIncrementalRemoteWriter.mjs'
import { AggregatedIncrementalXapiWriter } from '../_writers/AggregatedIncrementalXapiWriter.mjs'
const { debug } = createLogger('xo:backups:IncrementalXapiVmBackup')
export const IncrementalXapi = class IncrementalXapiVmBackupRunner extends AbstractXapi {
_getWriters() {
return [
IncrementalRemoteWriter,
IncrementalXapiWriter,
AggregatedIncrementalRemoteWriter,
AggregatedIncrementalXapiWriter,
]
return [IncrementalRemoteWriter, IncrementalXapiWriter]
}
async _mustDoSnapshot() {

View File

@@ -45,41 +45,26 @@ export const AbstractRemote = class AbstractRemoteVmBackupRunner extends Abstrac
const writers = new Set()
this._writers = writers
const [BackupWriter, AggregratedBackupWriter] = this._getRemoteWriters()
if (settings.distributeBackups) {
const RemoteWriter = this._getRemoteWriter()
extractIdsFromSimplePattern(job.remotes).forEach(remoteId => {
const adapter = remoteAdapters[remoteId]
const targetSettings = {
...settings,
...allSettings[remoteId],
}
writers.add(
new AggregratedBackupWriter({
adapters: remoteAdapters,
BackupWriter,
new RemoteWriter({
adapter,
config,
healthCheckSr,
job,
scheduleId: schedule.id,
vmUuid,
settings,
remoteId,
settings: targetSettings,
})
)
} else {
extractIdsFromSimplePattern(job.remotes).forEach(remoteId => {
const adapter = remoteAdapters[remoteId]
const targetSettings = {
...settings,
...allSettings[remoteId],
}
writers.add(
new BackupWriter({
adapter,
config,
healthCheckSr,
job,
scheduleId: schedule.id,
vmUuid,
remoteId,
settings: targetSettings,
})
)
})
}
})
const { filter } = job
if (filter === undefined) {
this._filterPredicate = () => true

View File

@@ -82,84 +82,48 @@ export const AbstractXapi = class AbstractXapiVmBackupRunner extends Abstract {
const writers = new Set()
this._writers = writers
const [BackupWriter, ReplicationWriter, AggregratedBackupWriter, AggregratedReplicationWriter] =
this._getWriters()
const [BackupWriter, ReplicationWriter] = this._getWriters()
const allSettings = job.settings
if (settings.exportRetention > 0) {
if (settings.distributeBackups) {
Object.entries(remoteAdapters).forEach(([remoteId, adapter]) => {
const targetSettings = {
...settings,
...allSettings[remoteId],
}
if (targetSettings.exportRetention !== 0) {
writers.add(
new AggregratedBackupWriter({
adapters: remoteAdapters,
BackupWriter,
new BackupWriter({
adapter,
config,
healthCheckSr,
job,
scheduleId: schedule.id,
vmUuid: vm.uuid,
settings,
remoteId,
settings: targetSettings,
})
)
} else {
Object.entries(remoteAdapters).forEach(([remoteId, adapter]) => {
const targetSettings = {
...settings,
...allSettings[remoteId],
}
if (targetSettings.exportRetention !== 0) {
writers.add(
new BackupWriter({
adapter,
config,
healthCheckSr,
job,
scheduleId: schedule.id,
vmUuid: vm.uuid,
remoteId,
settings: targetSettings,
})
)
}
})
}
}
if (settings.copyRetention) {
if (settings.distributeReplications) {
})
srs.forEach(sr => {
const targetSettings = {
...settings,
...allSettings[sr.uuid],
}
if (targetSettings.copyRetention !== 0) {
writers.add(
new AggregratedReplicationWriter({
new ReplicationWriter({
config,
healthCheckSr,
job,
ReplicationWriter,
scheduleId: schedule.id,
vmUuid: vm.uuid,
srs,
settings,
sr,
settings: targetSettings,
})
)
} else {
srs.forEach(sr => {
const targetSettings = {
...settings,
...allSettings[sr.uuid],
}
if (targetSettings.copyRetention !== 0) {
writers.add(
new ReplicationWriter({
config,
healthCheckSr,
job,
scheduleId: schedule.id,
vmUuid: vm.uuid,
sr,
settings: targetSettings,
})
)
}
})
}
}
})
}
}

View File

@@ -1,38 +0,0 @@
import { AbstractAggregatedRemoteWriter } from './_AbstractAggregatedRemoteWriter.mjs'
export class AggregatedFullRemoteWriter extends AbstractAggregatedRemoteWriter {
async deleteOldBackupsOnAdapter(adapter, backups) {
await adapter.deleteFullVmBackups(backups)
}
// take the lock on every adapters with this VM
// cleanup if deleteFirst is selected
async beforeBackup() {
await this.setupWriters()
await Promise.all(this.writers.map(writer => writer.beforeBackup()))
await this.setOldBackups()
if (this.props.settings.deleteFirst) {
await this.deleteOldBackups()
}
}
async run(props) {
const mainAdapter = await this.computeAdapterCandidate()
this.mainWriter = this.getWriterByAdapter(mainAdapter)
return this.mainWriter.run(props)
}
// cleanup if deleteFirst is NOT selected
// release the lock on every adapters with this VM
async afterBackup() {
if (!this.props.settings.deleteFirst) {
await this.deleteOldBackups()
}
await Promise.all(this.writers.map(writer => writer.afterBackup()))
}
healthCheck() {
return this.mainWriter.healthCheck()
}
}

View File

@@ -1,31 +0,0 @@
import { AbstractAggregatedXapiWriter } from './_AbstractAggregatedXapiWriter.mjs'
export class AggregatedFullXapiWriter extends AbstractAggregatedXapiWriter {
// delete replica if deleteFirst is selected
async beforeBackup() {
await this.setupWriters()
await Promise.all(this.writers.map(writer => writer.beforeBackup()))
this.setOldReplicaList()
if (this.props.settings.deleteFirst) {
await this.deleteOldReplicas()
}
}
async run(props) {
const mainSr = await this.computeSRCandidate()
this.mainWriter = this.getWriterBySr(mainSr)
await this.mainWriter.run(props)
}
// delete replica if not using deleteFirst
async afterBackup() {
if (!this.props.settings.deleteFirst) {
await this.deleteOldReplicas()
}
await Promise.all(this.writers.map(writer => writer.afterBackup()))
}
healthCheck() {
return this.mainWriter.healthCheck()
}
}

View File

@@ -1,78 +0,0 @@
import { AbstractAggregatedRemoteWriter } from './_AbstractAggregatedRemoteWriter.mjs'
export class AggregatedIncrementalRemoteWriter extends AbstractAggregatedRemoteWriter {
async deleteOldBackupsOnAdapter(adapter, backups) {
await adapter.deleteDeltaVmBackups(backups)
}
/**
*
* @param {Map<string,string>} baseUuidToSrcVdi
*/
async checkBaseVdis(baseUuidToSrcVdi) {
let selectedCopy = new Map()
for (const writer of this.writers) {
const copy = new Map(baseUuidToSrcVdi)
await writer.checkBaseVdis(copy)
if (copy.size > 0) {
// there can be multiple candidates
// we use the last one in this case
this.mainWriter = writer
selectedCopy = copy
}
}
// update the parameter with our best candidate
// that can be an empty map
baseUuidToSrcVdi.forEach(key => {
if (!selectedCopy.has(key)) {
baseUuidToSrcVdi.delete(key)
}
})
}
// take the lock on every adapters with this VM
// cleanup if deleteFirst is selected
async beforeBackup() {
await this.setupWriters()
await Promise.all(this.writers.map(writer => writer.beforeBackup()))
await this.setOldBackups()
if (this.props.settings.deleteFirst) {
await this.deleteOldBackups()
}
}
async prepare({ isFull }) {
if (this.mainWriter === undefined) {
// use the remote with the most empty space for starting a new chain
const mainAdapter = await this.computeAdapterCandidate()
this.mainWriter = this.getWriterByAdapter(mainAdapter)
}
await Promise.all(this.writers.map(writer => writer.prepare({ isFull })))
}
// write only on the main writer
transfer({ isVhdDifferencing, timestamp, deltaExport, vm, vmSnapshot }) {
return this.mainWriter.transfer({ isVhdDifferencing, timestamp, deltaExport, vm, vmSnapshot })
}
// chain only on the main writer
updateUuidAndChain({ isVhdDifferencing, vdis }) {
return this.mainWriter.updateUuidAndChain({ isVhdDifferencing, vdis })
}
// remove the backups and remove the entries
async cleanup() {
if (!this.props.settings.deleteFirst) {
await this.deleteOldBackups()
}
await Promise.all(this.writers.map(writer => writer.cleanup()))
}
// cleanVM on all, since we may want to delete a chani
// that is not on the main writer
async afterBackup() {
await Promise.all(this.writers.map(writer => writer.afterBackup()))
}
healthCheck() {
return this.mainWriter.healthCheck()
}
}

View File

@@ -1,85 +0,0 @@
import { AbstractAggregatedXapiWriter } from './_AbstractAggregatedXapiWriter.mjs'
import { createLogger } from '@xen-orchestra/log'
const { debug } = createLogger('xo:backups:AggregatedIncrementalXapiWriter')
export class AggregatedIncrementalXapiWriter extends AbstractAggregatedXapiWriter {
/**
*
* @param {Map<string,string>} baseUuidToSrcVdi
*/
async checkBaseVdis(baseUuidToSrcVdi) {
debug('checkBaseVdis', { baseUuidToSrcVdi })
let selectedCopy = new Map()
for (const writer of this.writers) {
const copy = new Map(baseUuidToSrcVdi)
await writer.checkBaseVdis(copy)
if (copy.size > 0) {
debug('checkBaseVdis found a mainwriter candidate ', writer._sr.name_label)
// there can be multiple candidates
// we use the last one in this case
this.mainWriter = writer
selectedCopy = copy
} else {
debug(writer._sr.name_label, 'is not a delta candidate')
}
}
// update the parameter with our best candidate
// that can be an empty map
baseUuidToSrcVdi.forEach(key => {
if (!selectedCopy.has(key)) {
baseUuidToSrcVdi.delete(key)
}
})
debug('checkBaseVdis', { baseUuidToSrcVdi })
}
// take the lock on every adapters with this VM
// cleanup if deleteFirst is selected
async beforeBackup() {
await this.setupWriters()
await Promise.all(this.writers.map(writer => writer.beforeBackup()))
this.setOldReplicaList()
if (this.props.settings.deleteFirst) {
await this.deleteOldReplicas()
}
}
async prepare(args) {
if (this.mainWriter === undefined) {
debug('no mainwriter found, fallback to a new SR')
// use the SR with the most empty space for starting a new chain
const mainSr = await this.computeSRCandidate()
this.mainWriter = this.getWriterBySr(mainSr)
}
await Promise.all(this.writers.map(writer => writer.prepare(args)))
}
// write only on the main writer
transfer(args) {
return this.mainWriter.transfer(args)
}
// chain only on the main writer
updateUuidAndChain(args) {
return this.mainWriter.updateUuidAndChain(args)
}
// remove the backups and remove the entries
async cleanup() {
debug('cleanup')
if (!this.props.settings.deleteFirst) {
await this.deleteOldReplicas()
}
await Promise.all(this.writers.map(writer => writer.cleanup()))
}
// cleanVM on all, since we may want to delete a chani
// that is not on the main writer
async afterBackup() {
await Promise.all(this.writers.map(writer => writer.afterBackup()))
}
healthCheck() {
return this.mainWriter.healthCheck()
}
}

View File

@@ -59,8 +59,8 @@ export class FullRemoteWriter extends MixinRemoteWriter(AbstractFullWriter) {
xva: './' + dataBasename,
}
const { skipDeleteOldEntries, deleteFirst } = settings
if (!skipDeleteOldEntries && deleteFirst) {
const { deleteFirst } = settings
if (deleteFirst) {
await deleteOldBackups()
}
@@ -76,7 +76,7 @@ export class FullRemoteWriter extends MixinRemoteWriter(AbstractFullWriter) {
metadata.tags = await this.getLongTermRetentionTags(metadata)
this._metadataFileName = await adapter.writeVmBackupMetadata(vm.uuid, metadata)
if (!skipDeleteOldEntries && !deleteFirst) {
if (!deleteFirst) {
await deleteOldBackups()
}

View File

@@ -46,8 +46,8 @@ export class FullXapiWriter extends MixinXapiWriter(AbstractFullWriter) {
const oldVms = getOldEntries(settings.copyRetention - 1, listReplicatedVms(xapi, scheduleId, srUuid, vm.uuid))
const deleteOldBackups = () => asyncMapSettled(oldVms, vm => xapi.VM_destroy(vm.$ref))
const { deleteFirst, skipDeleteOldEntries, _warmMigration } = settings
if (!skipDeleteOldEntries && deleteFirst) {
const { deleteFirst, _warmMigration } = settings
if (deleteFirst) {
await deleteOldBackups()
}
@@ -85,7 +85,7 @@ export class FullXapiWriter extends MixinXapiWriter(AbstractFullWriter) {
}),
])
if (!skipDeleteOldEntries && !deleteFirst) {
if (!deleteFirst) {
await deleteOldBackups()
}
}

View File

@@ -114,13 +114,13 @@ export class IncrementalRemoteWriter extends MixinRemoteWriter(AbstractIncrement
oldEntries.length = maxMergedDeltasPerRun
}
if (settings.deleteFirst && !settings.skipDeleteOldEntries) {
if (settings.deleteFirst) {
await this._deleteOldEntries()
}
}
async cleanup() {
if (!this._settings.deleteFirst && !this._settings.skipDeleteOldEntries) {
if (!this._settings.deleteFirst) {
await this._deleteOldEntries()
}
}

View File

@@ -83,7 +83,7 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
this._oldEntries = getOldEntries(settings.copyRetention - 1, listReplicatedVms(xapi, scheduleId, srUuid, vmUuid))
if (settings.deleteFirst && settings.skipDeleteOldEntries) {
if (settings.deleteFirst) {
// we want to keep the baseVM when copying a delta
// even if we want to keep only one after
let mostRecentEntry
@@ -96,9 +96,7 @@ export class IncrementalXapiWriter extends MixinXapiWriter(AbstractIncrementalWr
}
async cleanup() {
if (!this._settings.skipDeleteOldEntries) {
await this._deleteOldEntries()
}
await this._deleteOldEntries()
}
async _deleteOldEntries() {

View File

@@ -1,157 +0,0 @@
import { asyncEach } from '@vates/async-each'
import { getOldEntries } from '../../_getOldEntries.mjs'
import { compareTimestamp } from '../../RemoteAdapter.mjs'
import { createLogger } from '@xen-orchestra/log'
const { debug } = createLogger('xo:backups:AbstractAggregatedRemoteWriter')
export const DEFAULT_AGGREGATED_REMOTE_DELETE_CONCURRENCY = 2
export class AbstractAggregatedRemoteWriter {
#BackupWriter
#adapters
get adapters() {
return this.#adapters
}
mainWriter
#props
get props() {
return this.#props
}
#oldBackups
#writers = []
get writers() {
return this.#writers
}
constructor({ adapters, BackupWriter, ...props }) {
debug('instantiate AggregatedFullRemoteWriter')
if (Object.keys(adapters).length < 1) {
throw new Error('AggregatedRemoteWriter need at least one backup repository to work ')
}
this.#props = props
this.#adapters = adapters
this.#BackupWriter = BackupWriter
}
getWriterByAdapter(adapter) {
for (const writer of this.#writers) {
if (writer._adapter === adapter) {
return writer
}
}
throw new Error("Can't find writer for adapter")
}
/**
* select the best adapter candidate to write this backup
* if all the adapter infos expose an available info use the one with the more free space
* if none of the adapter exposes this info : choose at random
* if mixed : throw an error
* @returns {RemoteAdapter}
*/
async computeAdapterCandidate() {
const adapters = Object.values(this.#adapters)
const infos = await Promise.all(
adapters.map(async adapter => {
const infos = await adapter._handler.getInfo()
return { adapter, infos }
})
)
const withLimit = infos.filter(({ infos: { available } }) => available > 0).length
if (withLimit !== 0 && withLimit !== infos.length) {
throw new Error(`an Aggregate remote can't use a mix of limited and unlimited storages`)
}
let candidates
if (withLimit === 0) {
debug('no storage limit , choose at random')
candidates = Object.values(this.adapters)
} else {
debug('storage limit , choose at random between those with the max space avilable')
let maxSpace = 0
infos.forEach(({ infos: { available } }) => {
if (available > maxSpace) {
maxSpace = available
}
})
// candidates are the adapter with the same free space , equal to the max free space
candidates = infos.filter(({ infos }) => infos.available === maxSpace).map(({ adapter }) => adapter)
}
const adapterCandidate = candidates[Math.floor(Math.random() * candidates.length)]
debug('adapter candidate is selected ', adapterCandidate._handler._remote.id)
return adapterCandidate
}
async setupWriters() {
debug('Setup writers ')
const settings = this.#props.settings
const allSettings = this.#props.job.settings
Object.entries(this.#adapters).forEach(([remoteId, adapter]) => {
const targetSettings = {
...settings,
...allSettings[remoteId],
skipDeleteOldEntries: true, // delete is handled globally
}
if (targetSettings.exportRetention !== 0) {
const writer = new this.#BackupWriter({
...this.#props,
adapter,
remoteId,
settings: targetSettings,
})
this.#writers.push(writer)
}
})
}
async getEntriesPerAdapter(adapter) {
const scheduleId = this.#props.scheduleId
const vmUuid = this.#props.vmUuid
return (await adapter.listVmBackups(vmUuid, _ => _.scheduleId === scheduleId)).map(entry => ({
...entry,
adapter,
}))
}
async setOldBackups() {
const entriesPerAdapter = await Promise.all(
Object.values(this.#adapters).map(adapter => this.getEntriesPerAdapter(adapter))
)
const entries = entriesPerAdapter
.flat(1)
.filter(_ => !!_)
.sort(compareTimestamp)
const settings = this.#props.settings
this.#oldBackups = getOldEntries(settings.exportRetention - 1, entries, {
longTermRetention: settings.longTermRetention,
timezone: settings.timezone,
})
debug(`got ${this.#oldBackups.length} old backup(s) to delete `)
}
async deleteOldBackupsOnAdapter(adapter, backup) {
throw new Error('not implemented')
}
async deleteOldBackups() {
const byAdapters = new Map()
this.#oldBackups.forEach(({ adapter, ...backup }) => {
const current = byAdapters.has(adapter) ? byAdapters.get(adapter) : []
current.push(backup)
byAdapters.set(adapter, current)
})
await asyncEach(
byAdapters.entries(),
async ([adapter, backups]) => {
debug(`delete ${backups.length} old backup(s) to delete from ${adapter._handler._remote.id}`)
await this.deleteOldBackupsOnAdapter(adapter, backups)
},
{
concurrency: this.#props.deleteConcurrency ?? DEFAULT_AGGREGATED_REMOTE_DELETE_CONCURRENCY,
}
)
}
}

View File

@@ -1,114 +0,0 @@
import { getOldEntries } from '../../_getOldEntries.mjs'
import { createLogger } from '@xen-orchestra/log'
import { compareReplicatedVmDatetime, listReplicatedVms } from './_listReplicatedVms.mjs'
import { asyncMapSettled } from '@xen-orchestra/async-map'
const { debug } = createLogger('xo:backups:AbstractAggregatedXapiWriter')
export class AbstractAggregatedXapiWriter {
#ReplicationWriter
#storageRepositories
#writers = []
get writers() {
return this.#writers
}
mainWriter
#props
get props() {
return this.#props
}
#oldVmReplicaList = []
constructor({ srs, ReplicationWriter, ...props }) {
debug('instantiate AbstractAggregatedXapiWriter')
if (srs.length < 1) {
throw new Error('AggregatedXapiWriter need at least one storage repository to work ')
}
this.#props = props
this.#ReplicationWriter = ReplicationWriter
this.#storageRepositories = srs
}
getWriterBySr(storageRepository) {
for (const writer of this.#writers) {
if (writer._sr === storageRepository) {
return writer
}
}
throw new Error("Can't find writer for storage repository")
}
async computeSRCandidate() {
let maxSpace = 0
this.#storageRepositories.forEach(({ physical_utilisation, physical_size }) => {
if (physical_size - physical_utilisation > maxSpace) {
maxSpace = physical_size - physical_utilisation
}
})
debug(`computeSRCandidate found the max free space ${maxSpace} for vm${this.#props.vmUuid}`)
const srCandidates = this.#storageRepositories.filter(
({ physical_utilisation, physical_size }) => maxSpace === physical_size - physical_utilisation
)
// one at random from the sr with the most free space
const candidate = srCandidates[Math.floor(Math.random() * srCandidates.length)]
debug(
`computeSRCandidate found ${srCandidates.length} sr with ${maxSpace} free size, and chose ${candidate.name_label} for vm${this.#props.vmUuid}`
)
return candidate
}
setOldReplicaList() {
debug(`setOldReplicaList for vm ${this.#props.vmUuid}`)
const scheduleId = this.#props.scheduleId
const vmUuid = this.#props.vmUuid
const settings = this.#props.settings
const replicatedVms = this.#storageRepositories
.map(sr => {
return listReplicatedVms(sr.$xapi, scheduleId, sr.uuid, vmUuid)
})
.flat(1)
.filter(_ => !!_)
.sort(compareReplicatedVmDatetime)
this.#oldVmReplicaList = getOldEntries(settings.copyRetention - 1, replicatedVms)
debug(
`setOldReplicaList found ${replicatedVms.length} replica, and will delete ${this.#oldVmReplicaList.length} (retention ${settings.copyRetention}) for vm ${this.#props.vmUuid}`
)
}
async deleteOldReplicas() {
debug(`deleteOldReplicas will delete ${this.#oldVmReplicaList.length} replicated vms for vm ${this.#props.vmUuid}`)
// destroy the VM on the right xapi
await asyncMapSettled(this.#oldVmReplicaList, async vm => {
debug('will delete old replica', vm.name_label)
await vm.$xapi.VM_destroy(vm.$ref)
})
debug(`deleteOldReplicas deleted ${this.#oldVmReplicaList.length} replicated vms for vm ${this.#props.vmUuid}`)
}
async setupWriters() {
debug('Setup writers ')
const settings = this.#props.settings
const allSettings = this.#props.job.settings
this.#storageRepositories.forEach(storageRepository => {
const targetSettings = {
...settings,
...allSettings[storageRepository.uuid],
skipDeleteOldEntries: true, // delete is handled globally
}
if (targetSettings.copyRetention !== 0) {
const writer = new this.#ReplicationWriter({
...this.#props,
sr: storageRepository,
settings: targetSettings,
})
this.#writers.push(writer)
}
})
}
}

View File

@@ -5,18 +5,10 @@ const getReplicatedVmDatetime = vm => {
return datetime
}
export const compareReplicatedVmDatetime = (a, b) => (getReplicatedVmDatetime(a) < getReplicatedVmDatetime(b) ? -1 : 1)
const compareReplicatedVmDatetime = (a, b) => (getReplicatedVmDatetime(a) < getReplicatedVmDatetime(b) ? -1 : 1)
/**
*
* @param {Xapi} xapi
* @param {string} scheduleOrJobId
* @param {string} srUuid
* @param {string} vmUuid
* @returns {Array<XoVm>}
*/
export function listReplicatedVms(xapi, scheduleOrJobId, srUuid, vmUuid) {
const all = xapi.objects.indexes.type.VM
const { all } = xapi.objects
const vms = {}
for (const key in all) {
const object = all[key]

View File

@@ -0,0 +1,140 @@
import { RemoteDisk } from "./RemoteDisk.mjs";
/**
* this class stores disk blocks by there has instead of their position
* doing per disk dedup as a bonus
*
* it also integrate the alias part to simplify the rename
*
* determine the extension of these new disk ( Vates Backup Disk ? Hashed Backup Storage ?)
*
* {diskname}.{extension}
* |- blockStorePath
* |- hash1
* |- hash2
* ...
* |- hashn
*/
/**
* @typedef {Object} HashedDiskMetadata
* @property {number} virtualSize
* @property {string} uuid
* @property {string|undefined} parentUuid
* @property {string|undefined} parentPath
* @property {number} blockSize
* @property {PER_DISK | PER_BACKUP_REPOSITORY } dedupType implement PER_DISK here, PER_BACKUP_REPOSITORY will be for later
* @property {string} blockStorePath path relative to this file, random name
*/
export class HashedDisk extends RemoteDisk{
async canMergeConcurently() {
return true
}
/**
* Checks if the hash is not empty in the BAT
* @param {number} index
* @returns {boolean}
*/
hasBlock(index) {
throw new Error(`hasBlock must be implemented`)
}
/**
* Gets the indexes of all blocks in the VHD.
* @returns {Array<number>}
*/
getBlockIndexes() {
throw new Error(`getBlockIndexes must be implemented`)
}
/**
* determine the hash algorithm and hash length from https://en.wikipedia.org/wiki/Birthday_problem
* compute the hash from the clear data
* compute the path from the hash
* split the path in 8 bytes parts at most , and create the directory tree if needed
* write the block in a temp place
* rename the block to its defintive place, treat EEXIST as success ( block is already here )
*
* @param {DiskBlock} diskBlock
* @return {Promise<number>} blockSize
*/
async writeBlock(diskBlock) {
throw new Error(`writeBlock must be implemented`)
}
/**
* read the hash
* compute the path from the hash
* read the block from its path
* @param {number} index
* @returns {Promise<DiskBlock>} diskBlock
*/
async readBlock(index) {
throw new Error(`readBlock must be implemented`)
}
/**
* if block is already present in parent : not an issue, but still update the parent BAT
* @param {RemoteDisk} childDisk
* @param {number} index
* @param {boolean} isResumingMerge
* @returns {Promise<number>} blockSize
*/
async mergeBlock(childDisk, index, isResumingMerge) {
throw new Error(`mergeBlock must be implemented`)
}
/**
* will need to also update he hashes
* @param {Array<number>} blockIds
* @returns {Promise<void>}
*/
async setAllocatedBlocks(blockIds) {
throw new Error(`setAllocatedBlocks must be implemented`)
}
/**
* write the metadata as a JSON flat file
* @param {RemoteDisk} childDisk
* @returns {Promise<void>}
*/
async flushMetadata(childDisk) {
throw new Error(`flushMetadata must be implemented`)
}
/**
* rename only the metadata file
* delete overwritten target / disks if needed
* @param {string} newPath
*/
async rename(newPath) {
throw new Error(`rename must be implemented`)
}
/**
* This must write the hashes and bat into a new files
* update the metadata that point to it
* then remove the older file
*
* this is built on the fact that the merge now only
* write it at the end of the job, so we don't update BAT
*/
async flushMetadata(){
}
/**
* (for cleanVM)
* detecte older bat/hashes files
*/
async check(){
}
}

View File

@@ -0,0 +1,175 @@
class BlockStore{
constructor(handler, basePath){}
/**
* write the block, returns the key in store
* @param {string} hash
* @param {Buffer} content
*/
writeBlock( hash, content){
}
/**
* return the code from its key
* @param {string} hash
* @param {Buffer} content
*/
readBlock( hash){
}
/**
* free one block use
* @param {string} hash
* @param {Buffer} content
*/
removeReference(hash){
}
/**
* mark this bock as used
* @param {string} hash
* @param {path} string
*/
addBlockReference(hash, path){
}
}
class BlockStoreFileSystem extends BlockStore{
constructor(handler, basePath){}
#handler
hash(diskBlock){}
#computePathInStore(hash){
}
/**
* write the file in a temporary folder
* rename to the path computed from the hash/0
* treat EEXIST as success
*
* @param {string} hash
* @param {Buffer} content
* @returns {Promise<size>} the size written on disk, 0 if if block already here
*/
async writeBlock( hash, content){
try{
return await this.#handler.outputFile(this.#computePathInStore(hash), content)
}catch(err){
if(err.code === 'EEXIST'){
return 0
}
throw err
}
}
/**
* compute the path from the hash
* read the file from this path
* @param {string} hash
* @returns {Promise<Buffer} content
*/
readBlock( hash){
const path = this.#computePathInStore(hash)
return this.#handler.readFile(path)
}
/**
* remove the hard link
* check the hash/i and remove any that have a nLinks < 2
* @param {*} hash
*/
removeReference(hash){
}
/**
* nLinks is probably limited to 32 bits, but can be as low as 16 bits
* blocks are referenced once per disk
* the chain should not be very long , even blocks present in all the disks like the empty block
*
* do a hard link from the hashed path
* to the path hash/0
*
* ON EMLINK error ( too )
* try hash/1 ,.. hash/2 ...
* if out of file copy the last then link from this new block
* @param {*} hash
* @param {*} path
*/
addBlockReference(hash, path){
}
}
/**
* this class stores disk blocks in a global store at the root of the remote
* this class is more the second step after a complete HashedDisk implementation
* and should be used in production instead of HashedDisk
*/
export class HashedDiskDeduplicated extends HashedDisk{
#blockStore
/**
*
* @param {*} handler
* @param {*} path
* @param {BlockStore} blockStore
*/
constructor(handler, path, blockStore){
}
/**
* write the block into the block store, get the block key
* link the block key to the same path as HashedDisk
*
* if link return a ENOENT that means another process clean this block , re-add to block store
*
* if this overwrite another block, then remove the old reference from the store
* @param {DiskBlock} diskBlock
*/
async writeBlock(diskBlock) {
let size
const path = this.computeBlockPath(diskBlock)
const hash = this.#blockStore.hash(diskBlock)
try{
// optimistically try if block exists
size = await this.#blockStore.addBlockReference(hash, path)
return size
}catch(error){
// not really an issue , it was just that the block did not already exists
}
size = await this.#blockStore.writeBlock(hash, diskBlock.data)
size += await this.#blockStore.addBlockReference(hash, path)
return size
}
/**
* remove all the references of this disk in the block store
*/
async unlink() {
throw new Error(`unlink must be implemented`)
}
/**
* or maybe another callback ?
* call removeReference on each hash that is not present anymore in the parent after merge
* doing this once will limit the risks of race conditions when removing
*/
flushMetadata(){
}
}

View File

@@ -89,7 +89,6 @@ export class RemoteDisk extends RandomAccessDisk {
}
/**
* Abstract
* Gets the indexes of all blocks in the VHD.
* @returns {Array<number>}
*/
@@ -97,15 +96,6 @@ export class RemoteDisk extends RandomAccessDisk {
throw new Error(`getBlockIndexes must be implemented`)
}
/**
* Abstract
* Returns the parent non inizialized instance
* @returns {RemoteDisk}
*/
instantiateParent() {
throw new Error(`instantiateParent must be implemented`)
}
/**
* Abstract
* Writes a full block.

View File

@@ -202,25 +202,17 @@ describe('tests RemoteVhdDiskChain', { concurrency: 1 }, () => {
test('RemoteVhdDiskChain should read block', async () => {
// Create parent and child VHDs
const chainParent = await generateVhd(`${basePath}/parent.vhd`, { blocks: [0] })
const chainChild = await generateVhd(`${basePath}/child.vhd`, {
await generateVhd(`${basePath}/child.vhd`, {
header: {
parentUnicodeName: 'parent.vhd',
parentUuid: chainParent.footer.uuid,
},
blocks: [1],
})
await generateVhd(`${basePath}/child_2.vhd`, {
header: {
parentUnicodeName: 'child.vhd',
parentUuid: chainChild.footer.uuid,
},
blocks: [1],
})
const parent = new RemoteVhdDisk({ handler, path: `${basePath}/parent.vhd` })
const child = new RemoteVhdDisk({ handler, path: `${basePath}/child.vhd` })
const child_2 = new RemoteVhdDisk({ handler, path: `${basePath}/child_2.vhd` })
const diskChain = new RemoteVhdDiskChain({ disks: [parent, child, child_2] })
const diskChain = new RemoteVhdDiskChain({ disks: [parent, child] })
await diskChain.init({ force: false })
@@ -370,18 +362,18 @@ describe('tests MergeVhdChain', { concurrency: 1 }, () => {
// Create ancestor and children VHDs
await generateVhd(`${basePath}/ancestor.vhd`, { blocks: [0, 1] })
const chainChild1 = await generateVhd(`${basePath}/child_1.vhd`, { blocks: [2] })
const chainChild2 = await generateVhd(`${basePath}/child_2.vhd`, {
const chainParent = await generateVhd(`${basePath}/child_1.vhd`, { blocks: [2] })
await generateVhd(`${basePath}/child_2.vhd`, {
header: {
parentUnicodeName: 'child_1.vhd',
parentUuid: chainChild1.footer.uuid,
parentUuid: chainParent.footer.uuid,
},
blocks: [3],
})
await generateVhd(`${basePath}/child_3.vhd`, {
header: {
parentUnicodeName: 'child_2.vhd',
parentUuid: chainChild2.footer.uuid,
parentUnicodeName: 'child_1.vhd',
parentUuid: chainParent.footer.uuid,
},
blocks: [4],
})

View File

@@ -16,7 +16,6 @@ import { DISK_TYPES } from 'vhd-lib/_constants.js'
import { isVhdAlias, resolveVhdAlias } from 'vhd-lib/aliases.js'
// import { set as setBitmap } from 'vhd-lib/_bitmap.js'
import { stringify } from 'uuid'
import { dirname, join } from 'node:path'
export class RemoteVhdDisk extends RemoteDisk {
/**
@@ -71,19 +70,18 @@ export class RemoteVhdDisk extends RemoteDisk {
* @param {boolean} [options.force=false]
* @returns {Promise<void>}
*/
async init(options = {}) {
if (this.#vhd === undefined) {
try {
if ((await this.isDirectory()) && !isVhdAlias(this.#path)) {
throw Object.assign(new Error("Can't init vhd directory without using alias"), { code: 'NOT_SUPPORTED' })
}
const { value, dispose } = await openVhd(this.#handler, await resolveVhdAlias(this.#handler, this.#path), {
checkSecondFooter: !options.force,
})
this.#vhd = value
if ((await this.isDirectory()) && !isVhdAlias(this.#path)) {
this.#vhd = undefined
throw Object.assign(new Error("Can't init vhd directory without using alias"), { code: 'NOT_SUPPORTED' })
}
this.#dispose = dispose
await this.#vhd.readBlockAllocationTable()
this.#isDifferencing = value.footer.diskType === DISK_TYPES.DIFFERENCING
@@ -206,26 +204,6 @@ export class RemoteVhdDisk extends RemoteDisk {
return indexes
}
/**
* Returns the parent non inizialized instance
* @returns {RemoteDisk}
*/
instantiateParent() {
if (this.#vhd === undefined) {
throw new Error(`can't call instantiateParent of a RemoteVhdDisk before init`)
}
const parentPath = this.#vhd.header.parentUnicodeName
const fullParentPath = join(dirname(this.#path), parentPath)
if (!parentPath) {
throw new Error(`disk ${this.#path} doesn't have parents`)
}
const parent = new RemoteVhdDisk({ handler: this.#handler, path: fullParentPath })
return parent
}
/**
* Writes a full block into this VHD.
* @param {DiskBlock} diskBlock
@@ -450,10 +428,15 @@ export class RemoteVhdDisk extends RemoteDisk {
* @returns {Promise<boolean>}
*/
async isDirectory() {
if (this.#vhd === undefined) {
throw new Error(`can't call isDirectory of a RemoteVhdDisk before init`)
if (this.#vhd !== undefined) {
return this.#vhd instanceof VhdDirectory
} else {
try {
await this.#handler.readFile(await resolveVhdAlias(this.#handler, this.#path))
return false
} catch (err) {
return true
}
}
return this.#vhd instanceof VhdDirectory
}
}

View File

@@ -56,7 +56,9 @@ export class RemoteVhdDiskChain extends RemoteDisk {
await Promise.all(this.#disks.map(disk => disk.init(options)))
let parentUuid = ''
for (const [index, disk] of this.#disks.entries()) {
if (index !== 0) {
if (index === 0) {
parentUuid = disk.getUuid()
} else {
if (!disk.isDifferencing()) {
throw Object.assign(new Error("Can't init vhd directory with non differencing child disks"), {
code: 'NOT_SUPPORTED',
@@ -68,8 +70,6 @@ export class RemoteVhdDiskChain extends RemoteDisk {
})
}
}
parentUuid = disk.getUuid()
}
} catch (error) {
await this.close()
@@ -178,14 +178,6 @@ export class RemoteVhdDiskChain extends RemoteDisk {
return [...indexes]
}
/**
* Returns the parent non inizialized instance
* @returns {RemoteDisk}
*/
instantiateParent() {
return this.#disks[0].instantiateParent()
}
/**
* Writes a full block into this VHD.
* @param {DiskBlock} diskBlock

View File

@@ -0,0 +1,12 @@
import { RemoteDisk } from "./RemoteDisk.mjs";
/**
* open a disk on a remote , wether it's a RemoteVhd or a hashed disk
* refactor to use this method anywhere we use openVhd at least on @xen-orchestra/backups
*
* @param {*} handler
* @param {*} path
* @returns {Promise<RemoteDisk>}
*/
export async function openDisk(handler,path){}

View File

@@ -337,25 +337,3 @@ You'll find them in these directories:
## VueUse SHOULD be used when necessary
If you don't find what you need in our helpers, [VueUse](https://vueuse.org) provides a lot of utilities for common use cases (e.g., accessing browser APIs, using local storage, etc.).
## Internal links SHOULD use named routes
When using internal links, e.g. with `<RouterLink>` or `<UiLink :to="<internal-link>">`, prefer using named routes instead of hardcoding the path. This improves maintainability and readability, especially when route paths change.
See [named routes documentation](https://router.vuejs.org/guide/essentials/named-routes.html#Named-Routes) for more information.
❌ Bad
```vue
<UiLink :to="`/vm/${vm.id}/dashboard`">
{{ t('dashboard') }}
</UiLink>
```
✅ Good
```vue
<UiLink :to="{ name: '/vm/[id]/dashboard', params: { id: vm.id } }">
{{ t('dashboard') }}
</UiLink>
```

View File

@@ -1,7 +1,7 @@
<template>
<CoreLayout>
<template #app-logo>
<RouterLink class="logo-link" :class="{ mobile: uiStore.isMobile }" :to="{ name: '/(site)/dashboard' }">
<RouterLink class="logo-link" :class="{ mobile: uiStore.isMobile }" to="/dashboard">
<UiLogoText :text="t('xen-orchestra')" />
</RouterLink>
</template>

View File

@@ -1,8 +1,8 @@
<template>
<div class="breadcrumb-container">
<UiBreadcrumb :size>
<UiLink :size :to="{ name: '/(site)/dashboard' }" icon="fa:satellite">{{ XOA_NAME }}</UiLink>
<UiLink :size :to="{ name: '/(site)/backups' }">{{ t('backups') }}</UiLink>
<UiLink :size to="/dashboard" icon="fa:satellite">{{ XOA_NAME }}</UiLink>
<UiLink :size to="/backups">{{ t('backups') }}</UiLink>
<span class="backup-job-name">
<VtsIcon name="object:backup-job" size="current" />
{{ backupJob.name }}
@@ -11,30 +11,22 @@
<UiLink :size :href="newBackupRoute">{{ t('configure-in-xo-5') }}</UiLink>
</div>
<TabList>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/backup/[id]/runs', params: { id: backupJob.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/backup/${backupJob.id}/runs`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('runs') }}
</TabItem>
</RouterLink>
<RouterLink
v-slot="{ isActive, href }"
:to="{ name: '/backup/[id]/configuration', params: { id: backupJob.id } }"
custom
>
<RouterLink v-slot="{ isActive, href }" :to="`/backup/${backupJob.id}/configuration`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('configuration') }}
</TabItem>
</RouterLink>
<RouterLink
v-slot="{ isActive, href }"
:to="{ name: '/backup/[id]/backed-up-vms', params: { id: backupJob.id } }"
custom
>
<RouterLink v-slot="{ isActive, href }" :to="`/backup/${backupJob.id}/backed-up-vms`" custom>
<TabItem :active="isActive" :href tag="a" :disabled="backupJob.type !== 'backup'">
{{ t('backed-up-vms') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/backup/[id]/targets', params: { id: backupJob.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/backup/${backupJob.id}/targets`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('backup-targets') }}
</TabItem>

View File

@@ -35,7 +35,7 @@
:key="pool.id"
size="small"
icon="object:pool"
:to="{ name: '/pool/[id]/dashboard', params: { id: pool.id } }"
:to="`/pool/${pool.id}/dashboard`"
>
{{ pool.name_label }}
</UiLink>
@@ -59,7 +59,7 @@
:key="pool.id"
size="small"
icon="object:pool"
:to="{ name: '/pool/[id]/dashboard', params: { id: pool.id } }"
:to="`/pool/${pool.id}/dashboard`"
>
{{ pool.name_label }}
</UiLink>

View File

@@ -5,7 +5,7 @@
v-if="backupJob.name !== undefined"
size="small"
icon="object:backup-job"
:to="{ name: '/backup/[id]/runs', params: { id: backupJob.id } }"
:to="`/backup/${backupJob.id}/runs`"
>
{{ backupJob.name }}
</UiLink>

View File

@@ -4,7 +4,7 @@
{{ label }}
</template>
<template #value>
<UiLink size="small" icon="object:pool" :to="{ name: '/pool/[id]/dashboard', params: { id: pool.id } }">
<UiLink size="small" icon="object:pool" :to="`/pool/${pool.id}/dashboard`">
{{ pool.name_label }}
</UiLink>
</template>

View File

@@ -8,7 +8,7 @@
v-if="backupRun.id"
size="small"
icon="object:backup-run"
:to="{ name: '/backup/[id]/runs', params: { id: backupRun.jobId }, query: { id: backupRun.id } }"
:to="`/backup/${backupRun.jobId}/runs?id=${backupRun.id}`"
>
{{ backupRun.id }}
</UiLink>

View File

@@ -7,7 +7,7 @@
<div>
<UiCollapsibleList tag="ul" :total-items="backedUpPools.length">
<li v-for="pool in backedUpPools" :key="pool.id">
<UiLink size="small" icon="object:pool" :to="{ name: '/pool/[id]/dashboard', params: { id: pool.id } }">
<UiLink size="small" icon="object:pool" :to="`/pool/${pool.id}`">
{{ pool.name_label }}
</UiLink>
</li>

View File

@@ -56,11 +56,7 @@
<!-- Backed up VMs list -->
<UiCollapsibleList tag="ul" :total-items="backedUpVmsCount">
<li v-for="vm in backedUpVms" :key="vm.id">
<UiLink
size="small"
:icon="`object:vm:${toLower(vm.power_state)}`"
:to="{ name: '/vm/[id]/dashboard', params: { id: vm.id } }"
>
<UiLink size="small" :icon="`object:vm:${toLower(vm.power_state)}`" :to="`/vm/${vm.id}/dashboard`">
{{ vm.name_label }}
</UiLink>
</li>

View File

@@ -9,12 +9,12 @@
</template>
</UiHeadBar>
<TabList>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/host/[id]/dashboard', params: { id: host.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/host/${host.id}/dashboard`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('dashboard') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/host/[id]/console', params: { id: host.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/host/${host.id}/console`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('console') }}
</TabItem>
@@ -24,17 +24,17 @@
{{ t('stats') }}
</UiLink>
</TabItem>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/host/[id]/system', params: { id: host.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/host/${host.id}/system`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('system') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/host/[id]/networks', params: { id: host.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/host/${host.id}/networks`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('network') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/host/[id]/storage', params: { id: host.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/host/${host.id}/storage`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('storage') }}
</TabItem>
@@ -44,7 +44,7 @@
{{ t('tasks') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/host/[id]/vms', params: { id: host.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/host/${host.id}/vms`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('vms') }}
</TabItem>

View File

@@ -22,7 +22,7 @@
</template>
<UiLink
v-else-if="masterHost !== undefined"
:to="{ name: '/host/[id]/dashboard', params: { id: masterHost.id } }"
:to="`/host/${masterHost.id}/`"
size="medium"
:icon="`object:host:${toLower(masterHost.power_state)}`"
>

View File

@@ -1,11 +1,7 @@
<template>
<UiCard class="card-container">
<UiCardTitle>
<UiLink
:to="{ name: '/host/[id]/dashboard', params: { id: host.id } }"
size="medium"
:icon="`object:host:${toLower(host.power_state)}`"
>
<UiLink :to="`/host/${host.id}/dashboard`" size="medium" :icon="`object:host:${toLower(host.power_state)}`">
{{ host.name_label }}
</UiLink>
</UiCardTitle>
@@ -48,7 +44,7 @@
<template #key>{{ t('pool') }}</template>
<template #value>
<div v-if="pool" class="value">
<UiLink :to="{ name: '/pool/[id]/dashboard', params: { id: pool.id } }" size="small" icon="object:pool">
<UiLink :to="`/pool/${pool.id}/dashboard`" size="small" icon="object:pool">
{{ pool.name_label }}
</UiLink>
</div>
@@ -66,7 +62,7 @@
</div>
<div v-else-if="masterHost !== undefined" class="value">
<UiLink
:to="{ name: '/host/[id]/dashboard', params: { id: masterHost.id } }"
:to="`/host/${masterHost.id}/dashboard`"
size="small"
:icon="`object:host:${toLower(masterHost.power_state)}`"
>

View File

@@ -22,7 +22,7 @@
</VtsQuickInfoRow>
<VtsQuickInfoRow :label="t('pool')">
<template v-if="pool !== undefined" #value>
<UiLink size="medium" :to="{ name: '/pool/[id]/dashboard', params: { id: pool.id } }" icon="object:pool">
<UiLink size="medium" :to="`/pool/${pool.id}/dashboard`" icon="object:pool">
{{ pool.name_label }}
</UiLink>
</template>
@@ -36,7 +36,7 @@
<UiLink
v-else-if="masterHost !== undefined"
size="medium"
:to="{ name: '/host/[id]/dashboard', params: { id: masterHost.id } }"
:to="`/host/${masterHost.id}/`"
:icon="`object:host:${toLower(masterHost.power_state)}`"
>
{{ masterHost.name_label }}

View File

@@ -1,18 +1,9 @@
import type { FrontXoNetwork } from '@/modules/network/remote-resources/use-xo-network-collection.ts'
import type { FrontXoPif } from '@/modules/pif/remote-resources/use-xo-pif-collection.ts'
import type { FrontXoPool } from '@/modules/pool/remote-resources/use-xo-pool-collection.ts'
import { CONNECTION_STATUS } from '@/shared/constants.ts'
import type { RouteLocationAsRelative } from 'vue-router'
export function getPoolNetworkRoute(
poolId: FrontXoPool['id'],
highlightNetworkId?: FrontXoNetwork['id']
): RouteLocationAsRelative {
return {
name: '/pool/[id]/networks',
params: { id: poolId },
query: { id: highlightNetworkId },
}
export function getPoolNetworkLink(network: FrontXoNetwork | undefined) {
return network !== undefined ? `/pool/${network.$pool}/networks?id=${network.id}` : undefined
}
export function getNetworkStatus(pifs: FrontXoPif[]) {

View File

@@ -29,7 +29,7 @@
<script setup lang="ts">
import { useXoNetworkCollection } from '@/modules/network/remote-resources/use-xo-network-collection.ts'
import { getPoolNetworkRoute } from '@/modules/network/utils/xo-network.util.ts'
import { getPoolNetworkLink } from '@/modules/network/utils/xo-network.util.ts'
import { useXoPifCollection, type FrontXoPif } from '@/modules/pif/remote-resources/use-xo-pif-collection.ts'
import { getPifStatus } from '@/modules/pif/utils/xo-pif.util.ts'
import VtsRow from '@core/components/table/VtsRow.vue'
@@ -117,17 +117,14 @@ const { HeadCells, BodyCells } = usePifColumns({
const rightIcon = computed(() => getManagementIcon(pif))
const network = useGetNetworkById(() => pif.$network)
const poolNetworkRoute = computed(() =>
network.value ? getPoolNetworkRoute(network.value.$pool, network.value.id) : undefined
)
const poolNetworkLink = computed(() => getPoolNetworkLink(network.value))
return {
network: r =>
network.value
? r({
label: network.value.name_label,
to: poolNetworkRoute.value,
to: poolNetworkLink.value,
icon: 'object:network',
})
: renderBodyCell(),

View File

@@ -252,7 +252,6 @@
<script setup lang="ts">
import { useXoNetworkCollection } from '@/modules/network/remote-resources/use-xo-network-collection.ts'
import { getPoolNetworkRoute } from '@/modules/network/utils/xo-network.util.ts'
import { useXoPifCollection, type FrontXoPif } from '@/modules/pif/remote-resources/use-xo-pif-collection.ts'
import { CONNECTION_STATUS } from '@/shared/constants.ts'
import VtsCardRowKeyValue from '@core/components/card/VtsCardRowKeyValue.vue'
@@ -292,7 +291,7 @@ const ipAddresses = computed(() => [pif.ip, ...pif.ipv6].filter(ip => ip))
const network = useGetNetworkById(() => pif.$network)
const networkTo = computed(() =>
network.value ? getPoolNetworkRoute(network.value.$pool, network.value.id) : undefined
network.value !== undefined ? `/pool/${network.value.$pool}/networks?id=${network.value.id}` : undefined
)
const networkNbd = computed(() => (network.value?.nbd ? t('on') : t('off')))

View File

@@ -8,7 +8,7 @@
</template>
</UiHeadBar>
<TabList>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/pool/[id]/dashboard', params: { id: pool.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/pool/${pool.id}/dashboard`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('dashboard') }}
</TabItem>
@@ -18,17 +18,17 @@
{{ t('stats') }}
</UiLink>
</TabItem>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/pool/[id]/system', params: { id: pool.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/pool/${pool.id}/system`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('system') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/pool/[id]/networks', params: { id: pool.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/pool/${pool.id}/networks`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('network') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/pool/[id]/storage', params: { id: pool.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/pool/${pool.id}/storage`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('storage') }}
</TabItem>
@@ -38,12 +38,12 @@
{{ t('tasks') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/pool/[id]/hosts', params: { id: pool.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/pool/${pool.id}/hosts`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('hosts') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/pool/[id]/vms', params: { id: pool.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/pool/${pool.id}/vms`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('vms') }}
</TabItem>

View File

@@ -29,7 +29,7 @@
v-if="server.poolId !== undefined && server.poolNameLabel !== undefined"
icon="object:pool"
size="small"
:to="{ name: '/pool/[id]/dashboard', params: { id: server.poolId } }"
:to="`/pool/${server.poolId}/dashboard`"
>
{{ server.poolNameLabel }}
</UiLink>
@@ -87,7 +87,7 @@
v-if="primaryHost !== undefined"
:icon="`object:host:${toLower(primaryHost.power_state)}`"
size="small"
:to="{ name: '/host/[id]/dashboard', params: { id: primaryHost.id } }"
:to="`/host/${primaryHost.id}/dashboard`"
>
{{ primaryHost.name_label }}
<VtsIcon accent="info" name="status:primary-circle" size="medium" />
@@ -151,7 +151,7 @@
<UiLink
v-for="host in hosts"
:key="host.id"
:to="{ name: '/host/[id]/dashboard', params: { id: host.id } }"
:to="`/host/${host.id}/dashboard`"
:icon="`object:host:${toLower(host.power_state)}`"
size="small"
>

View File

@@ -7,12 +7,7 @@
<template v-else>
<VtsQuickInfoRow :label="t('master')">
<template #value>
<UiLink
v-if="primaryHost"
icon="object:host"
:to="{ name: '/host/[id]/dashboard', params: { id: pool.master } }"
size="medium"
>
<UiLink v-if="primaryHost" icon="object:host" :to="`/host/${pool.master}/`" size="medium">
{{ primaryHost.name_label }}
</UiLink>
<template v-else>

View File

@@ -7,7 +7,12 @@
<template v-else>
<VtsQuickInfoRow :label="t('backup-network')">
<template #value>
<UiLink v-if="backupNetwork !== undefined" icon="object:network" :to="backupNetworkTo" size="medium">
<UiLink
v-if="backupNetwork !== undefined"
icon="object:network"
:to="`/pool/${pool.id}/networks?id=${backupNetwork.id}`"
size="medium"
>
{{ backupNetwork.name_label }}
</UiLink>
<template v-else>
@@ -21,7 +26,6 @@
<script setup lang="ts">
import { useXoNetworkCollection } from '@/modules/network/remote-resources/use-xo-network-collection.ts'
import { getPoolNetworkRoute } from '@/modules/network/utils/xo-network.util.ts'
import type { FrontXoPool } from '@/modules/pool/remote-resources/use-xo-pool-collection.ts'
import VtsQuickInfoRow from '@core/components/quick-info-row/VtsQuickInfoRow.vue'
import VtsStateHero from '@core/components/state-hero/VtsStateHero.vue'
@@ -45,8 +49,4 @@ const backupNetwork = computed(() =>
? getNetworkById(pool.otherConfig['xo:backupNetwork'] as XoNetwork['id'])
: undefined
)
const backupNetworkTo = computed(() =>
backupNetwork.value ? getPoolNetworkRoute(backupNetwork.value.$pool, backupNetwork.value.id) : undefined
)
</script>

View File

@@ -2,7 +2,7 @@
<UiHeadBar icon="fa:satellite">
{{ XOA_NAME }}
<template #actions>
<UiLink :to="{ name: '/pool/connect' }" size="medium" icon="fa:plus">
<UiLink to="/pool/connect" size="medium" icon="fa:plus">
{{ t('action:connect-pool') }}
</UiLink>
</template>
@@ -13,7 +13,7 @@
{{ t('dashboard') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isExactActive, href }" :to="{ name: '/(site)/backups' }" custom>
<RouterLink v-slot="{ isExactActive, href }" to="/backups" custom>
<TabItem :active="isExactActive" :href tag="a">
{{ t('backups') }}
</TabItem>
@@ -23,13 +23,13 @@
{{ t('tasks') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isExactActive, href }" :to="{ name: '/(site)/pools' }" custom>
<RouterLink v-slot="{ isExactActive, href }" to="/pools" custom>
<TabItem :active="isExactActive" :href tag="a">{{ t('pools') }}</TabItem>
</RouterLink>
<RouterLink v-slot="{ isExactActive, href }" :to="{ name: '/(site)/hosts' }" custom>
<RouterLink v-slot="{ isExactActive, href }" to="/hosts" custom>
<TabItem :active="isExactActive" :href tag="a">{{ t('hosts') }}</TabItem>
</RouterLink>
<RouterLink v-slot="{ isExactActive, href }" :to="{ name: '/(site)/vms' }" custom>
<RouterLink v-slot="{ isExactActive, href }" to="/vms" custom>
<TabItem :active="isExactActive" :href tag="a">{{ t('vms') }}</TabItem>
</RouterLink>
</TabList>

View File

@@ -4,12 +4,7 @@
{{ t('host') }}
</template>
<template #value>
<UiLink
v-if="host !== undefined"
size="small"
icon="object:host"
:to="{ name: '/host/[id]/dashboard', params: { id: host.id } }"
>
<UiLink v-if="host !== undefined" size="small" icon="object:host" :to="`host/${host.id}/dashboard`">
{{ host.name_label }}
</UiLink>
</template>

View File

@@ -6,7 +6,7 @@
</UiCardTitle>
<UiCollapsibleList v-if="hosts.length > 0" tag="ul" :total-items="hosts.length">
<li v-for="host in hosts" :key="host.id" v-tooltip class="text-ellipsis">
<UiLink size="small" :icon="`object:host:${toLower(host.power_state)}`" :to="{ name: '/host/[id]/dashboard', params: { id: host.id } }">
<UiLink size="small" :icon="`object:host:${toLower(host.power_state)}`" :to="`/host/${host.id}/dashboard`">
{{ host.name_label }}
</UiLink>
</li>

View File

@@ -29,7 +29,7 @@
<script setup lang="ts">
import { useXoNetworkCollection } from '@/modules/network/remote-resources/use-xo-network-collection.ts'
import { getPoolNetworkRoute } from '@/modules/network/utils/xo-network.util.ts'
import { getPoolNetworkLink } from '@/modules/network/utils/xo-network.util.ts'
import { useXoVifCollection, type FrontXoVif } from '@/modules/vif/remote-resources/use-xo-vif-collection.ts'
import { useXoVmCollection } from '@/modules/vm/remote-resources/use-xo-vm-collection.ts'
import { CONNECTION_STATUS } from '@/shared/constants.ts'
@@ -98,17 +98,14 @@ const { HeadCells, BodyCells } = useVifColumns({
const ipAddresses = computed(() => getIpAddresses(vif))
const network = useGetNetworkById(() => vif.$network)
const poolNetworkRoute = computed(() =>
network.value ? getPoolNetworkRoute(network.value.$pool, network.value.id) : undefined
)
const poolNetworkLink = computed(() => getPoolNetworkLink(network.value))
return {
network: r =>
network.value
? r({
label: network.value.name_label,
to: poolNetworkRoute.value,
to: poolNetworkLink.value,
icon: icon('object:network'),
})
: renderBodyCell(),

View File

@@ -138,7 +138,7 @@
<script setup lang="ts">
import { useXoNetworkCollection } from '@/modules/network/remote-resources/use-xo-network-collection.ts'
import { getPoolNetworkRoute } from '@/modules/network/utils/xo-network.util.ts'
import { getPoolNetworkLink } from '@/modules/network/utils/xo-network.util.ts'
import type { FrontXoVif } from '@/modules/vif/remote-resources/use-xo-vif-collection.ts'
import { useXoVmCollection } from '@/modules/vm/remote-resources/use-xo-vm-collection.ts'
import { CONNECTION_STATUS } from '@/shared/constants.ts'
@@ -176,9 +176,7 @@ const ipAddresses = computed(() => {
const network = useGetNetworkById(() => vif.$network)
const networkTo = computed(() =>
network.value ? getPoolNetworkRoute(network.value.$pool, network.value.id) : undefined
)
const networkTo = computed(() => getPoolNetworkLink(network.value))
const status = computed(() => (vif.attached ? CONNECTION_STATUS.CONNECTED : CONNECTION_STATUS.DISCONNECTED))
</script>

View File

@@ -41,17 +41,17 @@
</template>
</UiHeadBar>
<TabList>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/vm/[id]/dashboard', params: { id: vm.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/vm/${vm.id}/dashboard`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('dashboard') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/vm/[id]/console', params: { id: vm.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/vm/${vm.id}/console`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('console') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/vm/[id]/backups', params: { id: vm.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/vm/${vm.id}/backups`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('backups') }}
</TabItem>
@@ -61,17 +61,17 @@
{{ t('stats') }}
</UiLink>
</TabItem>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/vm/[id]/system', params: { id: vm.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/vm/${vm.id}/system`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('system') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/vm/[id]/networks', params: { id: vm.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/vm/${vm.id}/networks`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('network') }}
</TabItem>
</RouterLink>
<RouterLink v-slot="{ isActive, href }" :to="{ name: '/vm/[id]/vdis', params: { id: vm.id } }" custom>
<RouterLink v-slot="{ isActive, href }" :to="`/vm/${vm.id}/vdis`" custom>
<TabItem :active="isActive" :href tag="a">
{{ t('vdis') }}
</TabItem>

View File

@@ -18,7 +18,7 @@
<VtsQuickInfoRow :label="t('uuid')" :value="vm.id" />
<VtsQuickInfoRow :label="t('pool')">
<template #value>
<UiLink v-if="pool" :to="{ name: '/pool/[id]/dashboard', params: { id: pool.id } }" size="medium" icon="object:pool">
<UiLink v-if="pool" :to="`/pool/${pool.id}/dashboard`" size="medium" icon="object:pool">
{{ pool.name_label }}
</UiLink>
<span v-else>
@@ -29,7 +29,7 @@
<VtsQuickInfoRow :label="t('host')">
<template #value>
<template v-if="host">
<UiLink :to="{ name: '/host/[id]/dashboard', params: { id: host.id } }" size="medium" :icon="`object:host:${hostPowerState}`">
<UiLink :to="`/host/${host.id}/dashboard`" size="medium" :icon="`object:host:${hostPowerState}`">
{{ host.name_label }}
</UiLink>
<VtsIcon v-if="isMaster" v-tooltip="t('master')" name="status:primary-circle" size="medium" />

View File

@@ -5,7 +5,7 @@
v-if="vm.name_label !== ''"
size="medium"
:icon="`object:vm:${toLower(vm.power_state)}`"
:to="{ name: '/vm/[id]/dashboard', params: { id: vm.id } }"
:to="`/vm/${vm.id}/dashboard`"
>
{{ vm.name_label }}
</UiLink>
@@ -43,7 +43,7 @@
<template #key>{{ t('pool') }}</template>
<template #value>
<div v-if="pool" class="value">
<UiLink :to="{ name: '/pool/[id]/dashboard', params: { id: pool.id } }" size="small" icon="object:pool">
<UiLink :to="`/pool/${pool.id}/dashboard`" size="small" icon="object:pool">
{{ pool.name_label }}
</UiLink>
</div>
@@ -56,7 +56,7 @@
<template #key>{{ t('host') }}</template>
<template #value>
<div v-if="host" class="value">
<UiLink :to="{ name: '/host/[id]/dashboard', params: { id: host.id } }" size="small" :icon="`object:host:${hostPowerState}`">
<UiLink :to="`/host/${host.id}/dashboard`" size="small" :icon="`object:host:${hostPowerState}`">
{{ host.name_label }}
</UiLink>
<VtsIcon v-if="isMaster" v-tooltip="t('master')" name="status:primary-circle" size="small" />

View File

@@ -2,7 +2,7 @@
<UiCard class="card-container">
<UiCardTitle>
{{ t('networks') }}
<UiLink v-if="ipAddresses.length > 0" size="medium" :to="{ name: '/vm/[id]/networks', params: { id: vm.id } }">
<UiLink v-if="ipAddresses.length > 0" size="medium" :to="`/vm/${vm.id}/networks`">
{{ t('see-details') }}
</UiLink>
</UiCardTitle>

View File

@@ -10,12 +10,7 @@
</VtsQuickInfoRow>
<VtsQuickInfoRow :label="t('affinity-host')">
<template #value>
<UiLink
v-if="vm.affinityHost"
icon="object:host"
:to="{ name: '/host/[id]/dashboard', params: { id: vm.affinityHost } }"
size="small"
>
<UiLink v-if="vm.affinityHost" icon="object:host" :to="`/host/${vm.affinityHost}`" size="small">
{{ affinityHostName }}
</UiLink>
<template v-else>

View File

@@ -3,7 +3,7 @@
<VtsStateHero format="page" type="not-found" size="large">
{{ t('page-not-found') }}
</VtsStateHero>
<UiLink :to="{ name: '/(site)/dashboard' }" size="medium">
<UiLink to="/" size="medium">
{{ t('back-site-dashboard') }}
</UiLink>
</div>

View File

@@ -24,10 +24,11 @@
- [V2V] Remember connection settings in the browser (PR [#9490](https://github.com/vatesfr/xen-orchestra/pull/9490))
- [V2V] Automatically take a snapshot if a running VM doesn't have any (PR [#9471](https://github.com/vatesfr/xen-orchestra/pull/9471))
- [Storage] Add possibility to create VDI in qcow2 format if size > 2TB - 8KB (PR [#9493](https://github.com/vatesfr/xen-orchestra/pull/9493))
- [Backups] Improve VHD dist handling an rework disk merge (delta backups) (PR [#9300](https://github.com/vatesfr/xen-orchestra/pull/9300))
- [REST API] Added POST `/pbds/{id}/actions/plug` and `/pbds/{id}/actions/unplug` rest routes (PR [#9477](https://github.com/vatesfr/xen-orchestra/pull/9477))
- [Backup] Implement Distributed storage for Backups, Mirror Backups and Replications(PR [#9433](https://github.com/vatesfr/xen-orchestra/pull/9433))
### Bug fixes
@@ -58,12 +59,11 @@
- @xen-orchestra/fs patch
- @xen-orchestra/rest-api minor
- @xen-orchestra/vmware-explorer minor
- @xen-orchestra/web minor
- @xen-orchestra/web-core minor
- @xen-orchestra/web patch
- xo-server minor
- xo-server-load-balancer minor
- xo-server-netbox minor
- xo-server-openmetrics minor
- xo-server-openmetrics minor
- xo-web minor
<!--packages-end-->

View File

@@ -50,28 +50,6 @@ Place your `config.toml` (or any `config.*.toml` override) in one of the followi
- **User-specific configuration**:
`~/.config/xo-server/config.toml`
The order of the loading and overriding values in multiple config files is the following:
| Stage | Location | Typical Path | Priority |
| ----- | -------- | ------------------------------ | ------------------- |
| 1 | vendor | `<appDir>/config.*` | lowest |
| 2 | global | `/etc/<appName>/config.*` | overrides vendor |
| 3 | user | `~/.config/<appName>/config.*` | overrides global |
| 4 | local | `./…/.<appName>.*` | overrides all above |
There is no guarantee on the order of the config file loading in the same location.
- `~` is the home directory of the user running xo-server (`/root` for xoa)
- `appDir` is the application installation directory (`/usr/local/lib/node_modules/xo-server` for xo-server on XOA, `/usr/local/lib/node_modules/@xen-orchestra/proxy` for a proxy)
- appName is `xo-proxy` for proxy, `xo-server` for xo-server
- local configuration is not used in xo-server nor proxy
a basic cli can be used to explore the configuration by installing the package `app-conf`, more information in [the official documentation](https://github.com/JsCommunity/app-conf?tab=readme-ov-file#cli)
:::tip
The update feature of XOA can reset any `local` config. Use `/etc/xo-server/config.*` as the preferred config place for XOA.
:::
### Apply the changes
After updating the configuration, restart the XO server process:

View File

@@ -48,14 +48,6 @@ const SCHEMA_SETTINGS = {
type: 'string',
optional: true,
},
distributeBackups: {
type: 'boolean',
optional: true,
},
distributeReplications: {
type: 'boolean',
optional: true,
},
},
additionalProperties: true,
},

View File

@@ -647,12 +647,6 @@ const messages = {
editJobNotFound: "The job you're trying to edit wasn't found",
preferNbd: 'Use NBD to transfer disk if available',
preferNbdInformation: 'A network accessible by XO or the proxy must have NBD enabled.',
distributeBackups: 'Distribute backups accross backup repositories',
distributeBackupsInformation:
'This will write exactly one backup archive of each VM instead of writing one per backup repository',
distributeReplications: 'Distribute replications accross the storage repositories',
distributeReplicationsInformation:
'This will write exactly one replication of each VM backup instead of writing one per storage repository',
nbdConcurrency: 'Number of NBD connection per disk',
cbtDestroySnapshotData: 'Purge snapshot data when using CBT.',
cbtDestroySnapshotDataInformation:

View File

@@ -16,8 +16,6 @@ const DEFAULTS = {
preferNbd: false,
reportWhen: 'failure',
timeout: 0,
distributeBackups: false,
distributeReplications: false,
}
const MODES = {

View File

@@ -152,8 +152,6 @@ const normalizeSettings = ({ copyMode, exportMode, offlineBackupActive, settings
exportRetention: exportMode ? setting.exportRetention : undefined,
snapshotRetention: snapshotMode && !offlineBackupActive ? setting.snapshotRetention : undefined,
preferNbd: undefined,
distributeBackups: undefined,
distributeReplications: undefined,
}
: setting
)
@@ -203,8 +201,6 @@ const getInitialState = ({ preSelectedVmIds, setHomeVmIdsSelection, suggestedExc
showErrors: false,
smartMode: false,
snapshotMode: false,
distributeBackups: false,
distributeReplications: false,
srs: [],
tags: { notValues: suggestedExcludedTags },
vms: preSelectedVmIds,
@@ -291,6 +287,7 @@ const New = decorate([
}
settings[''].timezone = DEFAULT_TIMEZONE
await createBackupNgJob({
name: state.name,
mode: state.isDelta ? 'delta' : 'full',
@@ -363,8 +360,6 @@ const New = decorate([
exportMode: state.exportMode,
copyMode: state.copyMode,
snapshotMode: state.snapshotMode,
distributeBackups: state.distributeBackups,
distributeReplications: state.distributeReplications,
}).toObject()
if (normalizedSettings[''] === undefined) {
@@ -380,6 +375,7 @@ const New = decorate([
}
normalizedSettings[''].timezone = DEFAULT_TIMEZONE
await editBackupNgJob({
id: props.job.id,
name: state.name,
@@ -713,37 +709,25 @@ const New = decorate([
mergeBackupsSynchronously,
})
},
setDistributeBackups({ setGlobalSettings }, distributeBackups) {
setGlobalSettings({
distributeBackups,
})
},
setDistributeReplications({ setGlobalSettings }, distributeReplications) {
setGlobalSettings({
distributeReplications,
})
},
},
computed: {
compressionId: generateId,
formId: generateId,
inputBackupReportTplId: generateId,
inputCbtDestroySnapshotData: generateId,
inputConcurrencyId: generateId,
inputCbtDestroySnapshotData: generateId,
inputFullIntervalId: generateId,
inputHideSuccessfulItemsId: generateId,
inputLongTermRetentionDaily: generateId,
inputLongTermRetentionMonthly: generateId,
inputLongTermRetentionWeekly: generateId,
inputLongTermRetentionYearly: generateId,
inputMaxExportRate: generateId,
inputMergeBackupsSynchronously: generateId,
inputPreferNbd: generateId,
inputNbdConcurrency: generateId,
inputNRetriesVmBackupFailures: generateId,
inputPreferNbd: generateId,
inputDistributeBackups: generateId,
inputDistributeReplications: generateId,
inputBackupReportTplId: generateId,
inputHideSuccessfulItemsId: generateId,
inputMergeBackupsSynchronously: generateId,
inputTimeoutId: generateId,
inputLongTermRetentionDaily: generateId,
inputLongTermRetentionWeekly: generateId,
inputLongTermRetentionMonthly: generateId,
inputLongTermRetentionYearly: generateId,
offlineBackupActive: ({ propSettings, settings = propSettings }) =>
Boolean(settings.getIn(['', 'offlineBackup'])),
@@ -848,15 +832,12 @@ const New = decorate([
const { propSettings, settings = propSettings } = state
const compression = defined(state.compression, job.compression, '')
const {
backupReportTpl = 'mjml',
cbtDestroySnapshotData,
checkpointSnapshot,
concurrency,
fullInterval,
hideSuccessfulItems,
longTermRetention = {},
maxExportRate,
mergeBackupsSynchronously,
nbdConcurrency = 1,
nRetriesVmBackupFailures = 0,
offlineBackup,
@@ -864,8 +845,9 @@ const New = decorate([
preferNbd,
reportRecipients,
reportWhen = 'failure',
distributeBackups = false,
distributeReplications = false,
backupReportTpl = 'mjml',
hideSuccessfulItems,
mergeBackupsSynchronously,
timeout,
} = settings.get('') || {}
@@ -1004,20 +986,6 @@ const New = decorate([
</Li>
))}
</Ul>
<label htmlFor={state.inputDistributeBackups}>
<strong>{_('distributeBackups')}</strong>{' '}
<Tooltip content={_('distributeBackupsInformation')}>
<Icon icon='info' />
</Tooltip>
</label>
<Toggle
className='pull-right'
id={state.inputDistributeBackups}
name='distributeBackups'
value={distributeBackups}
disabled={Object.keys(state.remotes).length < 2}
onChange={effects.setDistributeBackups}
/>
</FormGroup>
)}
</CardBlock>
@@ -1064,20 +1032,6 @@ const New = decorate([
</Li>
))}
</Ul>
<label htmlFor={state.srs}>
<strong>{_('distributeReplications')}</strong>{' '}
<Tooltip content={_('distributeReplicationsInformation')}>
<Icon icon='info' />
</Tooltip>
</label>
<Toggle
className='pull-right'
id={state.inputDistributeReplications}
name='distributeReplications'
value={distributeReplications}
disabled={Object.keys(state.remotes).length < 2}
onChange={effects.setDistributeReplications}
/>
</FormGroup>
</CardBlock>
</Card>

View File

@@ -239,11 +239,6 @@ const NewMirrorBackup = decorate([
}),
setMergeBackupsSynchronously: ({ setAdvancedSettings }, mergeBackupsSynchronously) =>
setAdvancedSettings({ mergeBackupsSynchronously }),
setdistributeBackups({ setAdvancedSettings }, distributeBackups) {
setAdvancedSettings({
distributeBackups,
})
},
},
computed: {
vmBackupOptions: async state => {
@@ -285,8 +280,6 @@ const NewMirrorBackup = decorate([
inputHideSuccessfulItemsId: generateId,
inputMirrorAllId: generateId,
inputMergeBackupsSynchronously: generateId,
inputdistributeBackup: generateId,
inputdistributeReplication: generateId,
isBackupInvalid: state =>
state.isMissingName ||
state.isMissingBackupMode ||
@@ -328,7 +321,6 @@ const NewMirrorBackup = decorate([
hideSuccessfulItems,
nRetriesVmBackupFailures = 0,
mergeBackupsSynchronously,
distributeBackups,
} = state.advancedSettings
return (
<form id={state.formId}>
@@ -583,20 +575,6 @@ const NewMirrorBackup = decorate([
</Li>
))}
</Ul>
<label htmlFor={state.inputdistributeBackups}>
<strong>{_('distributeBackups')}</strong>{' '}
<Tooltip content={_('distributeBackupsInformation')}>
<Icon icon='info' />
</Tooltip>
</label>
<Toggle
className='pull-right'
id={state.inputdistributeBackups}
name='setdistributeBackups'
value={distributeBackups}
disabled={state.targetRemoteIds.length < 2}
onChange={effects.setdistributeBackups}
/>
</FormGroup>
</CardBlock>
</Card>

View File

@@ -331,8 +331,6 @@ class JobsTable extends React.Component {
preferNbd,
proxyId,
reportWhen,
distributeBackups,
distributeReplications,
timeout,
} = getSettingsWithNonDefaultValue(job.mode, {
compression: job.compression,
@@ -387,8 +385,6 @@ class JobsTable extends React.Component {
{nRetriesVmBackupFailures > 0 && (
<Li>{_.keyValue(_('nRetriesVmBackupFailures'), nRetriesVmBackupFailures)}</Li>
)}
{distributeBackups && <Li>{_('distributeBackups')}</Li>}
{distributeReplications && <Li>{_('distributeReplications')}</Li>}
</Ul>
)
},