Created
March 4, 2012 00:52
-
-
Save fsouza/1969549 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lxc | |
import ( | |
"bytes" | |
"os/exec" | |
) | |
func LxcCreate(containerName, config string) error { | |
if err := exec.Command("sudo", "lxc-start", "--daemon", "-n", containerName).Start(); err != nil { | |
return err | |
} | |
return nil | |
} | |
func LxcDestroy(containerName string) { | |
exec.Command("sudo", "lxc-destroy", "-n", containerName).Start() | |
} | |
func LxcLs() string { | |
var out bytes.Buffer | |
cmd := exec.Command("sudo", "lxc-ls") | |
cmd.Stdout = &out | |
cmd.Run() | |
return out.String() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment