| 1 | // Copyright © 2013, 2014, The Go-LXC Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a LGPLv2.1 |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | //go:build linux && cgo |
| 6 | // +build linux,cgo |
| 7 | |
| 8 | package main |
| 9 | |
| 10 | import ( |
| 11 | "log" |
| 12 | |
| 13 | "github.com/lxc/go-lxc" |
| 14 | ) |
| 15 | |
| 16 | func main() { |
| 17 | c := lxc.Containers() |
| 18 | for i := range c { |
| 19 | log.Printf("%s\n", c[i].Name()) |
| 20 | l, err := c[i].Snapshots() |
| 21 | if err != nil { |
| 22 | log.Printf("ERROR: %s\n", err.Error()) |
| 23 | } |
| 24 | |
| 25 | for _, s := range l { |
| 26 | log.Printf("Name: %s\n", s.Name) |
| 27 | log.Printf("Comment path: %s\n", s.CommentPath) |
| 28 | log.Printf("Timestamp: %s\n", s.Timestamp) |
| 29 | log.Printf("LXC path: %s\n", s.Path) |
| 30 | log.Println() |
| 31 | } |
| 32 | c[i].Release() |
| 33 | } |
| 34 | } |