Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add block size to unikernel_info, also add the possibility to change arguments in restart #195

Merged
merged 10 commits into from
Feb 5, 2025

Conversation

hannesm
Copy link
Collaborator

@hannesm hannesm commented Oct 24, 2024

//cc @PizieDust @reynir

There's still more work needed to retain backwards compatibility.

The main question I have is about the albatross-client.. Now the restart subcommand can replace the arguments, but this is guarded by an additional flag "--replace-arguments". I came there since just checking whether the arguments are provided or not does not suffice (due to default values, and also maybe a user wants to restart their "hello world" this time with providing no argv at all. -- this wouldn't easily be possible without such a flag. Still it makes me wonder whether we want a separate (sub)command for it -- but then I struggle with naming. Any ideas?

Also, the restart-with-arguments-replaced can't check the manifest on the client side (since there's no image available)... I'm hesitating on what to do here -- I'd like to avoid someone to do a restart and end up with "sorry, your arguments didn't specify the required devices". Any ideas?

@hannesm
Copy link
Collaborator Author

hannesm commented Oct 31, 2024

I added the needed backwards-compatibility code. This is ready for review.

So, old clients can talk to new servers. There's no attempt to make new clients talk to old servers (they'd need to send old commands, so figure out which version the server has before sending the initial command, or re-connect on failure and try with an older version).

Comment on lines +126 to +133
type arguments = {
fail_behaviour : fail_behaviour;
cpuid : int ;
memory : int ;
block_devices : (string * string option * int option) list ;
bridges : (string * string option * Macaddr.t option) list ;
argv : string list option ;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that's the new record for restart with arguments.

Comment on lines +150 to 173
type block_info = {
unikernel_device : string ;
host_device : string ;
sector_size : int ;
size : int ;
}

type net_info = {
unikernel_device : string ;
host_device : string ;
mac : Macaddr.t ;
}

type info = {
typ : typ ;
fail_behaviour : fail_behaviour;
cpuid : int ;
memory : int ;
block_devices : (string * string option * int option) list ;
bridges : (string * string option * Macaddr.t option) list ;
block_devices : block_info list ;
bridges : net_info list ;
argv : string list option ;
digest : string ;
started : Ptime.t ;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I solved some confusion (hopefully) by moving to records for block and network devices -- they also no longer have any optional fields, but are completely filled.

@hannesm
Copy link
Collaborator Author

hannesm commented Oct 31, 2024

Maybe to elaborate a bit: we're not concerned about API versioning / compatibility here. We just upgrade the API as we want. ;)

What we are concerned are the clients and servers that are deployed by different parties (i.e. not under our control), so esp. an old client should not be punished by our server. In this specific PR, the old client will get reasonable (the same, expected) answers from the new server.

This means that in our serialisation (vmm_asn.ml), we do some extra work to keep track of the old wire formats. In addition the `Old_unikernel_info3 has been introduced (used to be named `Unikernel_info), which now results in the `Old_unikernels_info3 (used to be `Unikernel_info) -- the wire format of these two constructors is preserved -- the naming differs, since the current one (used by up-to-date clients and servers) is named `Unikernel_info.

For the restart, it is slightly simpler, since the old command did result in a generic reply - not a specific one (i.e. a success or an error only) -- here we can just translate the old wire format to `Unikernel_restart None to preserve the existing behaviour.

I guess reading the diff is sometimes confusing (as is writing the code) - and we should add tests for the different versions. But I've been too lazy for writing these tests.

@hannesm
Copy link
Collaborator Author

hannesm commented Feb 4, 2025

rebased on main, @reynir would you mind to look over this PR?

src/vmm_core.ml Show resolved Hide resolved
src/vmm_vmmd.ml Outdated Show resolved Hide resolved
src/vmm_core.ml Show resolved Hide resolved
src/vmm_asn.ml Outdated Show resolved Hide resolved
src/vmm_asn.ml Show resolved Hide resolved
src/vmm_asn.ml Show resolved Hide resolved
src/vmm_asn.ml Show resolved Hide resolved
src/vmm_asn.ml Outdated Show resolved Hide resolved
client/albatross_client.ml Show resolved Hide resolved
@reynir
Copy link
Contributor

reynir commented Feb 5, 2025

I will merge #207 then rebase so we can have CI pass.

hannesm and others added 10 commits February 5, 2025 12:20
this requires some additional work to re-introduce backward compatibility
TODO: this needs a bit more thought in respect to backwards compatibility
A new client talking to an old server will still not be understood
We want to fail early without killing the running instance rather than
kill and then fail with an error without actually restarting.
Co-authored-by: Reynir Björnsson <[email protected]>
@reynir reynir merged commit 26dd65f into main Feb 5, 2025
10 of 13 checks passed
@reynir reynir deleted the more branch February 5, 2025 12:50
hannesm added a commit to hannesm/opam-repository that referenced this pull request Feb 5, 2025
CHANGES:

* albatross-daemon: on startup backup the state file (robur-coop/albatross#206 @hannesm, fixes robur-coop/albatross#203)
* Add block size to info command, adapt types slightly (robur-coop/albatross#195 @hannesm)
* Allow the arguments in restart to be changed (robur-coop/albatross#195 @hannesm)
* Update to ocaml-solo5-elftool 0.4.0 - bump OCaml lower bound to 4.14
  (robur-coop/albatross#207 @reynir, robur-coop/albatross#208)
* BUGFIX: restart command kills the unikernel first (robur-coop/albatross#205 @reynir)
* Print manifest on mismatch (robur-coop/albatross#196 @reynir)
* Albatross-console: use physical equality for file descriptors (robur-coop/albatross#200 @reynir)
* Albatross-console: allow multiple subscribers (robur-coop/albatross#194 @reynir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants