本文整理汇总了Golang中github.com/lxc/lxd/shared.ContainerStatus.Ips方法的典型用法代码示例。如果您正苦于以下问题:Golang ContainerStatus.Ips方法的具体用法?Golang ContainerStatus.Ips怎么用?Golang ContainerStatus.Ips使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/lxc/lxd/shared.ContainerStatus
的用法示例。
在下文中一共展示了ContainerStatus.Ips方法的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
}