本文整理匯總了Golang中github.com/lxc/lxd/shared.ContainerStatus類的典型用法代碼示例。如果您正苦於以下問題:Golang ContainerStatus類的具體用法?Golang ContainerStatus怎麽用?Golang ContainerStatus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ContainerStatus類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: RenderState
func (c *containerLXD) RenderState() (*shared.ContainerState, error) {
statusCode := shared.FromLXCState(int(c.c.State()))
status := shared.ContainerStatus{
Status: statusCode.String(),
StatusCode: statusCode,
}
if c.IsRunning() {
pid, _ := c.InitPidGet()
status.Init = pid
status.Ips = c.iPsGet()
}
return &shared.ContainerState{
Name: c.name,
Profiles: c.profiles,
Config: c.baseConfig,
ExpandedConfig: c.config,
Userdata: []byte{},
Status: status,
Devices: c.baseDevices,
ExpandedDevices: c.devices,
Ephemeral: c.ephemeral,
}, nil
}
示例2: newStatus
func newStatus(c *lxc.Container, state lxc.State) shared.ContainerStatus {
status := shared.ContainerStatus{State: state.String(), StateCode: shared.State(int(state))}
if state == lxc.RUNNING {
status.Init = c.InitPid()
status.Ips = getIps(c)
}
return status
}