1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

M #-: Fix the snapshot schemas (GOCA)

The schema for vm and snapshots does not correctly deserialize
the raw xml because the snapshot field in VM struct is not an array.

This change fixes the snapshot field, and adds DiskID to DiskSnapshot
struct so that after unmarshalling the snapshots are grouped by disk

Signed-off-by: Rafael Lopez <rafael.lopez@softiron.com>
(cherry picked from commit 278b14930bf1409f4dc5c844bad47e359240f3ca)
(cherry picked from commit 647a4851b8fe16590c7d9badec399992fc9f5253)
This commit is contained in:
Raf Lopez 2022-09-30 11:43:51 +10:00 committed by Ruben S. Montero
parent 365d3d1082
commit 4648c918b6
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 23 additions and 22 deletions

View File

@ -33,6 +33,7 @@ type Snapshot struct {
type DiskSnapshot struct {
AllowOrphans string `xml:"ALLOW_ORPHANS"`
CurrentBase int `xml:"CURRENT_BASE"`
DiskID int `xml:"DISK_ID"`
NextSnapshot int `xml:"NEXT_SNAPSHOT"`
Snapshots []Snapshot `xml:"SNAPSHOT"`
}

View File

@ -38,28 +38,28 @@ type PoolMonitoring struct {
// VM represents an OpenNebula Virtual Machine
type VM struct {
XMLName xml.Name `xml:"VM"`
ID int `xml:"ID,omitempty"`
UID int `xml:"UID,omitempty"`
GID int `xml:"GID,omitempty"`
UName string `xml:"UNAME,omitempty"`
GName string `xml:"GNAME,omitempty"`
Name string `xml:"NAME,omitempty"`
Permissions *shared.Permissions `xml:"PERMISSIONS,omitempty"`
LastPoll int `xml:"LAST_POLL,omitempty"`
StateRaw int `xml:"STATE,omitempty"`
LCMStateRaw int `xml:"LCM_STATE,omitempty"`
PrevStateRaw int `xml:"PREV_STATE,omitempty"`
PrevLCMStateRaw int `xml:"PREV_LCM_STATE,omitempty"`
ReschedValue int `xml:"RESCHED,omitempty"`
STime int `xml:"STIME,omitempty"`
ETime int `xml:"ETIME,omitempty"`
DeployID string `xml:"DEPLOY_ID,omitempty"`
MonitoringInfos dyn.Template `xml:"MONITORING,omitempty"`
Template Template `xml:"TEMPLATE,omitempty"`
UserTemplate UserTemplate `xml:"USER_TEMPLATE,omitempty"`
HistoryRecords []HistoryRecord `xml:"HISTORY_RECORDS>HISTORY,omitempty"`
Snapshots shared.DiskSnapshot `xml:"SNAPSHOTS,omitempty"`
XMLName xml.Name `xml:"VM"`
ID int `xml:"ID,omitempty"`
UID int `xml:"UID,omitempty"`
GID int `xml:"GID,omitempty"`
UName string `xml:"UNAME,omitempty"`
GName string `xml:"GNAME,omitempty"`
Name string `xml:"NAME,omitempty"`
Permissions *shared.Permissions `xml:"PERMISSIONS,omitempty"`
LastPoll int `xml:"LAST_POLL,omitempty"`
StateRaw int `xml:"STATE,omitempty"`
LCMStateRaw int `xml:"LCM_STATE,omitempty"`
PrevStateRaw int `xml:"PREV_STATE,omitempty"`
PrevLCMStateRaw int `xml:"PREV_LCM_STATE,omitempty"`
ReschedValue int `xml:"RESCHED,omitempty"`
STime int `xml:"STIME,omitempty"`
ETime int `xml:"ETIME,omitempty"`
DeployID string `xml:"DEPLOY_ID,omitempty"`
MonitoringInfos dyn.Template `xml:"MONITORING,omitempty"`
Template Template `xml:"TEMPLATE,omitempty"`
UserTemplate UserTemplate `xml:"USER_TEMPLATE,omitempty"`
HistoryRecords []HistoryRecord `xml:"HISTORY_RECORDS>HISTORY,omitempty"`
Snapshots []shared.DiskSnapshot `xml:"SNAPSHOTS,omitempty"`
// Not filled with NewUserPool call
LockInfos *shared.Lock `xml:"LOCK"`