-
Notifications
You must be signed in to change notification settings - Fork 573
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
overlord,daemon,cmd: re-map snap names around the edges of snapd #5491
Commits on Jul 12, 2018
-
overlord/ifacestate: add re-mapping function for plugs and slots
This patch adds re-mapping functions for plugs and slots. The idea with re-mapping is that snapd can provide the appearance of a particular plug and slot placement as observed in the on-disk state and over-the-wire communication while having a different actual placement in memory. In practice this is designed to allow us to place implicit slots on the snapd snap. Re-mapping is implemented by a golang interface. Currently only a no-op mapper is used. The mapper is global but could be moved to the interface manager after changing a large number of functions to become methods on the interface manager. This can be done in a follow-up, if desired. Apart from the golang interface, which provides the low-level operations, a number of helpers for other data types are provided. This includes connection references and plug and slot information objects. Those helpers are used by the daemon API layer in one of the subsequent patches. Two real mappers are implemented: a no-op mapper and a core<=>snapd mapper. For testing a upper<=>lower case mapper is used, for extra clarity. Everything is accompanied by unit tests. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for ff972c7 - Browse repository at this point
Copy the full SHA ff972c7View commit details -
overlord/ifacestate: drop re-mapping snap.{Plug,Slog}Info
The helpers for re-mapping the aforementioned types are no longer necessary due to re-factoring and cleanup of the daemon code. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 004aea1 - Browse repository at this point
Copy the full SHA 004aea1View commit details -
overlord/ifacestate: re-map connection state on load/store from state
This patch changes getConns and setConns to re-map connection state just after loading from the state and just before being saved to the state. This is coupled with explicit tests for {get,set}Conns that we apparently didn't have. Note that at this stage the code is still dormant since re-mapping is a no-op until the "snapd" snap becomes the host of the implicit slots. This is the "back" side of the re-mapping. The "front" side applies to re-mapping of the API layer. It is provided in the follow-up patch. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 0a53fdc - Browse repository at this point
Copy the full SHA 0a53fdcView commit details -
daemon: re-map interface state in API requests/responses
This patch changes interface connection, disconnection and query APIs to apply re-mapping on incoming requests and outgoing responses. This allows code to issue explicit connect and disconnect API requests for the "core" snap even though implicit slots are on the "snapd" snap. Similarly the API for querying interface connections (both the legacy, as used by "snap interfaces" and the per-interface as used by "snap interface") are updated to take advantage of this feature. Note that at this stage the code is still dormant since re-mapping is a no-op until the "snapd" snap becomes the host of the implicit slots. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 24c2448 - Browse repository at this point
Copy the full SHA 24c2448View commit details -
daemon: drop unused, commented-out test
We don't need a test that doesn't work. I added tests for this in the previous patch anyway. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 72f358b - Browse repository at this point
Copy the full SHA 72f358bView commit details
Commits on Jul 13, 2018
-
overlord,daemon: drop return values from interface mappers
The re-mapping helper functions were returning a boolean if a mapping was actually applied (something changed) but this value is actually no longer used anywhere. In the spirit of YAGNI let's remove it. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for b7f95f0 - Browse repository at this point
Copy the full SHA b7f95f0View commit details -
overlord,daemon: make re-mapping helpers functional
The remaping functions were modifying their arguments. This patch makes them return a modified copy instead. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for dc43dd3 - Browse repository at this point
Copy the full SHA dc43dd3View commit details -
daemon,api: separate mappings for state and API
This patch changes a number of things, the main concept is that the mapping system can now offer separate replacements for state handling, where we want to stick to the word "core" for compatibility, and the API layer where we want to start using the "system" word as a nickname to whatever is providing implicit slots. As such the mapping functions are duplicated, once for state and once for request/response. The intermediate helpers for working with connection references are dropped because this just multiplies trivial functions that don't need to be used. The existing NilMapper is expanded to cover the new API. The existing CoreSnapdMapper is split into two new mappers: CoreSnapdSystemMapper which uses core in the state, snapd in memory and system in the API layer and a new CoreCoreSystemMapper which uses core in the state and in memory but system in the API layer. That last new mapper is a candidate for transition of spread tests that could start to talk about "system" natively (without the hacks in the client) and would then work without change once the core-snapd-system mapper can be used, which will happen once snapd starts to host implicit slots. The daemon and state are obviously updated to switch to the appopriate mapping helper. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for d3c1040 - Browse repository at this point
Copy the full SHA d3c1040View commit details -
overlord/ifacestate: move mapper closer to related functions
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 8197c6b - Browse repository at this point
Copy the full SHA 8197c6bView commit details -
overlord/ifacestate: rename NilMapper to IdentityMapper
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for e414445 - Browse repository at this point
Copy the full SHA e414445View commit details -
cmd,overlord,daemon: merge snap nickname with iface mapper
While testing the interface mapper I realized the nickname system is still in use and actually clashes with the interface mapper. Looking at it close it is obvious that the nickname system must be folded into the interface mapper for consistency and that the interface mapper must be able to map snap names more than than plug or slot references. Without this change we can never have implicit slots on the "snapd" snap because implicit gadget connections would resolve to "core" (which can be absent) and because the nickname handling is would clash with the idea of using "system" in the API layer but "snapd" in the memory (because nicknames would effectively change "system" to "core". To fix this I extended the interface mapper to also be a snap name mapper and removed the nickname system entirely. This also allows us to drop the ever-growing list of special cases in the client (for interface abbreviation logic). More precisely this patch: - drops the {Use,Drop}Nick functions from the snap package - changes the default mapper to CoreCoreSystem mapper - adds a SnapMapper that has request/response state save/load functions - makes InterfaceMapper a superset of SnapMapper - refactors CoreCoreSystemMapper and CoreSnapdSystemMapper - makes the daemon use RemapSnapFromRequest instead of the nick - makes gadget resolver use RemapSnapFromRequest to resolve "system" - makes the client abbreviate just "system" slots This comes without a full array of tests but without breaking any existing test (woot). It also passes spread which is promising. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 6b7a168 - Browse repository at this point
Copy the full SHA 6b7a168View commit details -
overlord,daemon: reduce InteraceMapper to SnapMapper
With the insight from the previous patch I have now simplified all of the interface mapper to just a SnapMapper wich can be thought as server-side nickname system. This mostly cuts the amount of boilerplate code that doesn't do anything we currently need by limiting the re-mapping to just snap names and to not be able to differentiate plugs and slots anymore. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 23dca54 - Browse repository at this point
Copy the full SHA 23dca54View commit details -
overlord/ifacestate: add extra tests for better coverage
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for a950542 - Browse repository at this point
Copy the full SHA a950542View commit details -
overlord/ifacestate: remove uneeded teardown method
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for df33bd3 - Browse repository at this point
Copy the full SHA df33bd3View commit details -
daemon: avoid changing existing ConnRef
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 039be9e - Browse repository at this point
Copy the full SHA 039be9eView commit details -
daemon: undo needless patch delta
This patch just restores original code where it doesn't make any meaningful changes. Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 360ad8e - Browse repository at this point
Copy the full SHA 360ad8eView commit details
Commits on Jul 16, 2018
-
Configuration menu - View commit details
-
Copy full SHA for 292c38b - Browse repository at this point
Copy the full SHA 292c38bView commit details
Commits on Jul 17, 2018
-
Configuration menu - View commit details
-
Copy full SHA for 61e4d18 - Browse repository at this point
Copy the full SHA 61e4d18View commit details -
overlord/ifacestate: update comments to refer to identity mapper
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 4f71891 - Browse repository at this point
Copy the full SHA 4f71891View commit details -
overlord/confistate: add tests for remappers
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Configuration menu - View commit details
-
Copy full SHA for 339a091 - Browse repository at this point
Copy the full SHA 339a091View commit details