nova/nova/tests/unit/virt
Lee Yarwood 541336a688 libvirt: Handle VIR_ERR_DEVICE_MISSING when detaching devices
Introduced in libvirt v4.1.0 [1] this error code replaces the previously
raised VIR_ERR_INVALID_ARG, VIR_ERR_OPERATION_FAILED and
VIR_ERR_INVALID_ARG codes [2][3].

VIR_ERR_OPERATION_FAILED was introduced and tested as an
active/live/hot unplug config device detach error code in
I131aaf28d2f5d5d964d4045e3d7d62207079cfb0.

VIR_ERR_INTERNAL_ERROR was introduced and tested as an
active/live/hot unplug config device detach error code in
I3055cd7641de92ab188de73733ca9288a9ca730a.

VIR_ERR_INVALID_ARG was introduced and tested as an
inactive/persistent/cold unplug config device detach error code in
I09230fc47b0950aa5a3db839a070613c9c817576.

This change introduces support for the new VIR_ERR_DEVICE_MISSING error
code while also retaining coverage for these codes until
MIN_LIBVIRT_VERSION is bumped past v4.1.0.

The majority of this change is test code motion with the existing tests
being modified to run against either the active or inactive versions of
the above  error codes for the time being.

test_detach_device_with_retry_operation_internal and
test_detach_device_with_retry_invalid_argument_no_live have been removed
as they duplicate the logic within the now refactored
_test_detach_device_with_retry_second_detach_failure.

[1] https://libvirt.org/git/?p=libvirt.git;a=commit;h=bb189c8e8c93f115c13fa3bfffdf64498f3f0ce1
[2] https://libvirt.org/git/?p=libvirt.git;a=commit;h=126db34a81bc9f9f9710408f88cceaa1e34bbbd7
[3] https://libvirt.org/git/?p=libvirt.git;a=commit;h=2f54eab7c7c618811de23c60a51e910274cf30de

Closes-Bug: #1887946
Change-Id: I7eb86edc130d186a66c04b229d46347ec5c0b625
(cherry picked from commit 902f09af25)
(cherry picked from commit 93058ae1b8)
(cherry picked from commit 863d6ef760)
(cherry picked from commit 76428c1a6a)
(cherry picked from commit 74b053f47a)
2021-01-21 19:37:14 +00:00
..
disk lxc: make use of filter python3 compatible 2019-10-02 13:41:45 +00:00
hyperv Fix 'has_calls' method calls in unit tests 2019-08-20 12:38:25 +09:00
image Use assert(Not)Equal instead of assertTrue(A == X) 2016-06-03 16:53:15 +01:00
ironic ironic: add instance_uuid before any other spawn activity 2020-07-28 10:40:05 +01:00
libvirt libvirt: Handle VIR_ERR_DEVICE_MISSING when detaching devices 2021-01-21 19:37:14 +00:00
powervm Use correct arguments in task inits 2018-02-13 17:05:21 -05:00
vmwareapi Fix wrong assertions in unit tests 2019-08-20 14:11:51 +09:00
xenapi xenapi/agent: Change openssl error handling 2019-04-30 09:07:53 -04:00
__init__.py
fakelibosinfo.py Stop sending bad values from libosinfo to libvirt 2019-10-11 09:34:10 +01:00
test_block_device.py block_device: Rollback volumes to in-use on DeviceDetachFailed 2018-08-10 16:38:18 +01:00
test_configdrive.py
test_driver.py Remove usage of parameter enforce_type 2017-04-17 20:23:19 +08:00
test_events.py
test_fake.py
test_firewall.py remove get_nw_info_for_instance from compute.utils 2017-06-13 13:30:06 +02:00
test_hardware.py [Stable Only] hardware: Handle races during pinning 2019-03-27 12:29:05 +00:00
test_imagecache.py Remove mox from tests/unit/virt/test_imagecache.py 2016-06-16 23:40:01 +00:00
test_images.py mock utils.execute() in qemu-img unit test 2018-06-11 13:31:44 +00:00
test_netutils.py Remove unnecessary code 2017-07-28 06:01:21 +00:00
test_osinfo.py Stop sending bad values from libosinfo to libvirt 2019-10-11 09:34:10 +01:00
test_virt.py Rename block_device_info_get_root 2018-01-11 20:46:13 +00:00
test_virt_drivers.py libvirt: move checking CONF.my_ip to init_host() 2019-07-22 16:30:12 -04:00