From Fedora Project Wiki
Description
This test case checks that NIC hotplug works correctly with virsh attach-device
and virsh attach-interface
.
How to test
- Start a guest with no NIC - i.e. use
virsh edit
to ensure there is no<interface>
- Create an XML file which looks something like:
- <interface type='network'>
- <mac address='52:54:00:ab:cd:ef'/>
- <source network='default'/>
- <model type='virtio'/>
- </interface>
- Attach the interface to the guest:
- $> virsh attach-device <guest-name> <interface-XML>
- Device attached successfully
- Check that the guest saw the device e.g. (in the guest):
- $> dmesg
- ...
- virtio-pci: 0000:00:06.0: enabling device (0000 -> 0003)
- ...
- $> lspci
- ...
- 00:06.0 Ethernet controller: Qumranet, Inc. Virtio network device
- $> ifconfig eth0
- ...
- $> ping 192.168.122.1
- ...
- Detach the interface:
- $> virsh detach-device <guest-name> <interface-XML>
- Device detached successfully
- Check the guest can no longer see the interface using the same commands as above
- Repeat with different values for
model
- e.g. e1000 and rtl8139 - Attach an interface using
virsh attach-interface
- $> virsh attach-interface <guest-name> network default
- Interface attached successfully
- And detach it again:
- $> virsh detach-interface <guest-name> network
- Interface detached successfully
Expected Results
- All operations should complete successfully
- The attached interface should appear in the guest
- The guest should have usable network connectivity using the attached interface