Lines Matching +full:virtio +full:- +full:device
4 * Copyright (C) 2013-2014 Red Hat Inc.
10 * See the COPYING.LIB file in the top-level directory.
15 #include "libqos/virtio.h"
34 QDict *entry_dict = qobject_to(QDict, entry->value); in look_for_drive0()
46 * This covers the possible absence of a device due to QEMU build
51 gchar *device = g_strdup_printf("%s-%s", dev, qvirtio_get_dev_type()); in has_device_builtin() local
52 bool rc = qtest_has_device(device); in has_device_builtin()
54 g_free(device); in has_device_builtin()
60 return look_for_drive0(qts, "query-block", "device"); in has_drive()
65 return look_for_drive0(qts, "query-named-block-nodes", "node-name"); in has_blockdev()
73 "{ 'execute': 'blockdev-add'," in blockdev_add_with_media()
76 " 'node-name': 'drive0'," in blockdev_add_with_media()
78 " 'driver': 'null-co'," in blockdev_add_with_media()
79 " 'read-zeroes': true" in blockdev_add_with_media()
102 "drive_add 0 if=none,id=drive0,file=null-co://," in drive_add_with_media()
103 "file.read-zeroes=on,format=raw"); in drive_add_with_media()
123 * Returns: the preferred virtio bus/device type for the current architecture.
131 return "device"; /* for virtio-mmio */ in qvirtio_get_dev_type()
141 g_autofree char *driver = g_strdup_printf("virtio-blk-%s", in device_add()
171 qts = qtest_init("-drive if=none,id=drive0 -M none"); in test_drive_without_dev()
176 /* Ensure re-adding the drive works - there should be no duplicate ID error in test_drive_without_dev()
190 if (!has_device_builtin("virtio-blk")) { in test_after_failed_device_add()
191 g_test_skip("Device virtio-blk is not available"); in test_after_failed_device_add()
195 snprintf(driver, sizeof(driver), "virtio-blk-%s", in test_after_failed_device_add()
198 qts = qtest_init("-drive if=none,id=drive0"); in test_after_failed_device_add()
200 /* Make device_add fail. If this leaks the virtio-blk device then a in test_after_failed_device_add()
214 /* Try to re-add the drive. This fails with duplicate IDs if a leaked in test_after_failed_device_add()
215 * virtio-blk device exists that holds a reference to the old drive0. in test_after_failed_device_add()
226 if (!has_device_builtin("virtio-scsi")) { in test_drive_del_device_del()
227 g_test_skip("Device virtio-scsi is not available"); in test_drive_del_device_del()
231 /* Start with a drive used by a device that unplugs instantaneously */ in test_drive_del_device_del()
232 qts = qtest_initf("-drive if=none,id=drive0,file=null-co://," in test_drive_del_device_del()
233 "file.read-zeroes=on,format=raw" in test_drive_del_device_del()
234 " -device virtio-scsi-%s" in test_drive_del_device_del()
235 " -device scsi-hd,drive=drive0,id=dev0", in test_drive_del_device_del()
239 * Delete the drive, and then the device in test_drive_del_device_del()
255 if (!has_device_builtin("virtio-blk")) { in test_cli_device_del()
256 g_test_skip("Device virtio-blk is not available"); in test_cli_device_del()
261 machine_addition = "-machine pc"; in test_cli_device_del()
265 * -drive/-device and device_del. Start with a drive used by a in test_cli_device_del()
266 * device that unplugs after reset. in test_cli_device_del()
268 qts = qtest_initf("%s -drive if=none,id=drive0,file=null-co://," in test_cli_device_del()
269 "file.read-zeroes=on,format=raw" in test_cli_device_del()
270 " -device virtio-blk-%s,drive=drive0,id=dev0", in test_cli_device_del()
284 if (!has_device_builtin("virtio-blk")) { in test_cli_device_del_q35()
285 g_test_skip("Device virtio-blk is not available"); in test_cli_device_del_q35()
290 * -drive/-device and device_del. Start with a drive used by a in test_cli_device_del_q35()
291 * device that unplugs after reset. in test_cli_device_del_q35()
293 qts = qtest_initf("-drive if=none,id=drive0,file=null-co://," in test_cli_device_del_q35()
294 "file.read-zeroes=on,format=raw " in test_cli_device_del_q35()
295 "-machine q35 -device pcie-root-port,id=p1 " in test_cli_device_del_q35()
296 "-device pcie-pci-bridge,bus=p1,id=b1 " in test_cli_device_del_q35()
297 "-device virtio-blk-%s,drive=drive0,bus=b1,id=dev0", in test_cli_device_del_q35()
310 if (!has_device_builtin("virtio-scsi")) { in test_empty_device_del()
311 g_test_skip("Device virtio-scsi is not available"); in test_empty_device_del()
316 qts = qtest_initf("-device virtio-scsi-%s -device scsi-cd,id=dev0", in test_empty_device_del()
329 if (!has_device_builtin("virtio-blk")) { in test_device_add_and_del()
330 g_test_skip("Device virtio-blk is not available"); in test_device_add_and_del()
335 machine_addition = "-machine pc"; in test_device_add_and_del()
339 * -drive/device_add and device_del. Start with a drive used by a in test_device_add_and_del()
340 * device that unplugs after reset. in test_device_add_and_del()
342 qts = qtest_initf("%s -drive if=none,id=drive0,file=null-co://," in test_device_add_and_del()
343 "file.read-zeroes=on,format=raw", machine_addition); in test_device_add_and_del()
354 g_autofree char *driver = g_strdup_printf("virtio-blk-%s", in device_add_q35()
373 if (!has_device_builtin("virtio-blk")) { in test_device_add_and_del_q35()
374 g_test_skip("Device virtio-blk is not available"); in test_device_add_and_del_q35()
379 * -drive/device_add and device_del. Start with a drive used by a in test_device_add_and_del_q35()
380 * device that unplugs after reset. in test_device_add_and_del_q35()
382 qts = qtest_initf("-machine q35 -device pcie-root-port,id=p1 " in test_device_add_and_del_q35()
383 "-device pcie-pci-bridge,bus=p1,id=b1 " in test_device_add_and_del_q35()
384 "-drive if=none,id=drive0,file=null-co://," in test_device_add_and_del_q35()
385 "file.read-zeroes=on,format=raw"); in test_device_add_and_del_q35()
400 if (!has_device_builtin("virtio-blk")) { in test_drive_add_device_add_and_del()
401 g_test_skip("Device virtio-blk is not available"); in test_drive_add_device_add_and_del()
406 machine_addition = "-machine pc"; in test_drive_add_device_add_and_del()
413 * device that unplugs after reset. in test_drive_add_device_add_and_del()
427 if (!has_device_builtin("virtio-blk")) { in test_drive_add_device_add_and_del_q35()
428 g_test_skip("Device virtio-blk is not available"); in test_drive_add_device_add_and_del_q35()
432 qts = qtest_init("-machine q35 -device pcie-root-port,id=p1 " in test_drive_add_device_add_and_del_q35()
433 "-device pcie-pci-bridge,bus=p1,id=b1"); in test_drive_add_device_add_and_del_q35()
437 * device that unplugs after reset. in test_drive_add_device_add_and_del_q35()
453 if (!has_device_builtin("virtio-blk")) { in test_blockdev_add_device_add_and_del()
454 g_test_skip("Device virtio-blk is not available"); in test_blockdev_add_device_add_and_del()
459 machine_addition = "-machine pc"; in test_blockdev_add_device_add_and_del()
466 * device that unplugs after reset, but it doesn't go away. in test_blockdev_add_device_add_and_del()
480 if (!has_device_builtin("virtio-blk")) { in test_blockdev_add_device_add_and_del_q35()
481 g_test_skip("Device virtio-blk is not available"); in test_blockdev_add_device_add_and_del_q35()
485 qts = qtest_init("-machine q35 -device pcie-root-port,id=p1 " in test_blockdev_add_device_add_and_del_q35()
486 "-device pcie-pci-bridge,bus=p1,id=b1"); in test_blockdev_add_device_add_and_del_q35()
490 * device that unplugs after reset, but it doesn't go away. in test_blockdev_add_device_add_and_del_q35()
504 qtest_add_func("/drive_del/without-dev", test_drive_without_dev); in main()