I have run into a situation when creating VMs using the qm config command from the command line.
The QM CONFIG command fails when I include any "net" options to create the VM NICs as part of VM creation. However, once the VM has been created, the QM SET command does work successfully with the same "net" option. It does not seem to matter if the value is "net0", "net1" or any other appropriate value.
For example:
root@HOST:~# qm show 208
/usr/bin/kvm -id 208 -name vm208 -no-shutdown -chardev 'socket,id=qmp,path=/var/run/qemu-server/208.qmp,server=on,wait=off' -mon 'chardev=qmp,mode=control' -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' -mon 'chardev=qmp-event,mode=control' -pidfile /var/run/qemu-server/208.pid -daemonize -smbios 'type=1,uuid=xxxx' -smp '1,sockets=1,cores=1,maxcpus=1' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vnc 'unix:/var/run/qemu-server/208.vnc,password=on' -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 512 -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'vmgenid,guid=xxxx' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'VGA,id=vga,bus=pci.0,addr=0x2' -chardev 'socket,path=/var/run/qemu-server/208.qga,server=on,wait=off,id=qga0' -device 'virtio-serial,id=qga0,bus=pci.0,addr=0x8' -device 'virtserialport,chardev=qga0,name=org.qemu.guest_agent.0' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:xxxx' -machine 'type=pc+pve0'
root@HOST:~# qm config 208 --net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1 Unknown option: net0
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
Unknown option: net
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net[0] model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
Unknown option: net[0]
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net
Unknown option: net
400 unable to parse option
qm config <vmid> [OPTIONS]
root@sm4p1:~# qm config 208 --net0
Unknown option: net0
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net[0]
Unknown option: net[0]
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm set 208 --net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
update VM 208: -net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
root@HOST:~# qm show 208
/usr/bin/kvm -id 208 -name vm208 -no-shutdown -chardev 'socket,id=qmp,path=/var/run/qemu-server/208.qmp,server=on,wait=off' -mon 'chardev=qmp,mode=control' -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' -mon 'chardev=qmp-event,mode=control' -pidfile /var/run/qemu-server/208.pid -daemonize -smbios 'type=1,uuid=xxxx' -smp '1,sockets=1,cores=1,maxcpus=1' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vnc 'unix:/var/run/qemu-server/208.vnc,password=on' -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 512 -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'vmgenid,guid=xxxx' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'VGA,id=vga,bus=pci.0,addr=0x2' -chardev 'socket,path=/var/run/qemu-server/208.qga,server=on,wait=off,id=qga0' -device 'virtio-serial,id=qga0,bus=pci.0,addr=0x8' -device 'virtserialport,chardev=qga0,name=org.qemu.guest_agent.0' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:xxxx' -netdev 'type=tap,id=net0,ifname=tap208i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=00:00:00:00:00:01,netdev=net0,bus=pci.0,addr=0x12,id=net0' -machine 'type=pc+pve0'
The QM CONFIG command fails when I include any "net" options to create the VM NICs as part of VM creation. However, once the VM has been created, the QM SET command does work successfully with the same "net" option. It does not seem to matter if the value is "net0", "net1" or any other appropriate value.
For example:
root@HOST:~# qm show 208
/usr/bin/kvm -id 208 -name vm208 -no-shutdown -chardev 'socket,id=qmp,path=/var/run/qemu-server/208.qmp,server=on,wait=off' -mon 'chardev=qmp,mode=control' -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' -mon 'chardev=qmp-event,mode=control' -pidfile /var/run/qemu-server/208.pid -daemonize -smbios 'type=1,uuid=xxxx' -smp '1,sockets=1,cores=1,maxcpus=1' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vnc 'unix:/var/run/qemu-server/208.vnc,password=on' -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 512 -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'vmgenid,guid=xxxx' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'VGA,id=vga,bus=pci.0,addr=0x2' -chardev 'socket,path=/var/run/qemu-server/208.qga,server=on,wait=off,id=qga0' -device 'virtio-serial,id=qga0,bus=pci.0,addr=0x8' -device 'virtserialport,chardev=qga0,name=org.qemu.guest_agent.0' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:xxxx' -machine 'type=pc+pve0'
root@HOST:~# qm config 208 --net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1 Unknown option: net0
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
Unknown option: net
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net[0] model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
Unknown option: net[0]
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net
Unknown option: net
400 unable to parse option
qm config <vmid> [OPTIONS]
root@sm4p1:~# qm config 208 --net0
Unknown option: net0
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm config 208 --net[0]
Unknown option: net[0]
400 unable to parse option
qm config <vmid> [OPTIONS]
root@HOST:~# qm set 208 --net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
update VM 208: -net0 model=virtio,macaddr=00:00:00:00:00:01,bridge=vmbr0,firewall=1
root@HOST:~# qm show 208
/usr/bin/kvm -id 208 -name vm208 -no-shutdown -chardev 'socket,id=qmp,path=/var/run/qemu-server/208.qmp,server=on,wait=off' -mon 'chardev=qmp,mode=control' -chardev 'socket,id=qmp-event,path=/var/run/qmeventd.sock,reconnect=5' -mon 'chardev=qmp-event,mode=control' -pidfile /var/run/qemu-server/208.pid -daemonize -smbios 'type=1,uuid=xxxx' -smp '1,sockets=1,cores=1,maxcpus=1' -nodefaults -boot 'menu=on,strict=on,reboot-timeout=1000,splash=/usr/share/qemu-server/bootsplash.jpg' -vnc 'unix:/var/run/qemu-server/208.vnc,password=on' -cpu kvm64,enforce,+kvm_pv_eoi,+kvm_pv_unhalt,+lahf_lm,+sep -m 512 -device 'pci-bridge,id=pci.1,chassis_nr=1,bus=pci.0,addr=0x1e' -device 'pci-bridge,id=pci.2,chassis_nr=2,bus=pci.0,addr=0x1f' -device 'vmgenid,guid=xxxx' -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'VGA,id=vga,bus=pci.0,addr=0x2' -chardev 'socket,path=/var/run/qemu-server/208.qga,server=on,wait=off,id=qga0' -device 'virtio-serial,id=qga0,bus=pci.0,addr=0x8' -device 'virtserialport,chardev=qga0,name=org.qemu.guest_agent.0' -iscsi 'initiator-name=iqn.1993-08.org.debian:01:xxxx' -netdev 'type=tap,id=net0,ifname=tap208i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on' -device 'virtio-net-pci,mac=00:00:00:00:00:01,netdev=net0,bus=pci.0,addr=0x12,id=net0' -machine 'type=pc+pve0'