Beispiel #1
0
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
}
Beispiel #2
0
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
}