keep removing old junk

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-23 00:54:37 -05:00
parent 62d406e0de
commit 889e7bb259
3 changed files with 40 additions and 41 deletions

View File

@ -7,8 +7,7 @@ REDOMOD = $(shell if [ -e go.sum ]; then echo go.sum exists; else GO111MODULE=
all:
GO111MODULE=off go build -v -ldflags "-X main.Version=${VERSION} -X gui.GUIVERSION=${VERSION}"
./virtigo --version
# ./virtigo --hosts farm01 farm02 farm03
./virtigo --start jcarr
./virtigo
start-all-droplets:
curl --silent http://localhost:8080/start?start=git.wit.org

View File

@ -11,11 +11,11 @@ import "go.wit.com/log"
var argv args
type args struct {
Dir string `arg:"--dir" help:"defaults to ~/.config/virtigo/"`
Port int `arg:"--port" default:"8080" help:"specify a different default port"`
Hosts []string `arg:"--hosts" help:"hosts to connect to"`
Uptime bool `arg:"--uptime" default:"true" help:"allow uptime checks for things like Kuma"`
Port int `arg:"--port" default:"8080" help:"specify a different default port"`
Daemon bool `arg:"--daemon" help:"run in daemon mode"`
Start string `arg:"--start" help:"droplet to start"`
}
func (a args) Description() string {

74
main.go
View File

@ -57,43 +57,6 @@ func main() {
}
*/
if argv.Start != "" {
d := findDroplet(argv.Start)
if d == nil {
log.Info("droplet is unknown:", argv.Start)
os.Exit(0)
}
log.Info("start droplet here:", d.pb.Hostname)
domcfg := makeStandardXml(d)
fmt.Printf("Virt type %s\n", domcfg.Type)
fmt.Printf("Virt name %s\n", domcfg.Name)
fmt.Printf("Virt UUID %s\n", domcfg.UUID)
fmt.Printf("Virt Memory %d %s\n", domcfg.Memory.Value, domcfg.Memory.Unit)
// test add some ethernet devices
macs := getMacs(domcfg)
fmt.Printf("Virt mac addr:%s\n", macs)
// clearEthernet(domcfg)
addEthernet(domcfg, "04:44:33:11:22:11", "worldbr")
addEthernet(domcfg, "04:44:33:33:44:55", "greenbr")
// add a check here to make these unique
// setRandomMacs(domcfg)
// print out the final mac addresses
macs = getMacs(domcfg)
fmt.Printf("Virt mac addr:%s\n", macs)
qcow := "/home/nfs/" + d.pb.Hostname + ".qcow2"
setSimpleDisk(domcfg, qcow)
writeoutXml(domcfg, "blahcarr")
os.Exit(0)
}
// start the watchdog polling for each hypervisor
for _, h := range me.hypers {
log.Info("starting polling on", h.pb.Hostname)
@ -103,3 +66,40 @@ func main() {
// sit here
startHTTP()
}
func makeDroplet(start string) {
d := findDroplet(start)
if d == nil {
log.Info("droplet is unknown:", start)
os.Exit(0)
}
log.Info("start droplet here:", d.pb.Hostname)
domcfg := makeStandardXml(d)
fmt.Printf("Virt type %s\n", domcfg.Type)
fmt.Printf("Virt name %s\n", domcfg.Name)
fmt.Printf("Virt UUID %s\n", domcfg.UUID)
fmt.Printf("Virt Memory %d %s\n", domcfg.Memory.Value, domcfg.Memory.Unit)
// test add some ethernet devices
macs := getMacs(domcfg)
fmt.Printf("Virt mac addr:%s\n", macs)
// clearEthernet(domcfg)
addEthernet(domcfg, "04:44:33:11:22:11", "worldbr")
addEthernet(domcfg, "04:44:33:33:44:55", "greenbr")
// add a check here to make these unique
// setRandomMacs(domcfg)
// print out the final mac addresses
macs = getMacs(domcfg)
fmt.Printf("Virt mac addr:%s\n", macs)
qcow := "/home/nfs/" + d.pb.Hostname + ".qcow2"
setSimpleDisk(domcfg, qcow)
writeoutXml(domcfg, "blahcarr")
os.Exit(0)
}