add qemu-guest-agent as default enabled

This commit is contained in:
2025-11-16 18:24:01 +07:00
parent 1655151d29
commit fa0fce5e06
2 changed files with 6 additions and 4 deletions

View File

@@ -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()

View File

@@ -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)},