parent
b129e1b1de
commit
7685f0b5eb
9
Makefile
9
Makefile
|
@ -37,3 +37,12 @@ git-clone:
|
|||
go-clone --recursive --go-src --no-work go.wit.com/apps/virtigo
|
||||
go-clone --recursive --go-src --no-work go.wit.com/apps/gowebd
|
||||
go-clone --recursive --go-src --no-work go.wit.com/lib/daemons/virtigod
|
||||
|
||||
dump-droplets:
|
||||
./virtigoctl dump --droplets=true
|
||||
|
||||
dump-droplets-full:
|
||||
./virtigoctl dump --droplets=alsdfkj
|
||||
|
||||
start:
|
||||
./virtigoctl --start www.wit.com go.wit.com
|
||||
|
|
42
argv.go
42
argv.go
|
@ -10,27 +10,43 @@ import "go.wit.com/log"
|
|||
|
||||
var argv args
|
||||
|
||||
type args struct {
|
||||
Filename string `arg:"--filename" help:"start a vm based off the qcow2 filename"`
|
||||
Start []string `arg:"--start" help:"droplets to start"`
|
||||
type DumpCmd struct {
|
||||
Droplets bool `arg:"--droplets" help:"show the running droplets"`
|
||||
DropletsFull bool `arg:"--droplets-full" help:"show all the known droplets"`
|
||||
Hypervisors bool `arg:"--hypervisors" help:"show the hypervisors"`
|
||||
Uptime bool `arg:"--uptime" help:"show the hypervisors"`
|
||||
}
|
||||
|
||||
type CreateCmd struct {
|
||||
Filename string `arg:"--filename" help:"start a vm based off the qcow2 filename"`
|
||||
Memory int `arg:"--memory" help:"set the memory in MB"`
|
||||
Cpus int `arg:"--cpus" help:"set the cpus"`
|
||||
}
|
||||
|
||||
type ImportXml struct {
|
||||
Xml []string `arg:"--libvirt" help:"import qemu xml files: --libvirt /etc/libvirt/qemu/*.xml"`
|
||||
IgnoreCpu bool `arg:"--xml-ignore-cpu" default:"true" help:"ignore non-standard libvirt xml cpus"`
|
||||
IgnoreBr bool `arg:"--xml-ignore-net" default:"true" help:"ignore network bridge name changes"`
|
||||
IgnDisk bool `arg:"--xml-ignore-disk" default:"false" help:"ignore duplicate disk names"`
|
||||
Port int `arg:"--port" default:"8080" help:"allow droplet events via http"`
|
||||
Memory int `arg:"--memory" help:"set the memory in MB"`
|
||||
Cpus int `arg:"--cpus" help:"set the cpus"`
|
||||
}
|
||||
|
||||
DumpUptime bool `arg:"--dump-uptime" help:"show the state of the cluster"`
|
||||
DumpDroplets bool `arg:"--dump-droplets" help:"show the running droplets"`
|
||||
DumpDropletsFull bool `arg:"--dump-droplets-full" help:"show all the known droplets"`
|
||||
DumpHypervisors bool `arg:"--dump-hypervisors" help:"show the hypervisors"`
|
||||
type args struct {
|
||||
Start []string `arg:"--start" help:"droplets to start"`
|
||||
Port int `arg:"--port" default:"8080" help:"allow droplet events via http"`
|
||||
|
||||
Create *CreateCmd `arg:"subcommand:create" help:"create a new droplet"`
|
||||
Dump *DumpCmd `arg:"subcommand:dump" help:"show the state of the cluster"`
|
||||
Import *ImportXml `arg:"subcommand:import" help:"import libvirt XML"`
|
||||
}
|
||||
|
||||
func (a args) Description() string {
|
||||
return `
|
||||
virtigoctl command line configure and control for virtigo
|
||||
`
|
||||
}
|
||||
|
||||
func (args) Epilogue() string {
|
||||
return `
|
||||
This will start three already defined servers:
|
||||
|
||||
virtigoctl --start www.wit.com ftp.wit.com wiki.wit.com
|
||||
|
@ -38,7 +54,11 @@ func (a args) Description() string {
|
|||
This will make a new vm called "foo.wit.com" with the default
|
||||
virtigo values for memory, cpus, network settings, spice, etc.
|
||||
|
||||
virtigoctl --filename /home/nfs/foo.wit.com.qcow2
|
||||
virtigoctl create --filename /home/nfs/foo.wit.com.qcow2
|
||||
|
||||
create "bar.wit.com" with defaults except 1GB of RAM:
|
||||
|
||||
virtigoctl create --filename /home/nfs/bar.wit.com.qcow2 --memory 1024
|
||||
`
|
||||
}
|
||||
|
||||
|
|
17
main.go
17
main.go
|
@ -7,6 +7,7 @@ import (
|
|||
"os"
|
||||
|
||||
"go.wit.com/dev/alexflint/arg"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
var Version string
|
||||
|
@ -22,4 +23,20 @@ func main() {
|
|||
pp.WriteHelp(os.Stdout)
|
||||
os.Exit(0)
|
||||
}
|
||||
if argv.Dump != nil {
|
||||
if argv.Dump.Droplets {
|
||||
log.Info("dump droplets here ==", argv.Dump.Droplets)
|
||||
os.Exit(0)
|
||||
}
|
||||
log.Info("dump something here")
|
||||
os.Exit(0)
|
||||
}
|
||||
if argv.Create != nil {
|
||||
log.Info("create something here")
|
||||
os.Exit(0)
|
||||
}
|
||||
if argv.Start != nil {
|
||||
log.Info("start the vm's here:", argv.Start)
|
||||
os.Exit(0)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue