From fa0fce5e06544572251f0b97431f362c8a8d29a0 Mon Sep 17 00:00:00 2001 From: Othman Hendy Suseno Date: Sun, 16 Nov 2025 18:24:01 +0700 Subject: [PATCH] add qemu-guest-agent as default enabled --- main.go | 2 +- proxmox.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index b27932a..41dd2ab 100644 --- a/main.go +++ b/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() diff --git a/proxmox.go b/proxmox.go index 9143e1f..f87707d 100644 --- a/proxmox.go +++ b/proxmox.go @@ -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)},