Merge pull request #142 from tomponline/tp-container-state
Container: Check container isn't nil when checking state
Stéphane Graber authored 3 years ago
GitHub committed 3 years ago
278 | 278 | |
279 | 279 | // Caller needs to hold the lock |
280 | 280 | func (c *Container) state() State { |
281 | if c.container == nil { | |
282 | return StateMap["STOPPED"] | |
283 | } | |
284 | ||
281 | 285 | return StateMap[C.GoString(C.go_lxc_state(c.container))] |
282 | 286 | } |
283 | 287 | |
1986 | 1990 | |
1987 | 1991 | if o.FSType != "" { |
1988 | 1992 | fstype := C.CString(o.FSType) |
1989 | specs.fstype = fstype | |
1993 | specs.fstype = fstype | |
1990 | 1994 | defer C.free(unsafe.Pointer(fstype)) |
1991 | 1995 | } |
1992 | 1996 | |
1993 | if o.FSSize > 0 { | |
1997 | if o.FSSize > 0 { | |
1994 | 1998 | specs.fssize = C.uint64_t(o.FSSize) |
1995 | 1999 | } |
1996 | 2000 | |
1997 | if o.ZFS.Root != "" { | |
2001 | if o.ZFS.Root != "" { | |
1998 | 2002 | zfsroot := C.CString(o.ZFS.Root) |
1999 | 2003 | specs.zfs.zfsroot = zfsroot |
2000 | 2004 | defer C.free(unsafe.Pointer(zfsroot)) |
2001 | 2005 | } |
2002 | ||
2006 | ||
2003 | 2007 | if o.LVM.VG != "" { |
2004 | 2008 | vg := C.CString(o.LVM.VG) |
2005 | 2009 | specs.lvm.vg = vg |