2024-10-11 13:55:13 -05:00
|
|
|
package main
|
|
|
|
|
2024-10-12 11:54:01 -05:00
|
|
|
import "go.wit.com/log"
|
|
|
|
|
2024-10-11 13:55:13 -05:00
|
|
|
/*
|
|
|
|
this parses the command line arguements
|
|
|
|
|
|
|
|
this enables command line options from other packages like 'gui' and 'log'
|
|
|
|
*/
|
|
|
|
|
2024-10-12 00:17:26 -05:00
|
|
|
var argv args
|
|
|
|
|
2024-10-11 13:55:13 -05:00
|
|
|
type args struct {
|
2024-10-31 13:37:00 -05:00
|
|
|
Xml []string `arg:"--libvirt" help:"import qemu xml files: --libvirt /etc/libvirt/qemu/*.xml"`
|
|
|
|
Config string `arg:"env:VIRTIGO_HOME" help:"defaults to ~/.config/virtigo/"`
|
|
|
|
Port int `arg:"--port" default:"8080" help:"allow droplet events via http"`
|
2024-10-11 13:55:13 -05:00
|
|
|
}
|
2024-10-24 18:55:35 -05:00
|
|
|
|
2024-10-31 13:37:00 -05:00
|
|
|
// Daemon bool `arg:"--daemon" help:"run in daemon mode"`
|
|
|
|
// 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"`
|
|
|
|
|
2024-10-29 22:55:28 -05:00
|
|
|
// Save bool `arg:"--save" default:"false" help:"save protobuf config after import"`
|
|
|
|
// Start string `arg:"--start" help:"start a droplet"`
|
2024-10-24 15:14:47 -05:00
|
|
|
// Uptime bool `arg:"--uptime" default:"true" help:"allow uptime checks for things like Kuma"`
|
|
|
|
// Hosts []string `arg:"--hosts" help:"hosts to connect to"`
|
2024-10-11 13:55:13 -05:00
|
|
|
|
|
|
|
func (a args) Description() string {
|
|
|
|
return `
|
2024-10-24 18:55:35 -05:00
|
|
|
virtigo will help control your cluster
|
2024-10-11 13:55:13 -05:00
|
|
|
|
2024-10-24 09:27:23 -05:00
|
|
|
This maintains a master list of all your vm's (aka 'droplets')
|
|
|
|
in your homelab cloud. You can import libvirt xml files.
|
|
|
|
This app talks to your hypervisors via the virtigod daemon.
|
2024-10-24 15:14:47 -05:00
|
|
|
|
2024-11-03 01:38:09 -05:00
|
|
|
At this time, this _only_ supports qcow2 images. If you need
|
|
|
|
something else you'll have to add it in virtigolib.
|
2024-10-24 15:14:47 -05:00
|
|
|
|
2024-10-24 18:55:35 -05:00
|
|
|
This runs a http server so you can control your virtual machines.
|
|
|
|
For example to start a vm called 'www.wit.com' your cluster 'foo.bar.com':
|
2024-10-24 15:14:47 -05:00
|
|
|
|
2024-11-03 01:38:09 -05:00
|
|
|
curl http://virtigo.foo.com/start?www.wit.com
|
|
|
|
|
|
|
|
Use 'virtigoctl' to import xml files from libvirt and configure new
|
|
|
|
hypervisors in your cluster.
|
2024-10-11 13:55:13 -05:00
|
|
|
`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (args) Version() string {
|
|
|
|
return "virtigo " + Version
|
|
|
|
}
|
2024-10-12 11:54:01 -05:00
|
|
|
|
|
|
|
var INFO *log.LogFlag
|
|
|
|
var POLL *log.LogFlag
|
|
|
|
var WARN *log.LogFlag
|
2024-10-18 07:40:06 -05:00
|
|
|
var SPEW *log.LogFlag
|
2024-10-12 11:54:01 -05:00
|
|
|
var EVENT *log.LogFlag
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
full := "go.wit.com/apps/virtigo"
|
|
|
|
short := "virtigo"
|
|
|
|
|
|
|
|
INFO = log.NewFlag("INFO", false, full, short, "general virtigo")
|
|
|
|
POLL = log.NewFlag("POLL", false, full, short, "virtigo polling")
|
2024-10-27 02:29:45 -05:00
|
|
|
WARN = log.NewFlag("WARN", true, full, short, "bad things")
|
|
|
|
SPEW = log.NewFlag("SPEW", true, full, short, "dump everything")
|
2024-10-12 11:54:01 -05:00
|
|
|
EVENT = log.NewFlag("EVENT", true, full, short, "hypeprvisor/droplet events")
|
|
|
|
}
|