add qemu-guest-agent as default enabled
This commit is contained in:
2
main.go
2
main.go
@@ -59,7 +59,7 @@ func main() {
|
||||
flag.StringVar(&config.ProxmoxHost, "proxmox-host", "", "Proxmox host (e.g., 192.168.1.100)")
|
||||
flag.StringVar(&config.ProxmoxUser, "proxmox-user", "root@pam", "Proxmox user")
|
||||
flag.StringVar(&config.ProxmoxPass, "proxmox-pass", "", "Proxmox password")
|
||||
flag.BoolVar(&config.GuestAgent, "guest-agent", false, "Enable QEMU guest agent")
|
||||
flag.BoolVar(&config.GuestAgent, "guest-agent", true, "Enable QEMU guest agent")
|
||||
flag.BoolVar(&config.Firewall, "firewall", false, "Enable firewall")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
@@ -54,6 +54,9 @@ func buildNetworkConfig(config *Config) string {
|
||||
if config.VlanTag > 0 {
|
||||
netConfig += fmt.Sprintf(",tag=%d", config.VlanTag)
|
||||
}
|
||||
if config.Firewall {
|
||||
netConfig += ",firewall=1"
|
||||
}
|
||||
return netConfig
|
||||
}
|
||||
|
||||
@@ -196,9 +199,8 @@ func createProxmoxVM(config *Config) error {
|
||||
},
|
||||
}
|
||||
|
||||
if config.Firewall {
|
||||
commands = append(commands, []string{"qm", "set", fmt.Sprintf("%d", config.VMID), "--firewall", "1"})
|
||||
}
|
||||
// Firewall is now handled as part of the network config (buildNetworkConfig),
|
||||
// so no separate "qm set --firewall" command is required here.
|
||||
|
||||
commands = append(commands, [][]string{
|
||||
{"qm", "template", fmt.Sprintf("%d", config.VMID)},
|
||||
|
||||
Reference in New Issue
Block a user