jmsperu commented on PR #13743:
URL: https://github.com/apache/cloudstack/pull/13743#issuecomment-7112279204

   Tested on 4.22.1.1, KVM (Ubuntu 24.04), NFS primary and secondary. The PR's 
main code was built on the 4.22.1.1 tag; the only change I made is that the new 
setting is read at global scope, because the scoped lookup helper is not on 
4.22.
   
   Setup: one stopped instance, an HOURLY snapshot policy on its ROOT volume, 
schedule moved forward by hand so each run comes after about 10 minutes.
   
   | Step | Expected with the PR | What happened |
   |---|---|---|
   | Original code, instance off the whole time | (the issue) | A new snapshot 
at every run, all of the same size (43.6 MB): 7 snapshots |
   | PR, setting on, instance still off | no new snapshot | A new snapshot was 
taken |
   | PR, instance started and stopped again | one new snapshot | One new 
snapshot (correct) |
   | PR, next run, instance still off | no new snapshot | A new snapshot was 
taken |
   
   So the issue reproduces on 4.22.1.1, but in this lab the PR never skipped: 
no "Skipped scheduled snapshot" log line and no SNAPSHOT.SKIP event.
   
   Cause as far as I can see: shouldSkipUnchangedVolumeSnapshot only skips when 
the instance's power state is PowerOff. In this lab an instance stopped through 
CloudStack never had that value. Its row showed state Stopped with power state 
PowerOn (power state update time = the time of the stop) for the 30 minutes of 
one run, and Stopped with PowerReportMissing in another run. So the condition 
is false for the normal "user stopped the instance" case, which is the case the 
issue describes.
   
   I also tried a small variant that accepts Stopped together with 
PowerReportMissing. It did not skip either, because in that run the row stayed 
at Stopped / PowerOn:
   
   | Step (variant) | Instance row | Result |
   |---|---|---|
   | Instance off, first run | Stopped / PowerOn | snapshot taken (expected, 
first one) |
   | Instance still off | Stopped / PowerOn | snapshot taken (skip expected) |
   | Started and stopped again | Stopped / PowerOn | one snapshot (expected) |
   | Instance still off | Stopped / PowerOn | snapshot taken (skip expected) |
   
   Suggestion: do not rely on the power state for this. Use the instance state 
(Stopped) and the time it entered that state, compared with the creation time 
of the last backed up snapshot. I have not tested a version built that way.
   
   Could you say on which hypervisor and how the instance was stopped when you 
saw PowerOff in your test? If it is reachable on another setup I am happy to 
rerun.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to