Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(xo-server): handle unfetched VDIs in pool.$ha_statefiles #6404

Merged
merged 6 commits into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@

<!--packages-start-->

- xo-server patch

<!--packages-end-->
5 changes: 4 additions & 1 deletion packages/xo-server/src/xapi-object-to-xo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ const ALLOCATION_BY_TYPE = {
const { defineProperties, freeze } = Object

function link(obj, prop, idField = '$id') {
if (obj === undefined) {
return undefined
}
const dynamicValue = obj[`$${prop}`]
if (dynamicValue == null) {
return dynamicValue // Properly handles null and undefined.
Expand Down Expand Up @@ -107,7 +110,7 @@ const TRANSFORMS = {
current_operations: obj.current_operations,
default_SR: link(obj, 'default_SR'),
HA_enabled: Boolean(obj.ha_enabled),
haSrs: obj.$ha_statefiles.map(vdi => link(vdi, 'SR')),
haSrs: obj.$ha_statefiles.map(vdi => link(vdi, 'SR')).filter(sr => sr !== undefined),
julien-f marked this conversation as resolved.
Show resolved Hide resolved
master: link(obj, 'master'),
tags: obj.tags,
name_description: obj.name_description,
Expand Down