Skip to content

Commit

Permalink
fix: update the layout of the Disks API to match proxying requirements
Browse files Browse the repository at this point in the history
Fixes #3199

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
  • Loading branch information
smira authored and talos-bot committed Feb 24, 2021
1 parent 7587af9 commit 589d018
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 51 deletions.
3 changes: 2 additions & 1 deletion api/storage/storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ message Disk {
}

// DisksResponse represents the response of the `Disks` RPC.
message DisksResponse{
message Disks {
common.Metadata metadata = 1;
repeated Disk disks = 2;
}
message DisksResponse { repeated Disks messages = 1; }
6 changes: 5 additions & 1 deletion internal/app/storaged/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ func (s *Server) Disks(ctx context.Context, in *empty.Empty) (reply *storage.Dis
}

reply = &storage.DisksResponse{
Disks: diskList,
Messages: []*storage.Disks{
{
Disks: diskList,
},
},
}

return reply, nil
Expand Down
12 changes: 7 additions & 5 deletions internal/pkg/tui/installer/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ func NewState(ctx context.Context, installer *Installer, conn *Connection) (*Sta
return nil, err
}

for i, disk := range disks.Disks {
if i == 0 {
opts.MachineConfig.InstallConfig.InstallDisk = disk.DeviceName
}
for _, msg := range disks.Messages {
for i, disk := range msg.Disks {
if i == 0 {
opts.MachineConfig.InstallConfig.InstallDisk = disk.DeviceName
}

installDiskOptions = append(installDiskOptions, disk.DeviceName, disk.Model, humanize.Bytes(disk.Size))
installDiskOptions = append(installDiskOptions, disk.DeviceName, disk.Model, humanize.Bytes(disk.Size))
}
}

var machineTypes []interface{}
Expand Down
148 changes: 106 additions & 42 deletions pkg/machinery/api/storage/storage.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 18 additions & 2 deletions website/content/docs/v0.9/Reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ description: Talos gRPC API reference.

- [storage/storage.proto](#storage/storage.proto)
- [Disk](#storage.Disk)
- [Disks](#storage.Disks)
- [DisksResponse](#storage.DisksResponse)

- [StorageService](#storage.StorageService)
Expand Down Expand Up @@ -3375,9 +3376,9 @@ Disk represents a disk.



<a name="storage.DisksResponse"></a>
<a name="storage.Disks"></a>

### DisksResponse
### Disks
DisksResponse represents the response of the `Disks` RPC.


Expand All @@ -3390,6 +3391,21 @@ DisksResponse represents the response of the `Disks` RPC.




<a name="storage.DisksResponse"></a>

### DisksResponse



| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| messages | [Disks](#storage.Disks) | repeated | |





<!-- end messages -->

<!-- end enums -->
Expand Down

0 comments on commit 589d018

Please sign in to comment.