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 }
func (c *containerLXD) RenderState() (*shared.ContainerState, error) { state := c.c.State() status := shared.ContainerStatus{State: state.String(), StateCode: shared.State(int(state))} if c.IsRunning() { pid, _ := c.InitPidGet() status.Init = pid status.Ips = c.iPsGet() } return &shared.ContainerState{ Name: c.name, Profiles: c.profiles, Config: c.myConfig, ExpandedConfig: c.config, Userdata: []byte{}, Status: status, Devices: c.myDevices, ExpandedDevices: c.devices, Ephemeral: c.ephemeral, }, nil }