64 Commits

Author SHA1 Message Date
Michael Vogt
87c46856d8 daemon: improve TODO/XXX comment for getGadgetDiskMapping 2023-03-06 10:58:38 +01:00
Michael Vogt
722d410cc9 many: deal with EncryptionTypeLUKSWithICE in more places
This commit updates the if/case statements that check for
secboot.EncryptionTypeLUKS to also deal with EncryptionTypeLUKSWithICE
and add some TODO:ICE: about cleanup we can do later.
2023-03-06 10:58:38 +01:00
alfonsosanchezbeato
34da9d970b gadget: include OnDiskStructure in LaidOutStructure (#12515)
Include OnDiskStructure in LaidOutStructure so we really have all the
needed information to create partitions and content in
LaidOutStructure. Also, remove the now unneeded
onDiskAndLaidoutStructure.

* gadget: change FindDeviceForStructure input to a VolumeStructure

as we did not need the full LaidOutStructure. This also simplifies the
tests.

* gadget/install: use OnDiskStructure in ensureNodesExist

As we did not need the full laid out structure.

* gadget: include OnDiskStructure in LaidOutStructure

Include OnDiskStructure in LaidOutStructure so we really have all the
needed information to create partitions and content in
LaidOutStructure. Also, remove the now unneeded
onDiskAndLaidoutStructure.

* gadget: remove StartOffset from LaidOutStructure

It is not needed as we have the same field in OnDiskStructure, which
is contained in LaidOutStructure.

* gadget: replace access to LaidOutStructure.VolumeStructure by methods

where possible.

* gadget: set encryption info in gadget.LaidoutVolume

Pass around encryption information so we can set the encryption info
in LaidOutStructure nearer to where it is created, which simplifies
the code and fixes cases not considered before.

* tests/muinstaller: use temporarily commit from branch for the build

To be removed as soon as https://github.com/snapcore/snapd/pull/12515
is merged.
2023-02-14 10:06:13 +00:00
Miguel Pires
06d4688ffd daemon: add migrate-home action to debug/ API endpoint
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2022-06-21 15:49:01 +01:00
Ian Johnson
a6a0b8d91b daemon/api_debug.go: automatically set DiskVolume...Options.AllowImp...Data
This makes the debug endpoint work on UC18 and UC16 devices which have this
implicit system-data role.

Also add a small check to make sure the options are non-nil in
AllDiskVolumeDeviceTraits when we provide them to
DiskTraitsFromDeviceAndValidate.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2022-02-20 08:55:43 -06:00
Ian Johnson
1d1edde773 cmd/snap/debug, daemon: add debug command for getting gadget vol -> disk traits
This is useful in debugging gadget asset updates.

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2022-02-01 14:30:18 -06:00
Ian Johnson
8084dd8b33 cmd/snap, daemon: add debug command for getting OnDiskVolume dump
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2022-01-10 16:07:32 -06:00
Samuele Pedroni
716b13b5f9 daemon: simplify SyncResponse
it doesn't take Meta anymore
2021-06-03 13:49:26 +02:00
Samuele Pedroni
25e9e2e1f9 daemon: start coalescing resp into respJSON and evaporating Meta
the cleanliness gained by having two structures with almost
the same fields is probably not enough to justify both of them,
especially because daemon is where we are supposed to build
responses, we might as well deal with the details

Meta was a quick hack, also it hasn't really grown since so we can
try to remove it now

AsyncResponse never takes anything over the result but the change id
2021-05-28 19:48:19 +02:00
Paweł Stołowski
06f8fa7566 Merge branch 'master' into debug-stacktrace 2021-05-27 12:06:22 +02:00
Samuele Pedroni
f0e0f8077a tests/nested/core/core20-create-recovery: verify that recovery system can be created at runtime
Merge pull request #10255 from bboozzoo/bboozzoo/uc20-recovery-system-debug-create
2021-05-27 12:00:24 +02:00
Paweł Stołowski
7490eb74a1 Merge branch 'master' into debug-stacktrace 2021-05-27 10:24:39 +02:00
Maciej Borzecki
4af3a049f1 daemon: tweak name of debug endpoing action
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-05-27 09:42:44 +02:00
Maciej Borzecki
1dae2b5dcd Merge remote-tracking branch 'upstream/master' into bboozzoo/uc20-recovery-system-debug-create 2021-05-27 09:40:58 +02:00
Samuele Pedroni
50850d1846 daemon: tighten access to POST /v2/debug to only root
drop support for cases that have been for a long time available via
GET anyway
2021-05-26 16:17:21 +02:00
Paweł Stołowski
eac70e3598 Use plural "stacktraces". 2021-05-26 14:45:28 +02:00
Paweł Stołowski
c77ff29af1 Merge branch 'master' into debug-stacktrace 2021-05-26 12:58:21 +02:00
Paweł Stołowski
18cdd4e370 Revert "Restrict stacktrace for root, otherwise keep the rest of debug commands"
This reverts commit f901629b43.
2021-05-25 11:49:05 +02:00
Paweł Stołowski
9a73e6db2c Do not split stacktrace, just return text blob. 2021-05-25 11:21:03 +02:00
Paweł Stołowski
f901629b43 Restrict stacktrace for root, otherwise keep the rest of debug commands
with UserOK.
2021-05-25 11:18:59 +02:00
Paweł Stołowski
3416f0c87f Implement 'snap debug stacktrace command'. Restrict debug endpoint to
root only.
2021-05-25 10:40:15 +02:00
Maciej Borzecki
e65f1f2775 daemon: debug endpoint to create a recovery system
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-05-24 14:33:25 +02:00
James Henstridge
eebe1636b2 Merge remote-tracking branch 'upstream/master' into daemon-access-check 2021-04-07 17:02:42 +08:00
Samuele Pedroni
60410a2136 daemon: unexport some result objects for consistency 2021-03-16 11:42:38 +01:00
James Henstridge
6dca0bae80 daemon: reorder access checkers after method functions, to match struct layout 2020-08-27 13:48:57 +08:00