fix(xo-server-usage-report): handle SR without container (#3614)
This is a work-around for an XO bug. Related to #3600
This commit is contained in:
@@ -342,8 +342,13 @@ async function getSrsStats ({ xo, xoObjects }) {
|
||||
const totalSpace = sr.size / gibPower
|
||||
const usedSpace = sr.physical_usage / gibPower
|
||||
let name = sr.name_label
|
||||
if (!sr.shared) {
|
||||
name += ` (${find(xoObjects, { id: sr.$container }).name_label})`
|
||||
// [Bug in XO] a SR with not container can be found (SR attached to a PBD with no host attached)
|
||||
let container
|
||||
if (
|
||||
!sr.shared &&
|
||||
(container = find(xoObjects, { id: sr.$container })) !== undefined
|
||||
) {
|
||||
name += ` (${container.name_label})`
|
||||
}
|
||||
|
||||
const { stats } = await xo.getXapiSrStats(sr.id, GRANULARITY)
|
||||
|
||||
Reference in New Issue
Block a user