Skip to content

CA-423760: Retain host.last_update_hash on an ejected host#6951

Open
minglumlu wants to merge 2 commits intoxapi-project:masterfrom
minglumlu:private/mingl/CA-423760
Open

CA-423760: Retain host.last_update_hash on an ejected host#6951
minglumlu wants to merge 2 commits intoxapi-project:masterfrom
minglumlu:private/mingl/CA-423760

Conversation

@minglumlu
Copy link
Member

Generally an ejected host can be considered as a fresh-installed one.
But in practice, the update level (the hash) is useful to determine the
update state of an ejected host.

One of the cases is a host was ejected from a pool. In this case, the
retained applied update hash is useful to determine if the host can join
the pool again easily.

Generally an ejected host can be considered as a fresh-installed one.
But in practice, the update level (the hash) is useful to determine the
update state of an ejected host.

One of the cases is a host was ejected from a pool. In this case, the
retained applied update hash is useful to determine if the host can join
the pool again easily.

Signed-off-by: Ming Lu <ming.lu@cloud.com>
When pool.repositories becomes empty, the
host.latest_synced_updates_applied is meaningless and it can't be
refreshed by calling pool.sync_updates.

Signed-off-by: Ming Lu <ming.lu@cloud.com>
let k = "last_update_hash" in
let x = Localdb.get k |> Option.value ~default:"" in
(try Localdb.del k with _ -> ()) ;
debug "Restore last_update_hash to %s ..." x ;
Copy link
Member

@psafont psafont Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to be confusing with the empty string, better show it's meant to empty:

Suggested change
debug "Restore last_update_hash to %s ..." x ;
debug {|Restore last_update_hash to "%s" ...|} x ;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use %S and it will be enclosed in quotes automatically.

let k = "last_update_hash" in
let x = Localdb.get k |> Option.value ~default:"" in
(try Localdb.del k with _ -> ()) ;
debug "Restore last_update_hash to %s ..." x ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use %S and it will be enclosed in quotes automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants