Compare commits

...

2 Commits

Author SHA1 Message Date
Florent BEAUCHAMP
9ef397105f fix(xo-server): don't use default backup network for non network tasks
stats (vm/hosts)
log extraction by rest api
perf alert plugin
2024-12-17 15:55:40 +00:00
Florent BEAUCHAMP
250aab6585 feat(xen-api): add option to ignore pool default backup network for getResource 2024-12-17 15:55:13 +00:00
4 changed files with 11 additions and 6 deletions

View File

@@ -420,7 +420,7 @@ export class Xapi extends EventEmitter {
// HTTP requests
// ===========================================================================
async getResource($cancelToken, pathname, { host, query, task } = {}) {
async getResource($cancelToken, pathname, { host, query, task, ignoreDefaultBackupNetwork = false } = {}) {
const taskRef = await this._autoTask(task, `Xapi#getResource ${pathname}`)
query = { ...query, session_id: this.sessionId }
@@ -440,7 +440,7 @@ export class Xapi extends EventEmitter {
let url = new URL('http://localhost')
url.protocol = this._url.protocol
await this._setHostAddressInUrl(url, host)
await this._setHostAddressInUrl(url, host, { ignoreDefaultBackupNetwork })
const response = await this._addSyncStackTrace(
pRetry(
@@ -1003,9 +1003,9 @@ export class Xapi extends EventEmitter {
})
}
async _setHostAddressInUrl(url, host) {
async _setHostAddressInUrl(url, host, { ignoreDefaultBackupNetwork } = {}) {
const poolBackupNetwork = this._pool.other_config['xo:backupNetwork']
if (host === undefined && poolBackupNetwork === undefined) {
if (ignoreDefaultBackupNetwork || (host === undefined && poolBackupNetwork === undefined)) {
const xapiUrl = this._url
url.hostname = xapiUrl.hostname
url.port = xapiUrl.port

View File

@@ -757,6 +757,7 @@ ${entriesWithMissingStats.map(({ listItem }) => listItem).join('\n')}`
json: 'true',
start: serverTimestamp - secondsAgo,
},
ignoreDefaultBackupNetwork: true,
}
return xapi.getResource('/rrd_updates', payload)
})

View File

@@ -254,6 +254,7 @@ export default class XapiStats {
json: 'true',
start: timestamp,
},
ignoreDefaultBackupNetwork: true,
})
.then(response => response.body.text())
.then(data => {

View File

@@ -621,7 +621,7 @@ export default class RestApi {
async 'audit.txt'(req, res) {
const host = req.xapiObject
const response = await host.$xapi.getResource('/audit_log', { host })
const response = await host.$xapi.getResource('/audit_log', { host, ignoreDefaultBackupNetwork: true })
res.setHeader('content-type', 'text/plain')
await pipeline(response.body, compressMaybe(req, res))
@@ -630,7 +630,10 @@ export default class RestApi {
async 'logs.tgz'(req, res) {
const host = req.xapiObject
const response = await host.$xapi.getResource('/host_logs_download', { host })
const response = await host.$xapi.getResource('/host_logs_download', {
host,
ignoreDefaultBackupNetwork: true,
})
res.setHeader('content-type', 'application/gzip')
await pipeline(response.body, res)