tests/acceptance: test hot(un)plug of ccw devices
PATCH 1/1 tests/acceptance: test hot(un)plug of ccw devices
Hotplug a virtio-net-ccw device, and then hotunplug it again.
---
This is on top of "tests/acceptance: enhance s390x devices test"
--- tests/acceptance/machine_s390_ccw_virtio.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
tests/acceptance/machine_s390_ccw_virtio.py +14 -0
@@ -97,3 +97,17 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id', '0x0000000c') + # add another device + self.vm.command('device_add', driver='virtio-net-ccw', + devno='fe.0.4711', id='xxx') + exec_command_and_wait_for_pattern(self, 'dmesg | tail -n 1', 'CRW') + exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', + '0.0.4711') + # and detach it again + self.vm.command('device_del', id='xxx') + self.vm.event_wait(name='DEVICE_DELETED', + match={'data': {'device': 'xxx'}}) + exec_command_and_wait_for_pattern(self, 'dmesg | tail -n 1', 'CRW') + exec_command_and_wait_for_pattern(self, + 'ls /sys/bus/ccw/devices/0.0.4711', + 'No such file or directory')
Signature · 1 line
2.26.2
Quoted 1 line · Cornelia Huck
Hotplug a virtio-net-ccw device, and then hotunplug it again.
Good idea! ... is it also possible with a pci device?
Quoted 14 lines
Signed-off-by Cornelia Huck <[email protected]>---
This is on top of "tests/acceptance: enhance s390x devices test"
--- tests/acceptance/machine_s390_ccw_virtio.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+)tests/acceptance/machine_s390_ccw_virtio.py +0
-0
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 102
Quoted 6 lines
tests/acceptance/machine_s390_ccw_virtio.py +3
-0@@ -97,3 +97,17 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id', '0x0000000c') + # add another device + self.vm.command('device_add', driver='virtio-net-ccw', + devno='fe.0.4711', id='xxx')
Could we use a different id, please? xxx sounds so ... well, use your imagination.
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 103
Quoted 1 line
tests/acceptance/machine_s390_ccw_virtio.py +1
-0+ exec_command_and_wait_for_pattern(self, 'dmesg | tail -n 1', 'CRW')
That looks like it could be a little bit racy ... what if the kernel outputs another log message by chance, so that tail -n 1 reports that instead.
I think it would be better to clear the dmesg log ("dmesg -c") before plugging, and then look at all the new output of "dmesg" without using "tail" afterwards.
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 110
Quoted 7 lines
tests/acceptance/machine_s390_ccw_virtio.py +7
-0+ exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', + '0.0.4711') + # and detach it again + self.vm.command('device_del', id='xxx') + self.vm.event_wait(name='DEVICE_DELETED', + match={'data': {'device': 'xxx'}}) + exec_command_and_wait_for_pattern(self, 'dmesg | tail -n 1', 'CRW')
dito
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 113
Quoted 4 lines
tests/acceptance/machine_s390_ccw_virtio.py +3
-0+ exec_command_and_wait_for_pattern(self, + 'ls /sys/bus/ccw/devices/0.0.4711', + 'No such file or directory')
Thomas
PS: Another idea for a test: Looks like that initrd also has a virtio-balloon driver ... we could maybe start with "-device virito-balloon", then change the size of the balloon and check whether the MemTotal in /proc/meminfo changed...
Quoted 4 lines · On Thu, 3 Dec 2020 18:22:35 +0100 Thomas Huth <[email protected]> wrote:
Quoted 1 line · Cornelia Huck
Hotplug a virtio-net-ccw device, and then hotunplug it again.
Good idea! ... is it also possible with a pci device?
It should be, I guess; it's not part of my normal test workflow, however.
Quoted 10 lines
Quoted 10 lines
Signed-off-by Cornelia Huck <[email protected]>---
This is on top of "tests/acceptance: enhance s390x devices test"
--- tests/acceptance/machine_s390_ccw_virtio.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Quoted 14 lines
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 102
Quoted 11 lines
tests/acceptance/machine_s390_ccw_virtio.py +3
-0@@ -97,3 +97,17 @@ class S390CCWVirtioMachine(Test): exec_command_and_wait_for_pattern(self, 'cat /sys/bus/pci/devices/000a\:00\:00.0/function_id', '0x0000000c') + # add another device + self.vm.command('device_add', driver='virtio-net-ccw', + devno='fe.0.4711', id='xxx')Could we use a different id, please? xxx sounds so ... well, use your imagination.
It is taken straight from my usual testing workflow :) But yeah, I can call this net_4711 or so.
Quoted 9 lines
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 103
Quoted 2 lines
tests/acceptance/machine_s390_ccw_virtio.py +1
-0+ exec_command_and_wait_for_pattern(self, 'dmesg | tail -n 1', 'CRW')That looks like it could be a little bit racy ... what if the kernel outputs another log message by chance, so that tail -n 1 reports that instead.
I think it would be better to clear the dmesg log ("dmesg -c") before plugging, and then look at all the new output of "dmesg" without using "tail" afterwards.
Yes, good idea. Would need to do the same dance below as well (we get a new crw).
Quoted 16 lines
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 110
Quoted 8 lines
tests/acceptance/machine_s390_ccw_virtio.py +7
-0+ exec_command_and_wait_for_pattern(self, 'ls /sys/bus/ccw/devices/', + '0.0.4711') + # and detach it again + self.vm.command('device_del', id='xxx') + self.vm.event_wait(name='DEVICE_DELETED', + match={'data': {'device': 'xxx'}}) + exec_command_and_wait_for_pattern(self, 'dmesg | tail -n 1', 'CRW')dito
tests/acceptance/machine_s390_ccw_virtio.py class S390CCWVirtioMachine(Test): · line 113
Quoted 4 lines
tests/acceptance/machine_s390_ccw_virtio.py +3
-0+ exec_command_and_wait_for_pattern(self, + 'ls /sys/bus/ccw/devices/0.0.4711', + 'No such file or directory')
Quoted 7 lines
Thomas
PS: Another idea for a test: Looks like that initrd also has a virtio-balloon driver ... we could maybe start with "-device virito-balloon", then change the size of the balloon and check whether the MemTotal in
/proc/meminfochanged...
Added to my to-test list.
Thanks!
Quoted 7 lines · Thomas Huth
Quoted 1 line · Cornelia Huck
Hotplug a virtio-net-ccw device, and then hotunplug it again.
Good idea! ... is it also possible with a pci device?
Quoted 2 lines
Signed-off-by Cornelia Huck <[email protected]>---
...
Quoted 8 lines
Quoted 1 line
+
exec_command_and_wait_for_pattern(self, 'dmesg | tail -n 1', 'CRW')That looks like it could be a little bit racy ... what if the kernel outputs another log message by chance, so that tail -n 1 reports that instead.
I think it would be better to clear the dmesg log ("dmesg -c") before plugging, and then look at all the new output of "dmesg" without using "tail" afterwards.
"dmesg --follow"?
Quoted 11 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Thomas Huth
Quoted 1 line · Cornelia Huck
Hotplug a virtio-net-ccw device, and then hotunplug it again.
Good idea! ... is it also possible with a pci device?
Quoted 2 lines
Signed-off-by Cornelia Huck <[email protected]>---
...
Quoted 2 lines
Quoted 1 line
+
exec_command_and_wait_for_pattern(self, 'dmesg | tail -n 1', 'CRW')
Quoted 8 lines
Quoted 6 lines
That looks like it could be a little bit racy ... what if the kernel outputs another log message by chance, so that tail -n 1 reports that instead.
I think it would be better to clear the dmesg log ("dmesg -c") before plugging, and then look at all the new output of "dmesg" without using "tail" afterwards.
"dmesg --follow"?
Then you'd need to send control-c afterwards to stop it? ... not sure whether that's such a better solution...
Thomas
Quoted 15 lines · Thomas Huth
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 7 lines · Thomas Huth
Quoted 1 line · Cornelia Huck
Hotplug a virtio-net-ccw device, and then hotunplug it again.
Good idea! ... is it also possible with a pci device?
Quoted 2 lines
Signed-off-by Cornelia Huck <[email protected]>---
...
Quoted 5 lines
Quoted 1 line
+
exec_command_and_wait_for_pattern(self, 'dmesg | tail -n 1', 'CRW')That looks like it could be a little bit racy ... what if the kernel outputs another log message by chance, so that tail -n 1 reports that instead.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
I think it would be better to clear the dmesg log ("dmesg -c") before plugging, and then look at all the new output of "dmesg" without using "tail" afterwards.
"dmesg --follow"?
Then you'd need to send control-c afterwards to stop it? ... not sure whether that's such a better solution...
Oh indeed, I missed there is further interaction.
Thanks,
Phil.