controller v0.48.0: slice 10 P2C — enroll passes the drive into the guest
agentapi GuestAttach(where) → POST /disks/guest-attach; runStorageInit/Attach + handleStorageRegister call attachIntoGuest after register (best-effort, P3 heals). Closes Branch A: enrolled drives become usable in the guest, banner clears. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ type mockAgent struct {
|
||||
assignCalls []assignCall
|
||||
disksCalls int
|
||||
formatCalls []formatCall
|
||||
guestAttachCalls []string
|
||||
}
|
||||
|
||||
type assignCall struct{ uuid, where, fstype string }
|
||||
@@ -55,6 +56,10 @@ func (m *mockAgent) AssignDisk(_ context.Context, uuid, where, fstype, _ string)
|
||||
func (m *mockAgent) EjectDisk(_ context.Context, where string) (agentapi.EjectResult, error) {
|
||||
return agentapi.EjectResult{Ejected: where}, nil
|
||||
}
|
||||
func (m *mockAgent) GuestAttach(_ context.Context, where string) error {
|
||||
m.guestAttachCalls = append(m.guestAttachCalls, where)
|
||||
return nil
|
||||
}
|
||||
|
||||
func testServer(t *testing.T) *Server {
|
||||
t.Helper()
|
||||
@@ -166,6 +171,10 @@ func TestRunStorageInit_Success(t *testing.T) {
|
||||
if len(paths) != 1 || paths[0].Path != "/mnt/hdd1" || paths[0].Label != "Külső HDD" || !paths[0].IsDefault || !paths[0].Schedulable {
|
||||
t.Fatalf("StoragePath not registered as expected: %+v", paths)
|
||||
}
|
||||
// P2C: enroll must pass the drive into the guest.
|
||||
if len(agent.guestAttachCalls) != 1 || agent.guestAttachCalls[0] != "/mnt/hdd1" {
|
||||
t.Fatalf("enroll did not guest-attach the drive: %+v", agent.guestAttachCalls)
|
||||
}
|
||||
}
|
||||
|
||||
// Attach is non-destructive: resolve UUID → assign → register (no format).
|
||||
|
||||
Reference in New Issue
Block a user