Skip to content

Commit

Permalink
Merge branch 'users/bgriddaluru/vm_placement_with_zones_integrated' i…
Browse files Browse the repository at this point in the history
…nto users/mkatturu/AvailabilityZonesChanges
  • Loading branch information
bgriddaluru authored Jul 25, 2024
2 parents 0e99dae + c60194c commit 18e4ce7
Show file tree
Hide file tree
Showing 5 changed files with 419 additions and 398 deletions.
18 changes: 18 additions & 0 deletions pkg/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func InitStatus() *common.Status {
Version: GenerateVersion(),
DownloadStatus: &common.DownloadStatus{},
ValidationStatus: &common.ValidationStatus{},
PlacementStatus: &common.PlacementStatus{},
}
}

Expand Down Expand Up @@ -96,6 +97,16 @@ func GetValidationStatus(s *common.Status) []*common.ValidationState {
return s.GetValidationStatus().GetValidationState()
}

func SetPlacementStatus(s *common.Status, placementState *common.PlacementStatus) {
s.PlacementStatus = new(common.PlacementStatus)
s.PlacementStatus.Status = placementState.GetStatus()
s.PlacementStatus.Message = placementState.GetMessage()
}

func GetPlacementStatus(s *common.Status) common.PlacementStatusType {
return s.GetPlacementStatus().GetStatus()
}

// GetStatuses - converts status to map
func GetStatuses(status *common.Status) map[string]*string {
statuses := map[string]*string{}
Expand All @@ -109,6 +120,8 @@ func GetStatuses(status *common.Status) map[string]*string {
statuses["Version"] = &version
dstate := status.GetDownloadStatus().String()
statuses["DownloadStatus"] = &dstate
placementStatus := status.GetPlacementStatus().String()
statuses["PlacementStatus"] = &placementStatus
return statuses
}

Expand All @@ -135,6 +148,11 @@ func GetFromStatuses(statuses map[string]*string) (status *common.Status) {
proto.UnmarshalText(*val, ps)
status.DownloadStatus = ps
}
if val, ok := statuses["PlacementStatus"]; ok {
ps := new(common.PlacementStatus)
proto.UnmarshalText(*val, ps)
status.PlacementStatus = ps
}

return
}
Loading

0 comments on commit 18e4ce7

Please sign in to comment.