25 lines
832 B
Go
25 lines
832 B
Go
package driver
|
|
|
|
import "github.com/Nwflower/reims-go/internal/plugin"
|
|
|
|
// ReportedStateFromPlugin converts a Sidecar's `host/vm.reportState` payload
|
|
// into a table entry. Validation happens in StateTable.Report.
|
|
func ReportedStateFromPlugin(rep plugin.ReportedVMState) ReportedState {
|
|
out := ReportedState{
|
|
Ref: NewVMRef(rep.Ref.DriverID, rep.Ref.Name),
|
|
State: rep.State,
|
|
Ready: rep.Ready,
|
|
Phase: rep.Phase,
|
|
}
|
|
for _, ep := range rep.Endpoints {
|
|
out.Endpoints = append(out.Endpoints, VMEndpoint{
|
|
Kind: ep.Kind, Host: ep.Host, Port: ep.Port, User: ep.User,
|
|
Distro: ep.Distro, VM: ep.VM, Serial: ep.Serial, Ready: ep.Ready,
|
|
})
|
|
}
|
|
if rep.GuestOS != nil {
|
|
out.GuestOS = &GuestOSInfo{Family: rep.GuestOS.Family, Distro: rep.GuestOS.Distro, Version: rep.GuestOS.Version, Arch: rep.GuestOS.Arch}
|
|
}
|
|
return out
|
|
}
|