Documentation
¶
Index ¶
- Constants
- Variables
- func DaemonToProto(daemon *Daemon) (*sled.DaemonProto, error)
- func DaemonWatcherThread() error
- func EtcdConnect() (*clientv3.Client, error)
- func GetAllMacs(prefix string) (interface{}, error)
- func GetCommandStor(mac string) (*sled.CommandSet, error)
- func GetDaemonStor(mac string) (*sled.DaemonProto, error)
- func GetSledcDmesg(daemon *Daemon) (*sled.Logs, error)
- func GetSledcLogs(daemon *Daemon) (*sled.Logs, error)
- func GetTasks() ([]*sled.GetStatusResponse, error)
- func RunSledShell(daemon *Daemon, command string) (*sled.Logs, error)
- func SendToSledd(daemon *Daemon, msgType string, data interface{}, retry int) error
- func UpdateTaskStatus(id, cmd, mac string, status *sled.Response, wr *WriteMiscUpdate) (*sled.NackResponse, error)
- func UpgradeSledClient(daemon *Daemon, us *sled.UpgradeSet) (*sled.UpgradeUpdateResponse, error)
- func WithEtcd(f func(*clientv3.Client) error) error
- func WithMinEtcd(f func(*clientv3.Client) (interface{}, error)) (interface{}, error)
- type Command
- type Daemon
- type Task
- type WriteMiscUpdate
Constants ¶
const ( // TimeFormat is how time will be stored in etcd TimeFormat string = time.RFC1123 EtcdTimeout = 10 * time.Second )
const ( // ReadyMsg indicates sending the Ready request ReadyMsg = "ready" // PingMsg indicates sending the Ping request PingMsg = "ping" // HistoryMsg indicates sending the History request HistoryMsg = "history" // UptimeMsg indicates sending the Uptime request UptimeMsg = "uptime" // StatusMsg indicates sending the Status request StatusMsg = "status" // ProgressMsg indicates sending the Progress request ProgressMsg = "progress" // UpgradeMsg indicates sending the Upgrade request UpgradeMsg = "upgrade" )
Variables ¶
var ( // Namespace is the etcd namespace for each connect Namespace = "/sled/" // nolint:gochecknoglobals // TaskPrefix is the etcd task prefix for task objects TaskPrefix = "task" // nolint:gochecknoglobals // CommandPrefix is the etcd command prefix for the command object CommandPrefix = "command" // nolint:gochecknoglobals // DaemonPrefix is the etcd task prefix for task objects DaemonPrefix = "daemon" // nolint:gochecknoglobals )
var ( // DaemonRetryWait is the amount of time to wait on a ready retry failure DaemonRetryWait = 3 // nolint:gochecknoglobals // DaemonRetries is the number of times to wait on a ready retry failure DaemonRetries = 2 // nolint:gochecknoglobals )
var ( // SleddHost is the name or ip for sledapi to connect to // a sledd host for sledc daemon communications SleddHost string = "sled-server" // nolint:gochecknoglobals )
Functions ¶
func DaemonToProto ¶
func DaemonToProto(daemon *Daemon) (*sled.DaemonProto, error)
DaemonToProto converts the storage daemon to protobuf.
func DaemonWatcherThread ¶
func DaemonWatcherThread() error
DaemonWatcherThread watches the daemon key space for activity. When a key is found by watch, a message is kicked off through sledd to the sledc client for the update.
func EtcdConnect ¶
EtcdConnect tries 10 times to return EtcdClient.
func GetAllMacs ¶ added in v0.8.0
GetAllMacs does an etcd prefix get to retrieve all mac addresses.
func GetCommandStor ¶ added in v0.7.0
func GetCommandStor(mac string) (*sled.CommandSet, error)
GetCommandStor returns the commandset struct from storage.
func GetDaemonStor ¶
func GetDaemonStor(mac string) (*sled.DaemonProto, error)
GetDaemonStor returns the daemon struct from storage.
func GetSledcDmesg ¶ added in v0.8.1
GetSledcDmesg retrieves the sledc logs from the client.
func GetSledcLogs ¶ added in v0.8.0
GetSledcLogs retrieves the sledc logs from the client.
func GetTasks ¶
func GetTasks() ([]*sled.GetStatusResponse, error)
GetTasks returns all tasks with the same prefix, we keep this around for usability, but otherwise it is not needed.
func RunSledShell ¶ added in v0.8.1
RunSledShell runs a shell command on sledc.
func SendToSledd ¶
SendToSledd takes the message from the watcher function and creates the update message to send to sledd and finally onto the sledc client.
func UpdateTaskStatus ¶ added in v0.7.0
func UpdateTaskStatus( id, cmd, mac string, status *sled.Response, wr *WriteMiscUpdate) ( *sled.NackResponse, error, )
UpdateTaskStatus updates the database with the received status if sends a nack back to the client if there is an issue with the status id from what is currently stored in the database.
func UpgradeSledClient ¶ added in v0.8.0
func UpgradeSledClient(daemon *Daemon, us *sled.UpgradeSet) (*sled.UpgradeUpdateResponse, error)
UpgradeSledClient is responsible for sending an upgrade request to the client unlike other sledd messages, this message expects a response from the client indicating if the upgrade was completed (to the best of its knowledge).
Types ¶
type Command ¶
type Command struct {
Mac string
StatusID string
Wipe *sled.WipeResponse `yaml:",omitempty"`
Write *sled.WriteResponse `yaml:",omitempty"`
Kexec *sled.KexecResponse `yaml:",omitempty"`
Daemon sled.EnumStatus `yaml:",omitempty"`
Timestamp string `yaml:",omitempty"`
// contains filtered or unexported fields
}
Command struct is the data structure that contains the sled CommandSet in etcd.
func (*Command) GetVersion ¶
GetVersion returns the current datastore version of the object.
func (*Command) SetVersion ¶
SetVersion sets the current datastore version of the object.
type Daemon ¶
type Daemon struct {
Mac string
IP string `yaml:",omitempty"`
Port string `yaml:",omitempty"`
Status sled.EnumStatus `yaml:",omitempty"`
Initrd string `yaml:",omitempty"`
Disk string `yaml:",omitempty"`
Kernel string `yaml:",omitempty"`
Timestamp string `yaml:",omitempty"`
// contains filtered or unexported fields
}
Daemon struct contains the DaemonProto data structure in etcd.
func ProtoToDaemon ¶
func ProtoToDaemon(daemon *sled.DaemonProto) (*Daemon, error)
ProtoToDaemon converts the storage daemon to protobuf.
func (*Daemon) GetVersion ¶
GetVersion returns the current datastore version of the object.
func (*Daemon) SetVersion ¶
SetVersion sets the current datastore version of the object.
type Task ¶
type Task struct {
ID string
Command string
Status sled.Response_Status `yaml:",omitempty"`
Timestamp string `yaml:",omitempty"`
ErrMsg string `yaml:",omitempty"`
Mac string
// contains filtered or unexported fields
}
Task struct contains the sled Response data structure in etcd.
func (*Task) GetVersion ¶
GetVersion returns the current datastore version of the object.
func (*Task) SetVersion ¶
SetVersion sets the current datastore version of the object.