1

I tried to instantiate a VM using virt-install command with few interfaces as needed. The exact command is as follows:

virt-install \
    --name VM \
    --noautoconsole \
    --input keyboard \
    --os-variant rhel7.0 \
    --memory 8192 \
    --vcpus 4 \
    --boot hd \
    --sound none \
    --disk "vol=default,boot_order=1,bus=sata" \
    --disk sda6 \
    --network bridge=eth0

Immediately after this, I tried to attach an interface using virsh attach-interface command as follows:

virsh attach-interface --domain VM --type direct --source eth1 --model virtio

I was happy with the XML configuration of the VM as the interfaces showed up correctly.

$ virsh domiflist VM
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet16     bridge     eth0       virtio      52:54:00:e9:d5:4c
macvtap0   direct     eth1       virtio      52:54:00:70:be:74

But when a virsh shutdown was issued and later the VM was started, somehow the interface which was attached did not show up in the XML. I was left with only the eth0 interface. Not sure how/why the eth1 vanished.

$ virsh domiflist VM
Interface  Type       Source     Model       MAC
-------------------------------------------------------
vnet16     bridge     eth0       virtio      52:54:00:e9:d5:4c

Please let me know what can be done to avoid this situation such that the interfaces are preserved as-is like before the VM was shutdown.

1 Answers1

0

You should try the same but adding the --config flag:

virsh attach-interface --domain VM --type direct --source eth1 --model virtio --config

That should persist across reboots.

Tomas
  • 106
  • 3