logic improvement
This commit is contained in:
@@ -113,6 +113,11 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if strings.ToLower(matches[1]) == strings.ToLower(event.CloudEvent.Data.VM.Name) {
|
if strings.ToLower(matches[1]) == strings.ToLower(event.CloudEvent.Data.VM.Name) {
|
||||||
h.Logger.Debug("This disk belongs to this VM")
|
h.Logger.Debug("This disk belongs to this VM")
|
||||||
|
found = true
|
||||||
|
params.UpdateType = "diskchange"
|
||||||
|
diskSize := h.calculateNewDiskSize(event)
|
||||||
|
params.NewProvisionedDisk = sql.NullFloat64{Float64: diskSize, Valid: diskSize > 0}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
h.Logger.Debug("This disk belongs to a different VM, don't record this config change")
|
h.Logger.Debug("This disk belongs to a different VM, don't record this config change")
|
||||||
}
|
}
|
||||||
@@ -122,11 +127,8 @@ func (h *Handler) VmModify(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO - recalculate total disk size
|
// TODO - recalculate total disk size
|
||||||
h.Logger.Debug("Detected config change for VM disk")
|
//h.Logger.Debug("Detected config change for VM disk")
|
||||||
found = true
|
|
||||||
params.UpdateType = "diskchange"
|
|
||||||
diskSize := h.calculateNewDiskSize(event)
|
|
||||||
params.NewProvisionedDisk = sql.NullFloat64{Float64: diskSize, Valid: diskSize > 0}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user